Compare commits

..

No commits in common. "f402315201e3b9c8f58e6e06677bdb1ec6d23090" and "64974cc1e2fca9aafa98505884bda2e4fe14c9ff" have entirely different histories.

4 changed files with 6 additions and 7 deletions

View File

@ -360,7 +360,7 @@ class <%= @classname %>
} }
else if (attempt_match_info.length == 0u) else if (attempt_match_info.length == 0u)
{ {
result.token = TOKEN___EOF; result.token = TOKEN_0EOF;
result.type = Result.Type.TOKEN; result.type = Result.Type.TOKEN;
return; return;
} }
@ -471,7 +471,7 @@ class <%= @classname %>
if (shift_state == 0xFFFFFFFFu) if (shift_state == 0xFFFFFFFFu)
{ {
shift_state = check_shift(statevalues[$-1].state, token); shift_state = check_shift(statevalues[$-1].state, token);
if ((shift_state != 0xFFFFFFFFu) && (token == TOKEN___EOF)) if ((shift_state != 0xFFFFFFFFu) && (token == TOKEN_0EOF))
{ {
/* Successful parse. */ /* Successful parse. */
parse_result = statevalues[$-1].pvalue; parse_result = statevalues[$-1].pvalue;

View File

@ -2,8 +2,7 @@ class Propane
class Grammar class Grammar
# Reserve identifiers beginning with a double-underscore for internal use. IDENTIFIER_REGEX = /[a-zA-Z_][a-zA-Z_0-9]*/
IDENTIFIER_REGEX = /(?:[a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z_0-9]*/
attr_reader :classname attr_reader :classname
attr_reader :modulename attr_reader :modulename

View File

@ -9,7 +9,7 @@ class Propane
# @return [String] # @return [String]
# Name of the token to use in code (special characters replaced). # Name of the token to use in code (special characters replaced).
def code_name(name) def code_name(name)
name.sub(/^\$/, "__") name.sub(/^\$/, "0")
end end
end end

View File

@ -45,8 +45,8 @@ unittest
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 0, 3, Testparser.TOKEN_int)); assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 0, 3, Testparser.TOKEN_int));
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 4, 1, Testparser.TOKEN_plus)); assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 4, 1, Testparser.TOKEN_plus));
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 6, 3, Testparser.TOKEN_int)); assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 6, 3, Testparser.TOKEN_int));
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 9, 0, Testparser.TOKEN___EOF)); assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 9, 0, Testparser.TOKEN_0EOF));
lexer = new Testparser.Lexer(""); lexer = new Testparser.Lexer("");
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 0, 0, 0, Testparser.TOKEN___EOF)); assert(lexer.lex_token() == Result(Result.Type.TOKEN, 0, 0, 0, Testparser.TOKEN_0EOF));
} }