`eo-parser` incorrectly rejects method chain on identity object `I` as a horizontal argument
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with eo-parser/src/main/java/org/eolang/parser/Tokens.java, especially readArg(), and compare its handling with Value.chainable() in Value.java; consult the parser specification section R-3.16.1. Reproduce the three forms from the issue, then verify that foo I.bar is accepted as a horizontal argument while I 5 remains restricted.
Written by the indexing model from the issue text.
Description
What happens
The identity object is accepted as a horizontal argument, and a method chain on it is accepted when it is the line head, but the combination is rejected:
[] > main
foo I.bar > result
Current master reports:
[2:7] error: 'trailing garbage after expression'
foo I.bar > result
^
The parser accepts both neighbouring forms:
| source | result |
|---|---|
foo I > result |
accepted |
I.bar > result |
accepted |
foo I.bar > result |
rejected at . |
Tokens.readArg() reads a trailing chain only for the kinds listed by Value.chainable(); IDENTITY is not one of them.
Why this is a bug
This is not the horizontal-argument form rejected in #7477. I receives no argument here: it is the receiver of .bar, and the resulting I.bar expression is the sole argument of foo.
The parser specification describes I as a value recognised wherever a value is expected and says it may carry a method chain (R-3.16.1). A method chain on an argument is already supported for literals and identifiers, for example foo 42.as-bytes.
Expected behavior
Accept foo I.bar and emit the method chain as the horizontal argument. The restriction on applying horizontal arguments to I (I 5) can remain unchanged.
How it was verified
Compiled eo-parser from current master in an isolated temporary output directory and parsed all three forms in the table above. Only the chained-argument form produced a parser error.
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 251
- Avg merge
- 22h 52m
- Merged PRs (30d)
- 653
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from objectionary/eo
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#8869 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo#8853 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo#8852 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/eo#8851 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
objectionary/eo#8850 ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100