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

non-default startRule doesn't work with multiple allowedStartRules #539

Open
hildjj opened this issue Jul 17, 2024 · 1 comment
Open

non-default startRule doesn't work with multiple allowedStartRules #539

hildjj opened this issue Jul 17, 2024 · 1 comment

Comments

@hildjj
Copy link
Contributor

hildjj commented Jul 17, 2024

Example:

foo.peggy:

foo = "1"
bar = "2"
bin/peggy.js -S bar --allowed-start-rules foo,bar f.peggy
const {parse} = require('./f.js')
parse("2") // Error, expected "1"

generate-js.js has this:

const startRuleFunction = name(allowedStartRules[0]);

there should be a new option defaultStartRule that gets hooked up in the CLI correctly and ends up in the AST for later use by generate-js.

@hildjj
Copy link
Contributor Author

hildjj commented Jul 17, 2024

Work-around:

bin/peggy.js --allowed-start-rules bar,foo f.peggy

the docs clearly say that -S is only for testing.

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

1 participant