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

Is the current version consistent with the intro example ? #39

Open
tizuck opened this issue Nov 11, 2018 · 1 comment
Open

Is the current version consistent with the intro example ? #39

tizuck opened this issue Nov 11, 2018 · 1 comment

Comments

@tizuck
Copy link

tizuck commented Nov 11, 2018

Hi,

I am new to parseback and this could be completly me running against a wall, but I am having trouble getting your example of the arithmetic expression grammar to work. This line here,

val result: Eval[Either[List[ParseError], List[Int]]] = expr(input)

gives me the following Error message:

Error:(28, 63) type mismatch;
found : cats.Eval[List[parseback.ParseError] / parseback.util.Catenable[Int]]
(which expands to) cats.Eval[scala.util.Either[List[parseback.ParseError],parseback.util.Catenable[Int]]]
required: cats.Eval[Either[List[parseback.ParseError],List[Int]]]
val result: Eval[Either[List[ParseError], List[Int]]] = expr(input)

However, the example executes when omitting the explicit type declaration of variable result. But it will fail to parse and throw the following error message:

Left(List(UnexpectedCharacter(Line(1 + 2,0,0),Set(\s+))))

Moreover when inserting a whitespace before the 1 in the LineStream like this " 1 + 2" the example parses correctly. Am i doing anything wrong?

And also, is there a forum for questions like this? I wasn't able to find any, so i posted it here. Please let me know.

Cheers

Besides, here is my SBT File :

version := "0.1"
scalaVersion := "2.12.7"
resolvers += "bintray-djspiewak-maven" at "https://dl.bintray.com/djspiewak/maven"
val ParsebackVersion = "0.3"
libraryDependencies += "com.codecommit" %% "parseback-core" % ParsebackVersion
libraryDependencies += "com.codecommit" %% "parseback-cats" % ParsebackVersion

@tizuck
Copy link
Author

tizuck commented Nov 12, 2018

After observing your own test-cases in the parseback-test folder I figured, that the Whitespace is implemented in a different way. There, it is defined as

implicit val W = Whitespace(() | """\s+""".r)

which indeed does work an makes more sense. Please consider to adjust this in the intro-example.

Cheers

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