Class: Ibex::Runtime::CST::LexedSyntax
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::LexedSyntax
- Defined in:
- lib/json5/generated_parser.rb
Overview
One complete generated-lexer pass, including the explicit EOF token.
Instance Attribute Summary collapse
- #memo ⇒ Object readonly
- #raw_tokens ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(raw_tokens:, memo:) ⇒ LexedSyntax
constructor
A new instance of LexedSyntax.
- #with_memo(replacement) ⇒ Object
Constructor Details
#initialize(raw_tokens:, memo:) ⇒ LexedSyntax
Returns a new instance of LexedSyntax.
3027 3028 3029 3030 3031 3032 3033 |
# File 'lib/json5/generated_parser.rb', line 3027 def initialize(raw_tokens:, memo:) raise ArgumentError, "raw and Green token counts differ" unless raw_tokens.length == memo.tokens.length @raw_tokens = raw_tokens.map { |token| token.dup.freeze }.freeze @memo = memo freeze end |
Instance Attribute Details
#memo ⇒ Object (readonly)
3024 3025 3026 |
# File 'lib/json5/generated_parser.rb', line 3024 def memo @memo end |
#raw_tokens ⇒ Object (readonly)
3023 3024 3025 |
# File 'lib/json5/generated_parser.rb', line 3023 def raw_tokens @raw_tokens end |
Instance Method Details
#with_memo(replacement) ⇒ Object
3036 3037 3038 |
# File 'lib/json5/generated_parser.rb', line 3036 def with_memo(replacement) LexedSyntax.new(raw_tokens: @raw_tokens, memo: replacement) end |