Generate enum of token identifiers
This commit is contained in:
parent
ebc1d8f001
commit
5881f13380
@ -4,4 +4,10 @@ module <%= @grammar.modulename %>;
|
||||
<% end %>
|
||||
class <%= classname %>
|
||||
{
|
||||
enum
|
||||
{
|
||||
<% @grammar.tokens.each do |token| %>
|
||||
TOKEN_<%= token.c_name %>,
|
||||
<% end %>
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ module Imbecile
|
||||
@nfa = regex.nfa
|
||||
end
|
||||
|
||||
def c_name
|
||||
@name.upcase
|
||||
end
|
||||
|
||||
def to_s
|
||||
@name
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user