Skip to content

Commit

Permalink
Fixes for issues (#13, #14)
Browse files Browse the repository at this point in the history
Fixed compatibility with latest lark.

Bugfix for UnexpectedToken.expected
  • Loading branch information
erezsh committed Mar 3, 2022
1 parent 427669e commit 8844274
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion larkjs/lark.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ function intersection(setA, setB) {
return _intersection;
}

function set_subtract(a, b) {
return [...a].filter(e => !b.has(e))
}

function dict(d) {
return { ...d };
}
Expand Down Expand Up @@ -1956,7 +1960,7 @@ class BasicLexer extends Lexer {
while (line_ctr.char_pos < lex_state.text.length) {
res = this.match(lex_state.text, line_ctr.char_pos);
if (!res) {
allowed = this.scanner.allowed_types - this.ignore_types;
allowed = set_subtract(this.scanner.allowed_types, this.ignore_types);
if (!allowed) {
allowed = new Set(["<END-OF-FILE>"]);
}
Expand Down Expand Up @@ -3460,6 +3464,7 @@ class LarkOptions extends Serialize {
use_bytes: false,
import_paths: [],
source_path: null,
_plugins: null,
};
constructor(options_dict) {
super();
Expand Down

0 comments on commit 8844274

Please sign in to comment.