Sha256: 9db58ba68d61fb309fc467ae6b71348ea8166cbe0fa05368baaebf590e6ac304
Contents?: true
Size: 1.11 KB
Versions: 15
Compression:
Stored size: 1.11 KB
Contents
module Cucumber module TreetopParser module Feature class SyntaxError < StandardError 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 def message @message end end class << self attr_accessor :last_scenario end def parse_feature(file) gherkin = IO.read(file) gherkin = gherkin.force_encoding('utf-8') if Cucumber::RUBY_1_9 ast = parse(gherkin) if ast.nil? raise SyntaxError.new(file, self) else feature = ast.compile feature.file = file feature end end end end end
Version data entries
15 entries across 15 versions & 4 rubygems