Incomplete quote eating EOF token during parsing
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
Parsing the incomplete expression ending with any of the quote tokens (i.e. one of the keywords `symbol`, `local`, `global`, `threadVariable`, `threadLocal`) using `parse` causes the trailing quote to eat the EOF token that get's added implicitly to the end of the code and by mistake process the expression as if it was correct one. In resulting CST contains EOF token coupled with quote specifier:
```macaulay2
Macaulay2, version 1.26.06-2-g1a37f6fe95-dirty (makepkg)
Type "help" to see useful commands
i1 : parse "symbol"
o1 = {{Quote, {Token, -*end of file*-}}}
```
Uncoupled quote is only possible to appear once per file and always directly preceeding EOF (it's highest possible precedence makes it always just consume greedily the next token), so eating EOF has some justification from the abstract nonsense point of view. The problem with that is that it makes the method succesfully parse the code with syntax errors.
Generally `parse` turned out to be very useful to me, but out of 4 situations I've found a nice use for it, 4 times I also needed to manually fix that issue to make it work as expected, so making it permanent makes to me a lot of sense
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.
Research direction
Reproduce the issue with parse "symbol" and inspect the parser's handling of quote tokens and the implicit EOF token. The fix is complete when incomplete expressions ending in symbol, local, global, threadVariable, or threadLocal are rejected as syntax errors instead of producing a CST with EOF coupled to the quote.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100