Skip to content

Commit

Permalink
expose parser instance from syntax extensions #308
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Mar 25, 2024
1 parent 0db3abb commit cdfd8c8
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* allow to use unquoted symbols in `-->` to get the function
* add `regex` procedure (rename from `%r` used in bootstrap.scm)
* support unterminated strings in REPL [#280](https://github.com/jcubic/lips/issues/280)
* expose parser and lexer instance from syntax extensions [#308](https://github.com/jcubic/lips/issues/308)
### Bugfix
* fix `let-values` to allow binding to list [#281](https://github.com/jcubic/lips/issues/281)
* fix wrong strings in `string-fill!`
Expand Down
15 changes: 10 additions & 5 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -1437,14 +1437,17 @@ function match_or_null(re, char) {
class Parser {
constructor({ env, meta = false, formatter = multiline_formatter } = {}) {
read_only(this, '_formatter', formatter, { hidden: true });
read_only(this, '__env__', env);
read_only(this, '__env__', env ?? env.inerit('parser'));

Check failure on line 1440 in src/lips.js

View workflow job for this annotation

GitHub Actions / Check for spelling errors

inerit ==> inherit
read_only(this, '_meta', meta, { hidden: true });
// datum labels
read_only(this, '_refs', [], { hidden: true });
read_only(this, '_state', {
parentheses: 0,
fold_case: false
}, { hidden: true });
if (this.__env__) {
this.__env__.set('lips', { ...lips, __parser__: this });
}
}
parse(arg) {
if (arg instanceof LString) {
Expand Down

0 comments on commit cdfd8c8

Please sign in to comment.