Item 7 of 63 Previous | Next

1
Vote

cannot correctly parse return statement

description

The DocumentParser.Parse method sometimes cannot correctly parse the return statement in any block. If there are any statements before the return statement, the return keyword (KWRETURN) might be considered syntaxtical illegal.
I can figured this problem out by going deeply into the parser code, but cannot tell how to fix it. I tried to modify the parser.y file but failed.
Parsing the following Lua code will recreate this issue:
-- The following code can be correctly parsed
function foo()
return 3
end
-- The following code will be parsed with the return statement lost
function foo()
local a = 3
return a
end

No files are attached

comments

hillin wrote Nov 10 2010 at 1:52 PM

sorry but I misspelled the class name DocumentationParser