Update generated lexer state and transition tables
This commit is contained in:
parent
98584ce07a
commit
10a8ef5eb4
@ -20,23 +20,21 @@ class <%= classname %>
|
|||||||
|
|
||||||
private struct LexerState
|
private struct LexerState
|
||||||
{
|
{
|
||||||
Transition[] transitions;
|
uint transition_table_index;
|
||||||
size_t accepts;
|
uint n_transitions;
|
||||||
|
uint accepts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<% transition_table, state_table = lexer_dfa.build_tables %>
|
||||||
|
private static const Transition transitions[] = [
|
||||||
|
<% transition_table.each do |transition_table_entry| %>
|
||||||
|
Transition(<%= transition_table_entry[:first] %>, <%= transition_table_entry[:last] %>, <%= transition_table_entry[:destination] %>),
|
||||||
|
<% end %>
|
||||||
|
];
|
||||||
|
|
||||||
private static const LexerState lexer_states[] = [
|
private static const LexerState lexer_states[] = [
|
||||||
<% lexer_dfa.enumerate.each do |state, index| %>
|
<% state_table.each do |state_table_entry| %>
|
||||||
LexerState([
|
LexerState(<%= state_table_entry[:transition_table_index] %>, <%= state_table_entry[:n_transitions] %>, <%= state_table_entry[:accepts] %>),
|
||||||
<% state.transitions.each do |transition| %>
|
|
||||||
Transition(<%= transition.code_point_range.first %>, <%= transition.code_point_range.last %>, <%= lexer_dfa.enumerate[transition.destination] %>),
|
|
||||||
<% end %>
|
|
||||||
],
|
|
||||||
<% if state.accepts %>
|
|
||||||
<%= state.accepts.id %>,
|
|
||||||
<% else %>
|
|
||||||
cast(size_t)-1,
|
|
||||||
<% end %>
|
|
||||||
),
|
|
||||||
<% end %>
|
<% end %>
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user