Fixed: "protected", "const", "namespace", "package" are not reserved keywords in AS1/2

Fixed: Not counting newlines in comments
This commit is contained in:
Jindra Petřík
2021-03-25 10:11:48 +01:00
parent 781c3dbb46
commit 68ae269515
10 changed files with 1472 additions and 1511 deletions

View File

@@ -106,6 +106,9 @@ import java.util.Stack;
return ret;
}
private int count(String str, String target) {
return (str.length() - str.replace(target, "").length()) / target.length();
}
%}
/* main character classes */
@@ -357,7 +360,7 @@ RegExp = \/([^\r\n/]|\\\/)+\/[a-z]*
{DoubleLiteral} { return new ParsedSymbol(SymbolGroup.DOUBLE, SymbolType.DOUBLE, Double.parseDouble((yytext()))); }
/* comments */
{Comment} { /*ignore*/ }
{Comment} { yyline += count(yytext(),"\n"); }
{LineTerminator} { yyline++;}
/* whitespace */