[Cpp] XPath.findAll does not produce the same result than python3 runtime
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hello
Using 4.13.1 Cpp runtime with xpath feature I found a mismatch with result produce by python3 runtime.
Attached testcase reproduce the python3 testcase testing XPath feature :
https://github.com/antlr/antlr4/blob/b3bb7439546d2035203790d5513c505720cf0bdd/runtime/Python3/tests/xpathtest.py#L14
[case_issue4.tar.gz](https://github.com/user-attachments/files/16119793/case_issue4.tar.gz)
Execution of provide testcase agains Cpp runtime 4.13.1 produce:
```
[func, func, ]
[func, func, ]
[func, func, ]
[prog, ]
[prog, ]
[prog, ]
[prog, ]
[f, x, y, x, y, g, x, x, ]
[y, x, ]
[x, y, x, ]
[return, ]
[return, ]
[3, 4, y, 1, 2, x, ]
[stat, stat, stat, stat, ]
[def, def, ]
[;, ;, ;, ;, ]
[3, 4, 1, 2, ]
[expr, expr, expr, expr, expr, expr, ]
[]
[]
[y, x, x, x, ]
```
Which is conform to expected except for last pattern. The last pattern seems to have been added to covers antlr/antlr4#370 according comment in python testcase.
The expected result is:
```
[y, x, ]
```
Contributor guide
Research direction
Start with the Python reference test at runtime/Python3/tests/xpathtest.py, especially the final XPath pattern, and run the attached case_issue4.tar.gz against the Cpp runtime. Compare the Cpp output with the expected [y, x, ] result; done means the final pattern matches without changing the other reported results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100