Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Issue with whitespaces #540

Closed
ls-cnr opened this issue Feb 25, 2024 · 0 comments
Closed

Issue with whitespaces #540

ls-cnr opened this issue Feb 25, 2024 · 0 comments

Comments

@ls-cnr
Copy link

ls-cnr commented Feb 25, 2024

I am writing the parser for first-order conditions. I am using Scala and the scala-parser-combinators library. It works well, but I discovered this issue.

Here, I report the clause for negation (example: not predicate(p1)). It uses recursion, calling fol_condition, i.e. the root level rule for fol conditions:

  def fol_condition: Parser[FOLNature] = fol_negation | fol_predicate | ...

  def fol_negation : Parser[Negation] = "not"~fol_condition ^^ {case _~sub => Negation(sub)}
  def fol_predicate : Parser[Predicate] = ident~"("~repsep(logic_term,",")~")"^^ {case id~_~args~_ => Predicate(id,args)}
....

So, a string like "not predicate(p1)" produces the correct result Negation(Predicate("predicate",...)) However, when I parse a string like "note(p2)", it should produce a Predicate("note",...); instead, it returns Negation(Predicate(a,...)). In other words, the parser ignores whether there is a space between "not" and the following fol_condition.

This is not the desired behaviour. I would inform the parser that "not a" is different from "nota" because there is a space in between.

@scala scala locked and limited conversation to collaborators Mar 28, 2024
@SethTisue SethTisue converted this issue into discussion #547 Mar 28, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant