Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Alexander Myltsev
    @alexander-myltsev

    @xuwei-k can you publish the artifacts to Sonatype?

    if yes, could you do a favor for the parboiled2 project?

    please, try to publish the artifact for the https://github.com/sirthias/parboiled2/pull/190/commits/bae98debd6575f738808fb6c80e652d13250b814 on behalf of your personal “organization”? this one goes fine for me

    then please try to publish https://github.com/sirthias/parboiled2/pull/190/commits/25870b5abf21805849ef480aaba2909e4a2cee92 . this one fails for me with weird gpg subprocess error

    please, fire me a message if you know how to solve the issue

    /cc @sirthias

    David Roon
    @adridadou
    hi guys, is there a way of stopping the parser and return an error from an action ?
    The only way I can think of right now is throwing an exception but I’d love to have a cleaner way of doing this
    and fail will not work in the action part of it
    Alexander Myltsev
    @alexander-myltsev

    @adridadou hi

    do you think the test solves your case?

    https://github.com/sirthias/parboiled2/

    And finally, there is one more very powerful action type: the action function can itself return a rule! If an action returns a rule this rule is immediately executed after the action application just as if it had been concatenated to the underlying rule with the ~ operator. You can therefore do things like

    (foo: Rule1[Int]) ~> (i => test(i % 2 == 0) ~ push(i))
    David Roon
    @adridadou
    that’s very interesting! I’ll have a try and let you know
    João Pedro Sá Medeiros
    @jpsmedeiros
    Hello

    I'm having a problem, is there a way to do something like this:

    def Number = rule { capture(Digits) ~> Value(_.toInt) }

    ?

    Alexander Myltsev
    @alexander-myltsev

    what’s the error? my guess is to manually specify the type of _:

    def Number = rule { capture(Digits) ~> Value((_:String).toInt) }

    João Pedro Sá Medeiros
    @jpsmedeiros
    Sorry, I get the following error: Type mismatch, expected: Rule[NotInferedI, NotInferedO], actual: Any
    I tried your solution get the same error
    João Pedro Sá Medeiros
    @jpsmedeiros

    even

    def Number = rule { capture(Digits) ~> Value(_) }

    returns an error

    Alexander Myltsev
    @alexander-myltsev
    what’s the definition of Value?
    João Pedro Sá Medeiros
    @jpsmedeiros
    Screenshot_8.png
    Screenshot_9.png
    I'm using the Calculator example with some changes
    Alexander Myltsev
    @alexander-myltsev

    well, I don’t know how compiler interprets that construct

    I suggest you to use the lambda:

    def Number = rule { capture(Digits) ~> { x => Value(x.toInt) } }

    João Pedro Sá Medeiros
    @jpsmedeiros
    Thanks!!! That works!
    mvillafuertem
    @mvillafuertem
    [error] gpg: [don't know]: invalid packet (ctb=2d)
    [error] gpg: keydb_search failed: Invalid packet
    [error] gpg: no default secret key: Invalid packet
    [error] gpg: signing failed: Invalid packet
    [error] java.lang.RuntimeException: Failure running gpg --detach-sign. Exit code: 2
    any solution?
    Alexander Myltsev
    @alexander-myltsev
    hi @mvillafuertem
    last time I saw this in a configuration that used sbt 1.x while trying to publish it somewhere
    where did you get that?
    Philipp Dörfler
    @phdoerfler
    [error]   [RR](f: (String, Seq[String]) => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[shapeless.HNil,shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[(String, Seq[String]) => RR])org.parboiled2.Rule[j.In,j.Out] <and>
    [error]   [RR](f: Seq[String] => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[shapeless.HNil,String :: shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[Seq[String] => RR])org.parboiled2.Rule[j.In,j.Out] <and>
    [error]   [RR](f: () => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[shapeless.HNil,String :: Seq[String] :: shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[() => RR])org.parboiled2.Rule[j.In,j.Out]
    [error]  cannot be applied to ((String, Seq[String], Option[io.doerfler.BashAst.Command]) => io.doerfler.BashAst.Command)
    [error]     Program ~ Arguments ~ optional(PipeConnection) ~> ((bin: String, args: Seq[String], pt: Option[Command]) => Command(bin, args, pt))
    [error]                                                    ^
    What do I do in such a case to find out why this is failing?
    All I am getting is a hugemongous wall of text

    Which starts like this:

    [error] /Users/phi/Dropbox/code/Parser/src/main/scala/io/doerfler/Bashturtle.scala:41:52: overloaded method value apply with alternatives:
    [error]   [G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, RR](f: (G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[G :: H :: I :: J :: K :: L :: M :: N :: O :: P :: Q :: R :: S :: T :: U :: V :: W :: X :: Y :: Z :: shapeless.HNil,shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[(G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR])org.parboiled2.Rule[j.In,j.Out] <and>
    [error]   [H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, RR](f: (H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[H :: I :: J :: K :: L :: M :: N :: O :: P :: Q :: R :: S :: T :: U :: V :: W :: X :: Y :: Z :: shapeless.HNil,shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[(H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR])org.parboiled2.Rule[j.In,j.Out] <and>
    [error]   [I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, RR](f: (I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[I :: J :: K :: L :: M :: N :: O :: P :: Q :: R :: S :: T :: U :: V :: W :: X :: Y :: Z :: shapeless.HNil,shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[(I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR])org.parboiled2.Rule[j.In,j.Out] <and>
    [error]   [J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, RR](f: (J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[J :: K :: L :: M :: N :: O :: P :: Q :: R :: S :: T :: U :: V :: W :: X :: Y :: Z :: shapeless.HNil,shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[(J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR])org.parboiled2.Rule[j.In,j.Out] <and>
    [error]   [K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, RR](f: (K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR)(implicit j: org.parboiled2.support.ActionOps.SJoin[K :: L :: M :: N :: O :: P :: Q :: R :: S :: T :: U :: V :: W :: X :: Y :: Z :: shapeless.HNil,shapeless.HNil,RR], implicit c: org.parboiled2.support.FCapture[(K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, String, Seq[String]) => RR])org.parboiled2.Rule[j.In,j.Out] <and>

    and eventually ends in what I posted before

    Philipp Dörfler
    @phdoerfler
    Related question: Can I get rid of that alphabet soup somehow?
    Philipp Dörfler
    @phdoerfler
    ok I solved my problem by doing the old "add type annotations everywhere" dance
    but I really want this huge wall of text to disappear
    makes searching through the compile errors tedious
    Alexander Myltsev
    @alexander-myltsev
    unforturately, not in the current state of parboiled2
    this is how it works
    Philipp Dörfler
    @phdoerfler
    I was afraid the answer would be something like that. Oh well
    At least with the splain plugin some of those errors look a bit more decent
    image.png
    Is there any info on how parboiled2 will be continued in times of scala-meta?
    because goodbye macros
    Alexander Myltsev
    @alexander-myltsev
    I don’t think it would be developed actively. I suppose people choose https://github.com/lihaoyi/fastparse as an alternative
    Philipp Dörfler
    @phdoerfler
    but fastparse is…
    I mean
    no
    just no
    Alexander Myltsev
    @alexander-myltsev
    there are ways to redo parboiled2 preserving same ideas. unfortunately, all of them would consume a lot of time to implement
    Philipp Dörfler
    @phdoerfler
    But I really don't like fastparse
    And parboiled2 is so nice
    Philipp Dörfler
    @phdoerfler
    can't we start a Patreon for parboiled3 or something?
    Alexander Myltsev
    @alexander-myltsev
    there are lots of really nice parsers. for example, have you looked at the Haskell parsers? I see some Haskell compiler ports that should be working on Java
    Philipp Dörfler
    @phdoerfler
    no, haven't seen them. Do you have a link handy?
    Alexander Myltsev
    @alexander-myltsev
    the lang: https://eta-lang.org/
    a parser: http://hackage.haskell.org/package/parsers
    there are lots of them. some should be ported to Eta