Sha256: 998621cac9acaa4d6f445b62ee676b28c4ba5b23cb077dc3244b6b9633ec17e2

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module Lrama
  class TraceReporter
    def initialize(grammar)
      @grammar = grammar
    end

    def report(**options)
      _report(**options)
    end

    private

    def _report(rules: false, actions: false, **_)
      report_rules if rules
      report_actions if actions
    end

    def report_rules
      puts "Grammar rules:"
      @grammar.rules.each { |rule| puts rule.display_name }
    end

    def report_actions
      puts "Grammar rules with actions:"
      @grammar.rules.each { |rule| puts rule.with_actions }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lrama-0.6.11 lib/lrama/trace_reporter.rb
lrama-0.6.10 lib/lrama/trace_reporter.rb