mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
fixed bug with comments failing to parse in open tables
This commit is contained in:
parent
ec8cc9ae66
commit
24ae69cfdf
@ -395,8 +395,9 @@ local build_grammar = wrap(function()
|
|||||||
TableValueList = TableValue * (sym"," * TableValue)^0,
|
TableValueList = TableValue * (sym"," * TableValue)^0,
|
||||||
TableLitLine = PushIndent * ((TableValueList * PopIndent) + (PopIndent * Cut)) + Space,
|
TableLitLine = PushIndent * ((TableValueList * PopIndent) + (PopIndent * Cut)) + Space,
|
||||||
|
|
||||||
TableBlockInner = Ct(KeyValueLine * (Break^1 * KeyValueLine)^0),
|
-- the unbounded table
|
||||||
TableBlock = Break * Advance * TableBlockInner * PopIndent / mark"table",
|
TableBlockInner = Ct(KeyValueLine * (SpaceBreak^1 * KeyValueLine)^0),
|
||||||
|
TableBlock = SpaceBreak^1 * Advance * TableBlockInner * PopIndent / mark"table",
|
||||||
|
|
||||||
ClassDecl = key"class" * Name * (key"extends" * Exp + C"")^-1 * TableBlock / mark"class",
|
ClassDecl = key"class" * Name * (key"extends" * Exp + C"")^-1 * TableBlock / mark"class",
|
||||||
Export = key"export" * Ct(NameList) / mark"export",
|
Export = key"export" * Ct(NameList) / mark"export",
|
||||||
|
@ -38,3 +38,9 @@ x\cool()
|
|||||||
|
|
||||||
print x.__class == Simple
|
print x.__class == Simple
|
||||||
|
|
||||||
|
|
||||||
|
class Okay
|
||||||
|
-- what is going on
|
||||||
|
something: 20323
|
||||||
|
-- yeaha
|
||||||
|
|
||||||
|
@ -66,5 +66,20 @@ whatabout = {
|
|||||||
hello "world", yeah
|
hello "world", yeah
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x =
|
||||||
|
-- yeah
|
||||||
|
something: => "hello"
|
||||||
|
cool: -- umm
|
||||||
|
--so ething
|
||||||
|
bed: {
|
||||||
|
2323,2323
|
||||||
|
}
|
||||||
|
red: 2343 -- here
|
||||||
|
-- what
|
||||||
|
name: (node) => @value node -- here
|
||||||
|
-- comment me
|
||||||
|
-- okay
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,3 +137,29 @@ end)(Hi)
|
|||||||
x = Simple()
|
x = Simple()
|
||||||
x:cool()
|
x:cool()
|
||||||
print(x.__class == Simple)
|
print(x.__class == Simple)
|
||||||
|
local Okay
|
||||||
|
Okay = (function(_parent_0)
|
||||||
|
local _base_0 = {
|
||||||
|
something = 20323
|
||||||
|
}
|
||||||
|
_base_0.__index = _base_0
|
||||||
|
if _parent_0 then
|
||||||
|
setmetatable(_base_0, getmetatable(_parent_0).__index)
|
||||||
|
end
|
||||||
|
local _class_0 = setmetatable({
|
||||||
|
__init = function(self, ...)
|
||||||
|
if _parent_0 then
|
||||||
|
return _parent_0.__init(self, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}, {
|
||||||
|
__index = _base_0,
|
||||||
|
__call = function(mt, ...)
|
||||||
|
local self = setmetatable({}, _base_0)
|
||||||
|
mt.__init(self, ...)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
})
|
||||||
|
_base_0.__class = _class_0
|
||||||
|
return _class_0
|
||||||
|
end)()
|
@ -86,3 +86,18 @@ local whatabout = {
|
|||||||
yeah,
|
yeah,
|
||||||
hello("world", yeah)
|
hello("world", yeah)
|
||||||
}
|
}
|
||||||
|
x = {
|
||||||
|
something = function(self)
|
||||||
|
return "hello"
|
||||||
|
end,
|
||||||
|
cool = {
|
||||||
|
bed = {
|
||||||
|
2323,
|
||||||
|
2323
|
||||||
|
},
|
||||||
|
red = 2343
|
||||||
|
},
|
||||||
|
name = function(self, node)
|
||||||
|
return self:value(node)
|
||||||
|
end
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user