8000 Possible inconsistent multiplicity of attributes · Issue #357 · textX/textX · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Possible inconsistent multiplicity of attributes #357

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

Open
goto40 opened this issue Nov 26, 2021 · 2 comments
Open

Possible inconsistent multiplicity of attributes #357

goto40 opened this issue Nov 26, 2021 · 2 comments
Labels

Comments

@goto40
Copy link
Member
goto40 commented Nov 26, 2021

While playing with the code I found an effect concerning the multiplicity of attributes in case of multiple assignment to the same attribute (http://textx.github.io/textX/stable/grammar/#multiple-assignment-to-the-same-attribute) in one sequence or in more complicated parse tree constellations (see "OK"/"FAILED" below).

def test_attribute_multiplicity():
    """
    Test http://textx.github.io/textX/stable/grammar/#multiple-assignment-to-the-same-attribute
    """
    grammar = """
    Rule1: a='a' a='c';
    Rule2: (a='a'|a='b') a='c';
    """
    meta = metamodel_from_str(grammar)
    assert meta['Rule1']._tx_attrs['a'].mult == '1..*'            // OK
    assert meta['Rule2']._tx_attrs['a'].mult == '1..*'            // FAIL (result="1")

Is it worth to make further investigations? Or is this a border case and we can adapt the doc? Or did I misunderstood something?

@goto40
Copy link
Member Author
goto40 commented Nov 26, 2021

Note: there is a branch https://github.com/textX/textX/tree/analysis/multiplicity to play with the effect.

@igordejanovic
Copy link
Member

Good catch. It looks like a bug to me. The case is very specific but I guess it is worth further investigation. We should see if and how it can affect parsing. The interplay of OrderedChoice and Sequences together with multiple assignment can be tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0