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