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

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

@avian2

Description

@avian2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions