Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Make javascript parser parse BOM #100

Open
aslakhellesoy opened this issue Apr 20, 2011 · 3 comments
Open

Make javascript parser parse BOM #100

aslakhellesoy opened this issue Apr 20, 2011 · 3 comments

Comments

@aslakhellesoy
Copy link
Contributor

Only one spec is failing with the js parser, and it's commented out here:

https://github.com/aslakhellesoy/gherkin/blob/master/spec/gherkin/js_lexer_spec.rb#L19

This means many files saved with a Windows editor will not parse, and this needs to be fixed. I haven't looked into the cause of the problem.

@jbpros
Copy link
Contributor

jbpros commented Nov 30, 2013

This is biting some people using Cucumber.js: cucumber/cucumber-js#144

@simondean
Copy link

Hi. The issue happens when a feature file starts with an "invisible" UTF-8 BOM (http://en.wikipedia.org/wiki/Byte_order_mark). As a BOM cannot be seen in most text editors, it makes it very difficult to diagnose. Basically only people who know what a BOM is will be able to fix the issue. I saw this issue when upgrading cucumber-js to 0.4.x. All of a sudden, a number of feature files that were previously passing, suddenly started to throw the cryptic error below.

Here's the error the issue causes:

...\node_modules\gherkin\lib\gherkin\lexer\en.js:1008
      throw new Error("Lexing error on line " + this.line_number + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
^
Error: Lexing error on line 1: 'Feature: Example feature'. See
http://wiki.github.com/cucumber/gherkin/lexingerror for more information.
    at Lexer.scan
(...\node_modules\gherkin\lib\gherkin\lexer\en.js:1008:13)
    at Object.parse
(...\node_modules\cucumber\lib\cucumber\parser.js:26:25)
    at Object.getFeatures
(...\node_modules\cucumber\lib\cucumber\runtime.js:24:35)
    at Object.start
(...\node_modules\cucumber\lib\cucumber\runtime.js:10:37)
    at Object.self._task

@brasmusson
Copy link
Contributor

A propsed fix is in PR #301.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants