Exception: Cucumber::TreetopParser::Feature::SyntaxError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/gems/cucumber-0.1.15/lib/cucumber/treetop_parser/feature_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, parser) ⇒ SyntaxError

Returns a new instance of SyntaxError.



5
6
7
8
9
10
11
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/treetop_parser/feature_parser.rb', line 5

def initialize(file, parser)
  tf = parser.terminal_failures
  expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string.inspect}.uniq*', '}"
  after = parser.input[parser.index...parser.failure_index]
  found = parser.input[parser.failure_index..parser.failure_index]
  @message = "#{file}:#{parser.failure_line}:#{parser.failure_column}: Parse error, expected #{expected}. After #{after.inspect}. Found: #{found.inspect}"
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/treetop_parser/feature_parser.rb', line 13

def message
  @message
end