Skip to content
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

Error recovery for Rascal #490

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft

Error recovery for Rascal #490

wants to merge 39 commits into from

Conversation

sungshik
Copy link
Contributor

@sungshik sungshik commented Oct 24, 2024

History

Building a VSIX package

Run the following script:

# Installing `rascal`
git clone https://github.com/usethesource/rascal.git
cd rascal
git checkout feat/error-recovery
mvn install -Drascal.compile.skip -Drascal.tutor.skip -DskipTests
RASCAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
cd ..

# Building the VSIX package
git clone https://github.com/usethesource/rascal-language-servers.git
cd rascal-language-servers/rascal-lsp
git checkout error-recovery/rascal
mvn versions:use-dep-version -Dincludes=org.rascalmpl:rascal -DdepVersion=$RASCAL_VERSION -DforceVersion=true
cd ../rascal-vscode-extension
npm ci
cd ..
./build.sh -fd
./package.sh
cd ..

# Cleaning up
mv rascal-language-servers/rascal-vscode-extension/*.vsix .
yes | rm -r rascal rascal-language-servers

children += [symbol("<u.name>", struct(), u@\loc, detail="data <u> <kws>", children=kwlist)];
top-down-break visit (m) {
case decl: (Declaration) `<Tags _> <Visibility _> <Type t> <{Variable ","}+ vars>;`:
if (!hasErrors(decl)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing something here. If a node like this matches then it has enough structure to produce the symbol. What does it matter if there are errors inside?

Copy link
Member

@jurgenvinju jurgenvinju Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the error trees is that they will be there but won't match with any of the expected language constructs. So you can ignore them typically.

For the case where you encounter one during recursion, a match on the error tree has to be added that ignores it or does something useful like a short yield: "<error tree>"[..25]

Copy link
Member

@jurgenvinju jurgenvinju Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yield of an error tree is guaranteed to work: "<myStat>" will yield the entire string that was accepted to fill in for a real statement.

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

Successfully merging this pull request may close these issues.

4 participants