Class: Treetop::Runtime::TerminalParseFailure

Inherits:
Object
  • Object
show all
Defined in:
lib/treetop/runtime/terminal_parse_failure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, expected_string, unexpected = false) ⇒ TerminalParseFailure

Returns a new instance of TerminalParseFailure.



6
7
8
9
10
# File 'lib/treetop/runtime/terminal_parse_failure.rb', line 6

def initialize(index, expected_string, unexpected = false)
  @index = index
  @expected_string = expected_string
  @unexpected = unexpected
end

Instance Attribute Details

#expected_stringObject (readonly)

Returns the value of attribute expected_string.



4
5
6
# File 'lib/treetop/runtime/terminal_parse_failure.rb', line 4

def expected_string
  @expected_string
end

#indexObject (readonly)

Returns the value of attribute index.



4
5
6
# File 'lib/treetop/runtime/terminal_parse_failure.rb', line 4

def index
  @index
end

#unexpectedObject (readonly)

Returns the value of attribute unexpected.



4
5
6
# File 'lib/treetop/runtime/terminal_parse_failure.rb', line 4

def unexpected
  @unexpected
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/treetop/runtime/terminal_parse_failure.rb', line 12

def to_s
  "String matching #{expected_string} #{@unexpected ? 'not ' : ''}expected."
end