mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
shebang support
This commit is contained in:
parent
05b3a8f989
commit
9bc2b1eef4
@ -48,6 +48,8 @@ Num = Space * (Num / function(value) return {"number", value} end)
|
||||
local FactorOp = Space * C(S"+-")
|
||||
local TermOp = Space * C(S"*/%^")
|
||||
|
||||
local Shebang = P"#!" * P(1 - Stop)^0
|
||||
|
||||
local function wrap(fn)
|
||||
local env = getfenv(fi)
|
||||
|
||||
@ -244,7 +246,7 @@ local build_grammar = wrap(function()
|
||||
|
||||
local g = lpeg.P{
|
||||
File,
|
||||
File = Block + Ct"",
|
||||
File = Shebang^-1 * (Block + Ct""),
|
||||
Block = Ct(Line * (Break^1 * Line)^0),
|
||||
Line = Cmt(Indent, check_indent) * Statement + Space * #Break,
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
#!/this/is/ignored
|
||||
|
||||
a = 1 + 2* 3 / 6
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user