Class: Lrama::Grammar::ErrorToken
- Inherits:
-
Object
- Object
- Lrama::Grammar::ErrorToken
- Defined in:
- lib/lrama/grammar/error_token.rb
Instance Attribute Summary collapse
-
#ident_or_tags ⇒ Object
readonly
: Array[Lexer::Token::Ident | Lexer::Token::Tag].
-
#lineno ⇒ Object
readonly
: Integer.
-
#token_code ⇒ Object
readonly
: Lexer::Token::UserCode.
Instance Method Summary collapse
-
#initialize(ident_or_tags:, token_code:, lineno:) ⇒ ErrorToken
constructor
A new instance of ErrorToken.
- #translated_code(tag) ⇒ Object
Constructor Details
#initialize(ident_or_tags:, token_code:, lineno:) ⇒ ErrorToken
Returns a new instance of ErrorToken.
12 13 14 15 16 |
# File 'lib/lrama/grammar/error_token.rb', line 12 def initialize(ident_or_tags:, token_code:, lineno:) @ident_or_tags = @token_code = token_code @lineno = lineno end |
Instance Attribute Details
#ident_or_tags ⇒ Object (readonly)
: Array[Lexer::Token::Ident | Lexer::Token::Tag]
7 8 9 |
# File 'lib/lrama/grammar/error_token.rb', line 7 def @ident_or_tags end |
#lineno ⇒ Object (readonly)
: Integer
9 10 11 |
# File 'lib/lrama/grammar/error_token.rb', line 9 def lineno @lineno end |
#token_code ⇒ Object (readonly)
: Lexer::Token::UserCode
8 9 10 |
# File 'lib/lrama/grammar/error_token.rb', line 8 def token_code @token_code end |
Instance Method Details
#translated_code(tag) ⇒ Object
19 20 21 |
# File 'lib/lrama/grammar/error_token.rb', line 19 def translated_code(tag) Code::PrinterCode.new(type: :error_token, token_code: token_code, tag: tag).translated_code end |