Class: Collie::AST::Symbol
- Inherits:
-
Object
- Object
- Collie::AST::Symbol
- Defined in:
- lib/collie/ast.rb
Overview
Symbol reference (terminal or nonterminal)
Instance Attribute Summary collapse
-
#alias_name ⇒ Object
Returns the value of attribute alias_name.
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name:, kind:, alias_name: nil, arguments: nil, location: nil) ⇒ Symbol
constructor
A new instance of Symbol.
- #nonterminal? ⇒ Boolean
- #terminal? ⇒ Boolean
Constructor Details
#initialize(name:, kind:, alias_name: nil, arguments: nil, location: nil) ⇒ Symbol
Returns a new instance of Symbol.
114 115 116 117 118 119 120 |
# File 'lib/collie/ast.rb', line 114 def initialize(name:, kind:, alias_name: nil, arguments: nil, location: nil) @name = name @kind = kind # :terminal, :nonterminal @alias_name = alias_name @arguments = arguments # For parameterized rule calls like list(expr) @location = location end |
Instance Attribute Details
#alias_name ⇒ Object
Returns the value of attribute alias_name.
112 113 114 |
# File 'lib/collie/ast.rb', line 112 def alias_name @alias_name end |
#arguments ⇒ Object
Returns the value of attribute arguments.
112 113 114 |
# File 'lib/collie/ast.rb', line 112 def arguments @arguments end |
#kind ⇒ Object
Returns the value of attribute kind.
112 113 114 |
# File 'lib/collie/ast.rb', line 112 def kind @kind end |
#location ⇒ Object
Returns the value of attribute location.
112 113 114 |
# File 'lib/collie/ast.rb', line 112 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
112 113 114 |
# File 'lib/collie/ast.rb', line 112 def name @name end |
Instance Method Details
#nonterminal? ⇒ Boolean
126 127 128 |
# File 'lib/collie/ast.rb', line 126 def nonterminal? kind == :nonterminal end |
#terminal? ⇒ Boolean
122 123 124 |
# File 'lib/collie/ast.rb', line 122 def terminal? kind == :terminal end |