Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

"and" in conditional expressions confused with tuple syntax. #8

Open
avian2 opened this issue Mar 25, 2017 · 0 comments
Open

"and" in conditional expressions confused with tuple syntax. #8

avian2 opened this issue Mar 25, 2017 · 0 comments

Comments

@avian2
Copy link

avian2 commented Mar 25, 2017

Conjuctions don't work well because the parser confuses the word and with the syntax for tuples.

For instance, this works with or:

Applejack has more than one or Pinkie Pie has more than one

[1.60] parsed: Alternative(
  List(
    Relational(
      VariableValue(applejack),>,NumberValue(1)
    ), 
    Relational(
      VariableValue(pinkie pie),>,NumberValue(1)
    )
  )
)

However, replacing or with and:

Applejack has more than one and Pinkie Pie has more than one

[1.47] failure: ‘Has’ ain't no pony I've heard of. Do they have tea parties with ‘Has’?

The source of the problem is that the parser attempts to make a tuple from one and Pinkie Pie has ..., which in turn attempts to make an identifier from Pinkie Pie has .... This then fails here because has is a keyword.

I think ^? combinator is not the right approach here. The check for keywords should make the parser backtrack instead of failing.

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

No branches or pull requests

1 participant