diff options
author | yui-knk <spiketeika@gmail.com> | 2023-12-01 18:02:56 +0900 |
---|---|---|
committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2023-12-02 08:58:32 +0900 |
commit | 9f6c6f88c3b135a41efc3e76c4b3c012141ef8b1 (patch) | |
tree | e0ab219586612e33204ccbee1240655c738c4b95 /tool/lrama/lib/lrama/grammar/symbol.rb | |
parent | 818813c2bde674f85804891df380c271637c0c8e (diff) |
Lrama v0.5.11
Diffstat (limited to 'tool/lrama/lib/lrama/grammar/symbol.rb')
-rw-r--r-- | tool/lrama/lib/lrama/grammar/symbol.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tool/lrama/lib/lrama/grammar/symbol.rb b/tool/lrama/lib/lrama/grammar/symbol.rb index 39e5218d53..df866db716 100644 --- a/tool/lrama/lib/lrama/grammar/symbol.rb +++ b/tool/lrama/lib/lrama/grammar/symbol.rb @@ -6,10 +6,23 @@ module Lrama class Grammar - class Symbol < Struct.new(:id, :alias_name, :number, :tag, :term, :token_id, :nullable, :precedence, :printer, :error_token, keyword_init: true) - attr_accessor :first_set, :first_set_bitmap + class Symbol + attr_accessor :id, :alias_name, :tag, :number, :token_id, :nullable, :precedence, :printer, :error_token, :first_set, :first_set_bitmap + attr_reader :term attr_writer :eof_symbol, :error_symbol, :undef_symbol, :accept_symbol + def initialize(id:, alias_name: nil, number: nil, tag: nil, term:, token_id: nil, nullable: nil, precedence: nil, printer: nil) + @id = id + @alias_name = alias_name + @number = number + @tag = tag + @term = term + @token_id = token_id + @nullable = nullable + @precedence = precedence + @printer = printer + end + def term? term end @@ -41,6 +54,7 @@ module Lrama # name for yysymbol_kind_t # # See: b4_symbol_kind_base + # @type var name: String def enum_name case when accept_symbol? |