Class: TSJSON::Token
- Inherits:
-
Object
- Object
- TSJSON::Token
- Defined in:
- lib/language/lexer/token.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#end_pos ⇒ Object
Returns the value of attribute end_pos.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#line ⇒ Object
Returns the value of attribute line.
-
#next ⇒ Object
Returns the value of attribute next.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#start_pos ⇒ Object
Returns the value of attribute start_pos.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(kind, start_pos, end_pos, line, column, prev, value = nil) ⇒ Token
constructor
A new instance of Token.
- #toJSON ⇒ Object
Constructor Details
#initialize(kind, start_pos, end_pos, line, column, prev, value = nil) ⇒ Token
Returns a new instance of Token.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/language/lexer/token.rb', line 12 def initialize(kind, start_pos, end_pos, line, column, prev, value = nil) self.kind = kind self.start_pos = start_pos self.end_pos = end_pos self.line = line self.column = column self.value = value self.prev = prev self.next = nil end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def column @column end |
#end_pos ⇒ Object
Returns the value of attribute end_pos.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def end_pos @end_pos end |
#kind ⇒ Object
Returns the value of attribute kind.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def kind @kind end |
#line ⇒ Object
Returns the value of attribute line.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def line @line end |
#next ⇒ Object
Returns the value of attribute next.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def prev @prev end |
#start_pos ⇒ Object
Returns the value of attribute start_pos.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def start_pos @start_pos end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/language/lexer/token.rb', line 3 def value @value end |
Instance Method Details
#toJSON ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/language/lexer/token.rb', line 23 def toJSON { kind: self.kind, start: self.start_pos, end: self.end_pos, line: self.line, column: self.column, value: self.value }.compact end |