Class: Bison::Token
- Inherits:
-
Object
- Object
- Bison::Token
- Defined in:
- lib/bison/token.rb
Instance Attribute Summary collapse
-
#associativity ⇒ Object
Returns the value of attribute associativity.
-
#names ⇒ Object
Returns the value of attribute names.
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(name, assoc = nil) ⇒ Token
constructor
A new instance of Token.
- #left? ⇒ Boolean
- #name ⇒ Object
- #right? ⇒ Boolean
Constructor Details
#initialize(name, assoc = nil) ⇒ Token
Returns a new instance of Token.
7 8 9 10 |
# File 'lib/bison/token.rb', line 7 def initialize(name, assoc=nil) self.names = Array(name) self.associativity = assoc end |
Instance Attribute Details
#associativity ⇒ Object
Returns the value of attribute associativity.
5 6 7 |
# File 'lib/bison/token.rb', line 5 def associativity @associativity end |
#names ⇒ Object
Returns the value of attribute names.
3 4 5 |
# File 'lib/bison/token.rb', line 3 def names @names end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/bison/token.rb', line 4 def number @number end |
Instance Method Details
#left? ⇒ Boolean
16 17 18 |
# File 'lib/bison/token.rb', line 16 def left? associativity == :left end |
#name ⇒ Object
12 13 14 |
# File 'lib/bison/token.rb', line 12 def name names.join(' ') end |
#right? ⇒ Boolean
20 21 22 |
# File 'lib/bison/token.rb', line 20 def right? associativity == :right end |