Class: Ibex::Runtime::CST::RelexResult
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::RelexResult
- Defined in:
- lib/ibex/runtime/cst/incremental/relexer.rb
Overview
Result of comparing one fresh lexical pass with the prior token memo.
Instance Attribute Summary collapse
-
#memo ⇒ Object
readonly
: TokenMemo.
-
#resynchronized_at ⇒ Object
readonly
: Integer?.
-
#reused_count ⇒ Object
readonly
: Integer.
-
#scanned_count ⇒ Object
readonly
: Integer.
Instance Method Summary collapse
-
#initialize(memo:, reused_count:, scanned_count:, resynchronized_at:) ⇒ RelexResult
constructor
A new instance of RelexResult.
- #reused_ratio ⇒ Object
Constructor Details
#initialize(memo:, reused_count:, scanned_count:, resynchronized_at:) ⇒ RelexResult
Returns a new instance of RelexResult.
16 17 18 19 20 21 22 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 16 def initialize(memo:, reused_count:, scanned_count:, resynchronized_at:) @memo = memo @reused_count = reused_count @scanned_count = scanned_count @resynchronized_at = resynchronized_at freeze end |
Instance Attribute Details
#memo ⇒ Object (readonly)
: TokenMemo
9 10 11 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 9 def memo @memo end |
#resynchronized_at ⇒ Object (readonly)
: Integer?
12 13 14 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 12 def resynchronized_at @resynchronized_at end |
#reused_count ⇒ Object (readonly)
: Integer
10 11 12 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 10 def reused_count @reused_count end |
#scanned_count ⇒ Object (readonly)
: Integer
11 12 13 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 11 def scanned_count @scanned_count end |
Instance Method Details
#reused_ratio ⇒ Object
25 26 27 28 29 |
# File 'lib/ibex/runtime/cst/incremental/relexer.rb', line 25 def reused_ratio return 0.0 if @memo.tokens.empty? @reused_count.fdiv(@memo.tokens.length) end |