Do not generate token names for drop tokens
This commit is contained in:
parent
61dd5bc5a0
commit
93cb25df62
@ -6,8 +6,10 @@ class <%= classname %>
|
||||
{
|
||||
enum
|
||||
{
|
||||
<% @grammar.tokens.each do |token| %>
|
||||
TOKEN_<%= token.c_name %>,
|
||||
<% @grammar.tokens.each_with_index do |token, index| %>
|
||||
<% if token.name %>
|
||||
TOKEN_<%= token.c_name %> = <%= index %>,
|
||||
<% end %>
|
||||
<% end %>
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,16 @@ module Imbecile
|
||||
state_table = []
|
||||
states = enumerate
|
||||
states.each do |state, id|
|
||||
accepts =
|
||||
if state.accepts
|
||||
if state.accepts.name
|
||||
state.accepts.id
|
||||
else
|
||||
0xFFFFFFFE # drop token
|
||||
end
|
||||
else
|
||||
0xFFFFFFFF # not an accepting state
|
||||
end
|
||||
state_table << {
|
||||
transition_table_index: transition_table.size,
|
||||
n_transitions: state.transitions.size,
|
||||
|
Loading…
x
Reference in New Issue
Block a user