Skip to content

Rule arguments are wrapped in tuples #77

Description

@jshprentz

When a rule has multiple arguments and passes those arguments to another rule, all but the last argument are wrapped in single-valued tuples. This is a concern because the tuples are unexpected and the multiple arguments are not handled consistently.

Code example:

from parsley import makeGrammar

GRAMMAR = """
    a :x :y :z = b(x, y, z) -> print("a: x={} y={} z={}".format(x, y, z))
    b :x :y :z = c(x, y, z) -> print("b: x={} y={} z={}".format(x, y, z))
    c :x :y :z =            -> print("c: x={} y={} z={}".format(x, y, z))
"""

ParserClass = makeGrammar(GRAMMAR, {})
parser = ParserClass('')
parser.a(1, 2, 3)

Output from Python 3.5.3:

c: x=((1,),) y=((2,),) z=3
b: x=(1,) y=(2,) z=3
a: x=1 y=2 z=3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions