Skip to content

Commit

Permalink
- migrate the parser and lexer specs to ES6
Browse files Browse the repository at this point in the history
- use the pre-patched jison from the previous commit to build these as using an older jison won't fly. Hence you MUST copy the dist/ directory to node_modules/jison-gho/dist/ before running `make` or your ass is graas.
- patch the code generator(s) to check if action code chunks include `let` or `const` keywords and if they do, wrap them in a {...} scope block to prevent collisions with other action code blocks in the same generated large switch/case statement.
- drop ES5 usage in the build paths everywhere. This means we're not testing the validity of the BABEL output anymore. ES5 is on the way out.
- **WARNING/NOTICE**: this dist/ is KNOWN-GOOD-ENOUGH for bootstrapping jison. Bootstrapping jison with ANY EARLIER BUILD WILL FAIL due to the ES6 features used in the action code blocks and the way the older versions generated lexer/parser code, which will result in load-time fatal collisions reported by `node` as multiple `let` statements will compete for supremacy.
- issue 51 examples have been tweaked to compile and run a basic test run -- at least sample 1 does, while the others still fail, even when marked GOOD: to make those work we'll need the bnf.y grammar overhaul from master and then some extra work.
- while this /dist/ is known-good-enough, arrow-actions in the /examples/ grammars will fail to generate a viable parser due to lingering overzealous {...} brace cleanup code that's been in jison-gho for quite a while: hence #51 is DEFINITELY NOT FIXED YET!
- augmented the bnf.y grammar spec to produce a slightly less horrid and unintelligible error report for arrow-action code blocks which fail to test-compile: you'ld often get error reports about unexpected () braces, which are NOT in your action code line(s) but in the auto-generated wrapper instead -- which is required to test-compile the arrow-action code.
  • Loading branch information
GerHobbelt committed Nov 15, 2020
1 parent 6dba2b9 commit ef64b15
Show file tree
Hide file tree
Showing 130 changed files with 14,695 additions and 11,415 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ MOCHA = node_modules/.bin/mocha
NYC = node_modules/.bin/nyc --clean=false --temp-directory ./.nyc_output

ifndef FULL_CODE_COVERAGE
JISON = node dist/cli-cjs-es5.js
JISON = node dist/cli-cjs.js
else
JISON = $(NYC) --reporter=lcov -- node dist/cli-cjs-es5.js
JISON = $(NYC) --reporter=lcov -- node dist/cli-cjs.js
endif


Expand Down Expand Up @@ -448,7 +448,7 @@ examples/yacc-error-recovery: build
build: \
subpackages-build \
prep_util_dir \
dist/cli-cjs-es5.js \
dist/cli-cjs.js \
packages/ebnf-parser/ebnf.y \
packages/ebnf-parser/bnf.y \
packages/ebnf-parser/bnf.l \
Expand All @@ -464,11 +464,11 @@ npm-update: subpackages-npm-update

prep_util_dir:
#@[ -d node_modules/jison-gho/dist ] || echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler backup utility files are unavailable! ###"
#@[ -f node_modules/jison-gho/dist/cli-cjs-es5.js ] || echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler backup utility files are unavailable! ###"
#@[ -f node_modules/jison-gho/dist/cli-cjs.js ] || echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler backup utility files are unavailable! ###"
-mkdir -p dist
#+[ -f dist/cli-cjs-es5.js ] || ( cp node_modules/jison-gho/dist/cli-cjs-es5.js dist/cli-cjs-es5.js && touch -d 1970/1/1 dist/cli-cjs-es5.js )
#+[ -f dist/cli-cjs.js ] || ( cp node_modules/jison-gho/dist/cli-cjs.js dist/cli-cjs.js && touch -d 1970/1/1 dist/cli-cjs.js )

dist/cli-cjs-es5.js: dist/jison.js rollup.config-cli.js package.json lib/jison-parser-kernel.js
dist/cli-cjs.js: dist/jison.js rollup.config-cli.js package.json lib/jison-parser-kernel.js
node __patch_version_in_js.js
node __patch_parser_kernel_in_js.js
-mkdir -p dist
Expand Down
1,887 changes: 1,037 additions & 850 deletions dist/cli-cjs-es5.js

Large diffs are not rendered by default.

Loading

0 comments on commit ef64b15

Please sign in to comment.