Class: Ibex::Runtime::CST::RelexResult
- Inherits:
-
Object
- Object
- Ibex::Runtime::CST::RelexResult
- Defined in:
- lib/json5/generated_parser.rb
Overview
Result of comparing one fresh lexical pass with the prior token memo.
Instance Attribute Summary collapse
- #memo ⇒ Object readonly
- #resynchronized_at ⇒ Object readonly
- #reused_count ⇒ Object readonly
- #scanned_count ⇒ Object readonly
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.
2800 2801 2802 2803 2804 2805 2806 |
# File 'lib/json5/generated_parser.rb', line 2800 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)
2793 2794 2795 |
# File 'lib/json5/generated_parser.rb', line 2793 def memo @memo end |
#resynchronized_at ⇒ Object (readonly)
2796 2797 2798 |
# File 'lib/json5/generated_parser.rb', line 2796 def resynchronized_at @resynchronized_at end |
#reused_count ⇒ Object (readonly)
2794 2795 2796 |
# File 'lib/json5/generated_parser.rb', line 2794 def reused_count @reused_count end |
#scanned_count ⇒ Object (readonly)
2795 2796 2797 |
# File 'lib/json5/generated_parser.rb', line 2795 def scanned_count @scanned_count end |
Instance Method Details
#reused_ratio ⇒ Object
2809 2810 2811 2812 2813 |
# File 'lib/json5/generated_parser.rb', line 2809 def reused_ratio return 0.0 if @memo.tokens.empty? @reused_count.fdiv(@memo.tokens.length) end |