From b6be516e3fbc082b1dbd9740b95185976f4b0040 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 28 May 2018 23:24:18 -0700 Subject: [PATCH] Fix for luajit, though I'm not sure why it worked for lua either. --- nomsu.lua | 4 +++- nomsu.moon | 5 ++++- nomsu.peg | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nomsu.lua b/nomsu.lua index fcd8d38..2587080 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -1,6 +1,7 @@ local _pairs, _ipairs = pairs, ipairs if jit then package.cpath = "./luajit_lpeg/?.so;" .. package.cpath + lpeg = require("lpeglj") bit32 = require('bit') pairs = function(x) do @@ -24,9 +25,10 @@ if jit then end return _ipairs(x) end +else + lpeg = require('lpeg') end re = require('re') -lpeg = require('lpeg') lpeg.setmaxstack(10000) local P, R, V, S, Cg, C, Cp, B, Cmt, Carg P, R, V, S, Cg, C, Cp, B, Cmt, Carg = lpeg.P, lpeg.R, lpeg.V, lpeg.S, lpeg.Cg, lpeg.C, lpeg.Cp, lpeg.B, lpeg.Cmt, lpeg.Carg diff --git a/nomsu.moon b/nomsu.moon index 1da214b..7667600 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -14,6 +14,8 @@ export lpeg, re _pairs, _ipairs = pairs, ipairs if jit package.cpath = "./luajit_lpeg/?.so;"..package.cpath + --package.path = "./LPegLJ/src/?.lua;"..package.path + lpeg = require "lpeglj" export bit32 bit32 = require('bit') @@ -29,9 +31,10 @@ if jit if mt.__ipairs return mt.__ipairs(x) return _ipairs(x) +else + lpeg = require 'lpeg' re = require 're' -lpeg = require 'lpeg' lpeg.setmaxstack 10000 {:P,:R,:V,:S,:Cg,:C,:Cp,:B,:Cmt,:Carg} = lpeg utils = require 'utils' diff --git a/nomsu.peg b/nomsu.peg index a21d562..b705de5 100644 --- a/nomsu.peg +++ b/nomsu.peg @@ -54,7 +54,7 @@ action (Action): word: { %operator / (!number plain_word) } -text_word (Text): {%operator / (!number plain_word)} +text_word (Text): {| {%operator / (!number plain_word)} |} inline_text (Text): !('".."' eol)