Move Lexer::DFA#build_tables to Lexer
This commit is contained in:
1 parent
57a3e9d9f6
commit
6f1ce32775
3 files changed
+30
-30
No files matched your search
@@ -22,35 +22,6 @@ class Propane
|
||||
@start_state = @states[0]
|
||||
end
|
||||
|
||||
def build_tables
|
||||
transition_table = []
|
||||
state_table = []
|
||||
states = enumerate
|
||||
states.each do |state, id|
|
||||
accepts =
|
||||
if state.accepts.nil?
|
||||
TOKEN_NONE
|
||||
elsif state.accepts.name
|
||||
state.accepts.id
|
||||
else
|
||||
TOKEN_DROP
|
||||
end
|
||||
state_table << {
|
||||
transition_table_index: transition_table.size,
|
||||
n_transitions: state.transitions.size,
|
||||
accepts: accepts,
|
||||
}
|
||||
state.transitions.each do |transition|
|
||||
transition_table << {
|
||||
first: transition.code_point_range.first,
|
||||
last: transition.code_point_range.last,
|
||||
destination: states[transition.destination],
|
||||
}
|
||||
end
|
||||
end
|
||||
[transition_table, state_table]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def register_nfa_state_set(nfa_state_set)
|
||||
|
||||
Reference in new issue
Block a user