Class: Ibex::IR::LexerRule
- Inherits:
-
Object
- Object
- Ibex::IR::LexerRule
- Defined in:
- lib/ibex/ir/lexer_ir.rb,
sig/ibex/ir/lexer_ir.rbs
Overview
One normalized, state-scoped lexer rule.
Instance Attribute Summary collapse
- #action ⇒ String? readonly
- #id ⇒ Integer readonly
- #kind ⇒ Symbol readonly
- #location ⇒ location readonly
- #options ⇒ String readonly
- #pattern ⇒ String readonly
- #pattern_kind ⇒ Symbol readonly
- #state ⇒ String readonly
- #token ⇒ String? readonly
Instance Method Summary collapse
-
#initialize(id:, state:, kind:, token:, pattern:, pattern_kind:, options:, action:, location:) ⇒ LexerRule
constructor
A new instance of LexerRule.
- #to_h ⇒ Hash[Symbol, untyped]
Constructor Details
#initialize(id:, state:, kind:, token:, pattern:, pattern_kind:, options:, action:, location:) ⇒ LexerRule
Returns a new instance of LexerRule.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ibex/ir/lexer_ir.rb', line 22 def initialize(id:, state:, kind:, token:, pattern:, pattern_kind:, options:, action:, location:) @id = id @state = state.freeze @kind = kind @token = token&.freeze @pattern = pattern.freeze @pattern_kind = pattern_kind @options = .freeze @action = action&.freeze @location = IR.deep_freeze(location) freeze end |
Instance Attribute Details
#action ⇒ String? (readonly)
17 18 19 |
# File 'lib/ibex/ir/lexer_ir.rb', line 17 def action @action end |
#id ⇒ Integer (readonly)
10 11 12 |
# File 'lib/ibex/ir/lexer_ir.rb', line 10 def id @id end |
#kind ⇒ Symbol (readonly)
12 13 14 |
# File 'lib/ibex/ir/lexer_ir.rb', line 12 def kind @kind end |
#location ⇒ location (readonly)
18 19 20 |
# File 'lib/ibex/ir/lexer_ir.rb', line 18 def location @location end |
#options ⇒ String (readonly)
16 17 18 |
# File 'lib/ibex/ir/lexer_ir.rb', line 16 def @options end |
#pattern ⇒ String (readonly)
14 15 16 |
# File 'lib/ibex/ir/lexer_ir.rb', line 14 def pattern @pattern end |
#pattern_kind ⇒ Symbol (readonly)
15 16 17 |
# File 'lib/ibex/ir/lexer_ir.rb', line 15 def pattern_kind @pattern_kind end |
#state ⇒ String (readonly)
11 12 13 |
# File 'lib/ibex/ir/lexer_ir.rb', line 11 def state @state end |
#token ⇒ String? (readonly)
13 14 15 |
# File 'lib/ibex/ir/lexer_ir.rb', line 13 def token @token end |
Instance Method Details
#to_h ⇒ Hash[Symbol, untyped]
36 37 38 39 40 41 |
# File 'lib/ibex/ir/lexer_ir.rb', line 36 def to_h { id: @id, state: @state, kind: @kind, token: @token, pattern: @pattern, pattern_kind: @pattern_kind, options: @options, action: @action, loc: @location } end |