Class: Ibex::Frontend::DiagnosticRecovery

Inherits:
Object
  • Object
show all
Defined in:
lib/ibex/frontend/diagnostic_recovery.rb

Overview

Re-runs the generated parser after suppressing only conservative source regions.

Constant Summary collapse

DECLARATION_STARTS =
%w[
  pragma include import token prechigh preclow options expect expect_rr start recover on_error_reduce test lexer
  convert display type param printer
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(tokens, mode:, max_diagnostics:) ⇒ DiagnosticRecovery

Returns a new instance of DiagnosticRecovery.



18
19
20
21
22
23
24
# File 'lib/ibex/frontend/diagnostic_recovery.rb', line 18

def initialize(tokens, mode:, max_diagnostics:)
  @tokens = tokens
  @mode = mode
  @max_diagnostics = max_diagnostics
  @diagnostics = [] #: Array[Diagnostic]
  @suppressed = {} #: Hash[Integer, bool]
end

Instance Method Details

#parseObject



27
28
29
30
# File 'lib/ibex/frontend/diagnostic_recovery.rb', line 27

def parse
  ast = parse_until_stable
  [ast, sorted_diagnostics]
end