Fix for luajit, though I'm not sure why it worked for lua either.

This commit is contained in:
Bruce Hill 2018-05-28 23:24:18 -07:00
parent 66fa60100e
commit b6be516e3f
3 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,7 @@
local _pairs, _ipairs = pairs, ipairs local _pairs, _ipairs = pairs, ipairs
if jit then if jit then
package.cpath = "./luajit_lpeg/?.so;" .. package.cpath package.cpath = "./luajit_lpeg/?.so;" .. package.cpath
lpeg = require("lpeglj")
bit32 = require('bit') bit32 = require('bit')
pairs = function(x) pairs = function(x)
do do
@ -24,9 +25,10 @@ if jit then
end end
return _ipairs(x) return _ipairs(x)
end end
else
lpeg = require('lpeg')
end end
re = require('re') re = require('re')
lpeg = require('lpeg')
lpeg.setmaxstack(10000) lpeg.setmaxstack(10000)
local P, R, V, S, Cg, C, Cp, B, Cmt, Carg 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 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

View File

@ -14,6 +14,8 @@ export lpeg, re
_pairs, _ipairs = pairs, ipairs _pairs, _ipairs = pairs, ipairs
if jit if jit
package.cpath = "./luajit_lpeg/?.so;"..package.cpath package.cpath = "./luajit_lpeg/?.so;"..package.cpath
--package.path = "./LPegLJ/src/?.lua;"..package.path
lpeg = require "lpeglj"
export bit32 export bit32
bit32 = require('bit') bit32 = require('bit')
@ -29,9 +31,10 @@ if jit
if mt.__ipairs if mt.__ipairs
return mt.__ipairs(x) return mt.__ipairs(x)
return _ipairs(x) return _ipairs(x)
else
lpeg = require 'lpeg'
re = require 're' re = require 're'
lpeg = require 'lpeg'
lpeg.setmaxstack 10000 lpeg.setmaxstack 10000
{:P,:R,:V,:S,:Cg,:C,:Cp,:B,:Cmt,:Carg} = lpeg {:P,:R,:V,:S,:Cg,:C,:Cp,:B,:Cmt,:Carg} = lpeg
utils = require 'utils' utils = require 'utils'

View File

@ -54,7 +54,7 @@ action (Action):
word: { %operator / (!number plain_word) } word: { %operator / (!number plain_word) }
text_word (Text): {%operator / (!number plain_word)} text_word (Text): {| {%operator / (!number plain_word)} |}
inline_text (Text): inline_text (Text):
!('".."' eol) !('".."' eol)