Name internally generated tokens with double-underscore
This commit is contained in:
parent
d10e982fc8
commit
f402315201
@ -360,7 +360,7 @@ class <%= @classname %>
|
|||||||
}
|
}
|
||||||
else if (attempt_match_info.length == 0u)
|
else if (attempt_match_info.length == 0u)
|
||||||
{
|
{
|
||||||
result.token = TOKEN_0EOF;
|
result.token = TOKEN___EOF;
|
||||||
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_0EOF))
|
if ((shift_state != 0xFFFFFFFFu) && (token == TOKEN___EOF))
|
||||||
{
|
{
|
||||||
/* Successful parse. */
|
/* Successful parse. */
|
||||||
parse_result = statevalues[$-1].pvalue;
|
parse_result = statevalues[$-1].pvalue;
|
||||||
|
@ -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(/^\$/, "0")
|
name.sub(/^\$/, "__")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -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_0EOF));
|
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 1, 9, 0, Testparser.TOKEN___EOF));
|
||||||
|
|
||||||
lexer = new Testparser.Lexer("");
|
lexer = new Testparser.Lexer("");
|
||||||
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 0, 0, 0, Testparser.TOKEN_0EOF));
|
assert(lexer.lex_token() == Result(Result.Type.TOKEN, 0, 0, 0, Testparser.TOKEN___EOF));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user