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

    @JirkaVebr , you can build the artifact locall for the commit: sirthias/parboiled2#185 . could you?

    please, let me know if it fits your needs, or why not otherwise

    when we clarify some points with Mathias, the PR would be in new release

    Jirka Vebr
    @JirkaVebr
    @alexander-myltsev Thank you very much! I've just built it from your fork and it addresses my use case perfectly!
    Would you like my help with the tests? Also, may I suggest also updating the valueMap signature in README.rst as well as perhaps mention there, that the same but unforced restrictions apply as with ignoreCase, that is that the map keys must be lower-case?
    Once again, thank you! 🙂
    Alexander Myltsev
    @alexander-myltsev
    @JirkaVebr , thank you. everything is ready at sirthias/parboiled2#185, and waiting for merge
    Paige Park
    @paigevpark
    Can anyone help me figure out why one of my rules isn't working?
    Alexander Myltsev
    @alexander-myltsev
    paste it here
    Paige Park
    @paigevpark

    This is the block giving me an error

    def Expressions = rule { Expression | ((Expression ~ "&&" ~ Expressions) ~> (&&(_,_))) }
    def Expression = rule { capture(ExpressionString) ~> (TargetingExpression) }
    def ExpressionString = rule { oneOrMore(CharPredicate.AlphaNum) }

    Here is the trait for my AST

    ```
    sealed trait TargetingASTNode {//def value()}
    sealed trait BooleanASTNode extends TargetingASTNode {//override def value()}
    sealed trait ExpressionASTNode extends TargetingASTNode {//override def value()}
    case class &&(left: TargetingASTNode, right: TargetingASTNode) extends BooleanASTNode
    case class TargetingExpression(value: String) extends ExpressionASTNode
    About to paste the rest of the rules too
    If you need them
    but the Expressions rule is giving me the issue
    I want to keep replacing the top of the Value stack with connected && nodes, until we reach a right parens
    Paige Park
    @paigevpark

    I imagine I'll run into the same issue when I refactor the above section as well

    def ExpressionGroup = rule { '(' ~ Expressions ~ ')' }
    def ConnectedExpressionGroup = rule { OR ~ '(' ~ ExpressionGroup ~ ')' }

    Which will follow the same idea

    An example of the language looks as follows
    "if( ( (ExpressionOne1) || (ExpressionTwo1 && ExpressionTwo2 && ExpressionTwo3)) ) else if (...) and if (...)"
    Obviously at a fairly early stage here, so just trying to get basic examples to work
    Alexander Myltsev
    @alexander-myltsev
    most probably the problem is in typing of two _
    try to annotaty them with types explicitly like (&&((_:Expression), (_:Expression)))
    Paige Park
    @paigevpark
    Things to note here is that || always has a closing and opening parens to the left and right, as it's a separator of expression groups
    Well, the second one can be a && as well
    Alexander Myltsev
    @alexander-myltsev
    pasting the error message that you’re facing would be helpful too
    Paige Park
    @paigevpark
    (sorry about the symbolic names)
    Alexander Myltsev
    @alexander-myltsev

    Well, the second one can be a && as well

    this doesn’t matter. Expression pushes a value on ValueStack of particular type.

    in your case it would be (&&((_: TargetingExpression),(_: TargetingExpression)))
    Paige Park
    @paigevpark
    Ah, I see. I'll try that out. I have a couple more compile errors to fix, so I'll clean this up a bit and comment out some things and get back to you. Thank you for helping out, I'll be back soonish!
    Alexander Myltsev
    @alexander-myltsev

    hi @sirthias

    please, take a look at https://github.com/sirthias/parboiled2/pulls . there are a couple that might worth your attention

    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