Class: Peggy::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/builder.rb

Overview

Base syntax element class.

Direct Known Subclasses

Literal, Multiple, Predicate, Reference, Sequence

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(*args) ⇒ Object

Create an element.



17
18
19
# File 'lib/parse/builder.rb', line 17

def self::build *args
  new *args
end

Instance Method Details

#match(parser, index) ⇒ Object

Test to see if there is a match of this element at the current index. Return’s the index following if match is found, or NO_MATCH if not



23
24
25
# File 'lib/parse/builder.rb', line 23

def match parser, index
  raise "Must override match"
end

#report(index) ⇒ Object

Used for debugging.



28
29
30
31
# File 'lib/parse/builder.rb', line 28

def report index
  # puts "#{to_s} #{index}"
  index
end