Module: ANTLR3::Profile::ParserEvents

Includes:
Debug::ParserEvents
Defined in:
lib/antlr3/profile.rb

Overview

ANTLR3::Profile::ParserEvents expands basic debugging events for use by recognition code generated by ANTLR when called with the -profile switch.

Instance Attribute Summary

Attributes included from Debug::ParserEvents

#debug_listener

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Debug::ParserEvents

#backtrack, #begin_backtrack, #begin_resync, #cyclic_decision=, #cyclic_decision?, #end_backtrack, #end_resync, #in_alternative, #in_decision, #in_rule, #in_subrule, #missing_symbol, #predicate?, #report_error, #resync, #rule_invocation_stack, #rule_level

Methods included from Error

EarlyExit, FailedPredicate, MismatchedNotSet, MismatchedRange, MismatchedSet, MismatchedToken, MismatchedTreeNode, MissingToken, NoViableAlternative, RewriteCardinalityError, RewriteEarlyExit, RewriteEmptyStream, UnwantedToken

Class Method Details

.included(klass) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/antlr3/profile.rb', line 47

def self.included( klass )
  super
  if klass.is_a?( ::Class )
    def klass.profile?
      true
    end
  end
end

Instance Method Details

#already_parsed_rule?(rule) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
# File 'lib/antlr3/profile.rb', line 61

def already_parsed_rule?( rule )
  @debug_listener.examine_rule_memoization( rule )
  super
end

#initialize(stream, options = {}) ⇒ Object



56
57
58
59
# File 'lib/antlr3/profile.rb', line 56

def initialize( stream, options = {} )
  options[ :debug_listener ] ||= Profiler.new( self )
  super( stream, options )
end

#memoize(rule, start_index, success) ⇒ Object



70
71
72
73
# File 'lib/antlr3/profile.rb', line 70

def memoize( rule, start_index, success )
  @debug_listener.memoize( rule, start_index, success )
  super
end

#profileObject



66
67
68
# File 'lib/antlr3/profile.rb', line 66

def profile
  @debug_listener.profile
end