Skip to content
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

wrong parameter passing in Lark.parse_interactive #12

Open
supergem3000 opened this issue Feb 19, 2022 · 1 comment
Open

wrong parameter passing in Lark.parse_interactive #12

supergem3000 opened this issue Feb 19, 2022 · 1 comment

Comments

@supergem3000
Copy link

lark.js line 3472

return this.parser.parse_interactive({
    unknown_param_0: text,
    start: start,
});

ParsingFrontend.parse_interactive receives two params: text and start, but it gives an object with unknown_param_0. So the lexer cannot read the correct text.

When I write the code like this:

const parser = get_parser();
let p = parser.parser_interactive(text);
p.exhaust_lexer();

it cannot run correctly. But there is no error in python version of lark if i write the similar code.

Maybe its a programming language translation error. I found three unknown_param_0 in lark.js source code. Hope you can fix it. I'm trying to use lark to finish my course project. Thank you.

ParsingFrontend.parse_interactive接受两个参数: textstart,但是却传给了一个包含unknown_param_0字段的对象。因此lexer无法读取到正确的文本。

上方的代码不能正确运行。但是在Python版本的lark中没有问题。

可能是一个计算机语言翻译出现的问题。我在lark.js的源代码中发现了三处unknown_param_0。希望你们可以修复它。我正在试着用lark完成我的课程项目。谢谢。

@erezsh
Copy link
Member

erezsh commented Feb 19, 2022

Yes, you're right that it's a translation error.

It should look like this:

  parse_interactive(text = null, start = null) {
    return this.parser.parse_interactive(text, start);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants