aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-05-28 23:24:18 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-05-28 23:24:43 -0700
commitb6be516e3fbc082b1dbd9740b95185976f4b0040 (patch)
tree69d5b148bf9344edbbf3289f41fdf876af519e1e
parent66fa60100e64a1ec2d54e884c5d6e4a98e88fa56 (diff)
Fix for luajit, though I'm not sure why it worked for lua either.
-rw-r--r--nomsu.lua4
-rwxr-xr-xnomsu.moon5
-rw-r--r--nomsu.peg2
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)