-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check grammar is LL(1) as part of Travis builds #458
Conversation
377aead
to
bdf8d8e
Compare
Now that @DmitrySoshnikov merged DmitrySoshnikov/syntax#49, this runs properly in Travis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS style nits (feel free to ignore them) and a somewhat substantial deploy script issue, but LGTM otherwise. Thanks for cleaning up my mistakes with the extended attributes business. LL(1) seems like a pain.
@@ -0,0 +1,48 @@ | |||
const Grammar = require("syntax-cli").Grammar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "use strict";
check-grammar.js
Outdated
function processRules(rules) { | ||
const REGEXP = /(\s*:\n\s*)|\b(integer|float|identifier|string|whitespace|comment|other)\b|(\s*\n\s*)|(ε)/g; | ||
return rules.map(rule => { | ||
return rule.trim().replace(REGEXP, m => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: two spaces after return
seems silly.
check-grammar.js
Outdated
} | ||
|
||
let path = process.argv[2]; | ||
let html = require("fs").readFileSync(path, "utf8"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: seems nicer to put all require()
s at the top
deploy.sh
Outdated
@@ -13,7 +13,8 @@ if [[ "$TRAVIS_PULL_REQUEST" != "false" || "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" | |||
echo "Skipping deploy; just doing a build." | |||
mkdir out | |||
doCompile | |||
exit 0 | |||
node ./check-grammar.js ./out/index.html | |||
exit $? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only check on pull requests?
I'd just put this inside doCompile
. No need for exit $?
then since we have done set -e
above.
Best resource I found to truly understand how a LL(1) parser is supposed to work: https://courses.cs.washington.edu/courses/cse401/04sp/slides/03b-LL1-example.pdf. |
Fix existing conflicts.
Blocks on Remove reference to Closure, expose State instead DmitrySoshnikov/syntax#49.Preview | Diff