Class: Ibex::Runtime::CST::LexedSyntax

Inherits:
Object
  • Object
show all
Defined in:
lib/ibex/runtime/cst/incremental/lexed_syntax.rb,
sig/ibex/runtime/cst/incremental/lexed_syntax.rbs

Overview

One complete generated-lexer pass, including the explicit EOF token.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_tokens:, memo:) ⇒ LexedSyntax

Returns a new instance of LexedSyntax.

RBS:

  • (raw_tokens: Array[Array[untyped]], memo: TokenMemo) -> void

Parameters:

  • raw_tokens: (Array[Array[untyped]])
  • memo: (TokenMemo)


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

#memoTokenMemo (readonly)

Signature:

  • TokenMemo

Returns:



10
11
12
# File 'lib/ibex/runtime/cst/incremental/lexed_syntax.rb', line 10

def memo
  @memo
end

#raw_tokensArray[Array[untyped]] (readonly)

Signature:

  • Array[Array[untyped]]

Returns:

  • (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) ⇒ LexedSyntax

RBS:

  • (TokenMemo replacement) -> LexedSyntax

Parameters:

Returns:



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