Class: JSON5::Token
- Inherits:
-
Object
- Object
- JSON5::Token
- Defined in:
- lib/json5/token.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#end_byte ⇒ Object
readonly
Returns the value of attribute end_byte.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#leading_trivia ⇒ Object
readonly
Returns the value of attribute leading_trivia.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#start_byte ⇒ Object
readonly
Returns the value of attribute start_byte.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(kind, value, start_byte, end_byte, line, column, raw = nil, leading_trivia = [], source: nil) ⇒ Token
constructor
A new instance of Token.
- #raw ⇒ Object
Constructor Details
#initialize(kind, value, start_byte, end_byte, line, column, raw = nil, leading_trivia = [], source: nil) ⇒ Token
Returns a new instance of Token.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/json5/token.rb', line 7 def initialize(kind, value, start_byte, end_byte, line, column, raw = nil, leading_trivia = [], source: nil) @kind = kind @value = value @start_byte = start_byte @end_byte = end_byte @line = line @column = column @raw = raw&.freeze @source = source @leading_trivia = leading_trivia freeze end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def column @column end |
#end_byte ⇒ Object (readonly)
Returns the value of attribute end_byte.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def end_byte @end_byte end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def kind @kind end |
#leading_trivia ⇒ Object (readonly)
Returns the value of attribute leading_trivia.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def leading_trivia @leading_trivia end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def line @line end |
#start_byte ⇒ Object (readonly)
Returns the value of attribute start_byte.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def start_byte @start_byte end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/json5/token.rb', line 5 def value @value end |
Instance Method Details
#raw ⇒ Object
20 21 22 |
# File 'lib/json5/token.rb', line 20 def raw @raw || @source&.byteslice(start_byte...end_byte) end |