-
Notifications
You must be signed in to change notification settings - Fork 66
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
peggy使用import引入编译后的peggy文件时的报错 (Error when peggy uses import to introduce compiled peggy files) #548
Comments
但是如果使用括号并添加任意内容后就不会报错了 name:(__ ident_part)* {return name.join("")} |
We'll need someone's help translating to English if we're going to be able to help you for real. In the meantime, you might try reading this: https://en.wikipedia.org/wiki/Left_recursion#Removing_direct_left_recursion |
Google Translate says:
|
which will combine the grammars together at generation time. |
peggy select.peggy .. /.. /common/common.js If there are repeated rule definitions, the tree shake operation is not performed. This makes the packaged file larger. |
I self-test, even if the import does not report errors, he generated content is about only a large peggy file size. Can you use parse.parse to generate grammer first? Then create a rollup-like configuration file. Generate CPU based on file import |
import { select,ident_part,from,__,_ } from '../../common/common.js';
// select.peggy:
selectStatement
= select _ colunm_clause:colunm_clause _ from _ table_name:table_name __ ';'{ return
column_name=${colunm_clause}, table_name=${table_name}
}colunm_clause
= column_name
/ '*'
column_name
= name:ident_part* {return name.join("")}
这段代码,当引入的ident_part后有其他属性时就会报错。如果 name:ident_part {return name.join("")}就不会报错。
错误内容: Possible infinite loop when parsing (repetition used with an expression that may not consume any input);
// common.peggy
ident_part
= [A-Za-z0-9]
select
= 'select'i
from
= 'from'i
__ = whitespace*
_ = whitespace+
whitespace
= [ \t\r\n];
The text was updated successfully, but these errors were encountered: