Improve processing of first-line comments by LuaParser

This commit is contained in:
James Roseborough
2012-09-01 04:59:14 +00:00
parent 6ac7e6e452
commit e0e2452d74
5 changed files with 53 additions and 103 deletions

View File

@@ -157,7 +157,6 @@ TOKEN :
| < #QUOTED: <DECIMAL> | <UNICODE> | <CHAR> >
| < #DECIMAL: "\\" ["0"-"9"] (["0"-"9"])? (["0"-"9"])? >
| < DBCOLON: "::" >
| < SHEBANG: "#" ["!"," "] (~["\n","\r"])* (<LF>)? >
| < #UNICODE: "\\" "u" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> >
| < #CHAR: "\\" (~[]) >
| < #LF: ("\n" | "\r" | "\r\n") >
@@ -169,7 +168,7 @@ Chunk Chunk():
Block b;
}
{
( <SHEBANG> )? b=Block() <EOF> { return new Chunk(b); }
( "#" { token_source.SwitchTo(IN_COMMENT); } )? b=Block() <EOF> { return new Chunk(b); }
}
Block Block():