Class: GraphQL::Language::Token
- Inherits:
-
Object
- Object
- GraphQL::Language::Token
- Defined in:
- lib/graphql/language/token.rb
Overview
Emitted by the lexer and passed to the parser. Contains type, value and position data.
Instance Attribute Summary collapse
-
#line ⇒ Symbol
readonly
The kind of token this is.
-
#name ⇒ Symbol
readonly
The kind of token this is.
-
#prev_token ⇒ Symbol
readonly
The kind of token this is.
Instance Method Summary collapse
-
#initialize(value:, name:, line:, col:, prev_token:) ⇒ Token
constructor
A new instance of Token.
- #line_and_column ⇒ Object
- #to_f ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value:, name:, line:, col:, prev_token:) ⇒ Token
Returns a new instance of Token.
10 11 12 13 14 15 16 |
# File 'lib/graphql/language/token.rb', line 10 def initialize(value:, name:, line:, col:, prev_token:) @name = name @value = value @line = line @col = col @prev_token = prev_token end |
Instance Attribute Details
#line ⇒ Symbol (readonly)
Returns The kind of token this is.
8 9 10 |
# File 'lib/graphql/language/token.rb', line 8 def line @line end |
#name ⇒ Symbol (readonly)
Returns The kind of token this is.
8 9 10 |
# File 'lib/graphql/language/token.rb', line 8 def name @name end |
#prev_token ⇒ Symbol (readonly)
Returns The kind of token this is.
8 9 10 |
# File 'lib/graphql/language/token.rb', line 8 def prev_token @prev_token end |
Instance Method Details
#line_and_column ⇒ Object
22 23 24 |
# File 'lib/graphql/language/token.rb', line 22 def line_and_column [@line, @col] end |
#to_f ⇒ Object
20 |
# File 'lib/graphql/language/token.rb', line 20 def to_f; @value.to_f; end |
#to_i ⇒ Object
19 |
# File 'lib/graphql/language/token.rb', line 19 def to_i; @value.to_i; end |
#to_s ⇒ Object
18 |
# File 'lib/graphql/language/token.rb', line 18 def to_s; @value; end |