Skip to content

Commit

Permalink
Make the grammar check more robust
Browse files Browse the repository at this point in the history
In particular, fail immediately if the server returns with an error, and yield
a readable error if no grammar snippets are found in the specification.
  • Loading branch information
Ms2ger committed Mar 18, 2019
1 parent 6dcfbec commit a3bd3b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions check-grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ let path = process.argv[2];
let html = fs.readFileSync(path, "utf8");
let dom = new jsdom.JSDOM(html);
let rules = getRulesFromDOM(dom.window);
if (!rules.length) {
console.log("Did not find any grammar snippets in the generated specification.");
process.exit(1);
}
let bnf = toBNF(rules);
let data = Grammar.dataFromString(bnf, "bnf");
let grammar = Grammar.fromData(data, { mode: "LL1" });
Expand Down
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"

function doCompile {
curl https://api.csswg.org/bikeshed/ -F [email protected] > out/index.html
curl https://api.csswg.org/bikeshed/ -f -F [email protected] > out/index.html
node ./check-grammar.js ./out/index.html
npm run pp-webidl -- --input ./out/index.html
}
Expand Down

0 comments on commit a3bd3b5

Please sign in to comment.