Class OOParser::Item::Terminal
In: lib/ooparser/items/terminal.rb  (CVS)
Parent: OOParser::Item

The literal item class. Instances of this class are created when the grammar contains literal text, or when the body of a production is a Regexp.

Methods

match   new  

Constants

SVNRev = %q$Rev: 4 $   SVN Revision
SVNId = %q$Id: terminal.rb 4 2005-09-08 07:36:41Z ged $   SVN Id

Attributes

literal  [R]  The literal pattern used when matching against target text

Public Class methods

Create a new terminal item for the given literal, which can be either a String or a Regexp. The skip pattern is used to specify what characters can be skipped in between word boundaries.

[Source]

# File lib/ooparser/items/terminal.rb, line 44
    def initialize( literal )
        if literal.is_a?( Regexp )
            @literal = literal
        else
            @literal = Regexp::new( Regexp::quote(literal) )
        end
    end

Public Instance methods

Match the target in the context of the current parseState.

[Source]

# File lib/ooparser/items/terminal.rb, line 62
    def match( parseState )
        parseState.scanner.scan( @literal )
    end

[Validate]