Rename lexer state "accepts" to "token"

This commit is contained in:
Josh Holtrop 2022-09-25 14:57:46 -04:00
parent 4d716f6c10
commit 48704295bb
2 changed files with 6 additions and 6 deletions

View File

@ -118,7 +118,7 @@ class <%= @classname %>
{
uint transition_table_index;
uint n_transitions;
uint accepts;
uint token;
uint code_id;
}
@ -133,7 +133,7 @@ class <%= @classname %>
<% state_table.each do |state_table_entry| %>
State(<%= state_table_entry[:transition_table_index] %>u,
<%= state_table_entry[:n_transitions] %>u,
<%= state_table_entry[:accepts] %>u,
<%= state_table_entry[:token] %>u,
<%= state_table_entry[:code_id] %>u),
<% end %>
];
@ -236,9 +236,9 @@ class <%= @classname %>
attempt_match_info.delta_col++;
}
current_state = dest;
if (states[current_state].accepts != _TOKEN_NONE)
if (states[current_state].token != _TOKEN_NONE)
{
attempt_match_info.token = states[current_state].accepts;
attempt_match_info.token = states[current_state].token;
attempt_match_info.code_id = states[current_state].code_id;
longest_match_info = attempt_match_info;
}

View File

@ -14,7 +14,7 @@ class Propane
state_table = []
states = @dfa.enumerate
states.each do |state, id|
accepts =
token =
if state.accepts.nil?
TOKEN_NONE
elsif state.accepts.drop?
@ -31,7 +31,7 @@ class Propane
state_table << {
transition_table_index: transition_table.size,
n_transitions: state.transitions.size,
accepts: accepts,
token: token,
code_id: code_id,
}
state.transitions.each do |transition|