Methods
Included Modules
Public Class methods
[ show source ]
# File lib/facets/more/stateparser.rb, line 130 def token( name, &block ) class_eval &block raise unless instance_methods.include?( MATCH ) alias_method( "#{name}_#{MATCH}", :match ) remove_method( MATCH ) unit = !instance_methods.include?('end_match') tokenIsUnit?[name.to_sym] = unit unless unit alias_method( "#{name}_#{ENDMATCH}", ENDMATCH ) remove_method( ENDMATCH ) end if instance_methods.include?('callback') alias_method( "#{name}_#{CALLBACK}", CALLBACK ) remove_method( CALLBACK ) end if instance_methods.include?('end_callback') alias_method( "#{name}_#{ENDCALLBACK}", ENDCALLBACK ) remove_method( ENDCALLBACK ) end warn "WARNING! redefining token" if tokens.include?( name ) tokens << name #Token.new( name, start_name, end_name ) end
[ show source ]
# File lib/facets/more/stateparser.rb, line 128 def tokenIsUnit? ; @tokenIsUnit ||= {} ; end
[ show source ]
# File lib/facets/more/stateparser.rb, line 127 def tokens ; @tokens ||= [] ; end
Public Instance methods
[ show source ]
# File lib/facets/more/stateparser.rb, line 168 def finish( state ); end
These you can fill out to do things on parser events.
[ show source ]
# File lib/facets/more/stateparser.rb, line 167 def flush( text, state ); end
[ show source ]
# File lib/facets/more/stateparser.rb, line 164 def tokenIsUnit? ; self.class.tokenIsUnit? ; end
token information
[ show source ]
# File lib/facets/more/stateparser.rb, line 163 def tokens ; self.class.tokens ; end