Class: Ibex::RaccMigration::Checker
- Inherits:
-
Object
- Object
- Ibex::RaccMigration::Checker
- Defined in:
- lib/ibex/racc_migration/checker.rb
Overview
Checks syntax, normalization, superclass, and runtime-coupling hazards. Semantic action code is treated as opaque data and never executed.
Constant Summary collapse
- RACC_REQUIRE =
: Regexp
%r{(?:require|require_relative)\s*\(?\s*["']racc(?:/parser)?["']}- RACC_CONSTANT =
: Regexp
/\bRacc::[A-Za-z_]\w*/
Instance Method Summary collapse
Instance Method Details
#check(source, file:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ibex/racc_migration/checker.rb', line 13 def check(source, file:) result = Frontend::Parser.new(source, file: file, mode: :default).parse_with_diagnostics findings = result.diagnostics.map { |diagnostic| syntax_finding(diagnostic) } ast = result.ast return Report.new(file: file, class_name: nil, findings: findings) unless ast findings.concat(superclass_findings(ast)) findings.concat(user_code_findings(ast)) findings.concat(normalization_findings(ast)) Report.new(file: file, class_name: ast.class_name, findings: sort_findings(findings)) end |