Class: Ibex::Runtime::CST::LexedSyntax
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::LexedSyntax
- Defined in:
- lib/ibex/runtime/cst/incremental/lexed_syntax.rb
Overview
One complete generated-lexer pass, including the explicit EOF token.
Instance Attribute Summary collapse
-
#memo ⇒ Object
readonly
: TokenMemo.
-
#raw_tokens ⇒ Object
readonly
: Array[Array[untyped]].
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.
13 14 15 16 17 18 19 |
# File 'lib/ibex/runtime/cst/incremental/lexed_syntax.rb', line 13 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)
: TokenMemo
10 11 12 |
# File 'lib/ibex/runtime/cst/incremental/lexed_syntax.rb', line 10 def memo @memo end |
#raw_tokens ⇒ Object (readonly)
: Array[Array[untyped]]
9 10 11 |
# File 'lib/ibex/runtime/cst/incremental/lexed_syntax.rb', line 9 def raw_tokens @raw_tokens end |
Instance Method Details
#with_memo(replacement) ⇒ Object
22 23 24 |
# File 'lib/ibex/runtime/cst/incremental/lexed_syntax.rb', line 22 def with_memo(replacement) LexedSyntax.new(raw_tokens: @raw_tokens, memo: replacement) end |