class Peggy::Reference

Match another production in the grammar.

Attributes

name[R]

The name of the production to lookup and match.

Public Class Methods

new(name=nil) click to toggle source

Init the name

# File lib/parse/builder.rb, line 232
def initialize name=nil
  self.name = name
end

Public Instance Methods

match(parser, index) click to toggle source

Match the entire production from the parser grammar. If it matches the end index is returned. If not, NO_MATCH is returned.

# File lib/parse/builder.rb, line 243
def match parser, index
  raise "reference name not set" unless name
  parser.match? name, index
end
name=(value) click to toggle source

Set the name of production to match.

# File lib/parse/builder.rb, line 237
def name= value
  @name = value.to_sym
end
to_s() click to toggle source

Convert element to String.

# File lib/parse/builder.rb, line 249
def to_s
  @name
end