end\r
if type(ast) == 'table'then\r
local ali = ast.lineinfo\r
- local a1 = ast[1]\r
- local comments = ali and ali.comments or \r
- type(a1)=='table' and a1.lineinfo and a1.lineinfo.comments\r
- if not ali or ali.first~=fli or ali.last~=lli or ali.comments~=comments then\r
- ast.lineinfo = { first=fli, last=lli, comments = comments }\r
+ if not ali or ali.first~=fli or ali.last~=lli then\r
+ ast.lineinfo = { first = fli, last = lli }\r
end\r
end\r
return ast\r
if lli[2]==-1 then lli[1], lli[2] = lli[1]-1, previous_line_length-1 end
if #self.attached_comments > 0 then
a.lineinfo.comments = self.attached_comments
- self.attached_comments = nil
+ fli.comments = self.attached_comments
+ if self.lineinfo_last then
+ self.lineinfo_last.comments = self.attached_comments
+ end
end
self.attached_comments = { }
return setmetatable (a, self.token_metatable)
self.line, self.i = li[1], li[3]
self.column_offset = self.i - li[2]
self.peeked = { }
- self.attached_comments = p1.lineinfo.comments or { }
+ self.attached_comments = p1.lineinfo.first.comments or { }
end
end