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

in keyword is recognized within an identifier #1

Open
jmitchell opened this issue Mar 1, 2019 · 2 comments
Open

in keyword is recognized within an identifier #1

jmitchell opened this issue Mar 1, 2019 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jmitchell
Copy link
Owner

The ignored ./dhall-haskell/dhall-json/examples/travis.dhall parse test fails, in part, because the in in OperatingSystem is parsed as the in keyword of a let expression.

image

When I replace constructors OperatingSystem with OperatingSystem.OSX it fails in the same way (constructors is now deprecated). Using System.OSX, however, allows the subsequent in to parse as expected.

Potential explanations

  1. grammar.js needs to be adjusted using tree-sitter features, like precedence, associativity, token, extras, conflicts, word, and external scanners.
  2. dhall.abnf isn't explicit enough about non-empty whitespace needed around in and possibly other keywords.
  3. dhall.abnf is sufficiently explicit. but abnf-to-tree-sitter didn't translate it correctly to generated_grammar.js, which was the basis for grammar.js.
  4. Edge-case/bug in tree-sitter.
@jmitchell jmitchell added bug Something isn't working help wanted Extra attention is needed labels Mar 1, 2019
jmitchell added a commit that referenced this issue Mar 2, 2019
Resolving them may help with issue #1.
@Nadrieril
Copy link

Nadrieril commented Jul 7, 2021

dhall.abnf is indeed not explicit enough: there are some comments in it that explain that simple-label should be tweaked to exclude keywords. I use negative lookahead, but I'd expect a non-PEG parser to handle this at the tokenizer level

@jeff-hykin
Copy link

It looks like the bnf file has been updated. Would it be possible to rerun the converter and see if it fixes this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants