From b887dc8ed98713d9e217a16eef209972f0b458f8 Mon Sep 17 00:00:00 2001 From: Maarten Sijm Date: Thu, 9 Jul 2020 12:38:49 +0200 Subject: [PATCH] Update to latest JSGLR2 CLI --- spoofax-pygments/core/pom.xml | 6 ++++ .../PygmentsTokenOutput.java | 36 +++++++++---------- spoofax-pygments/release.sh | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/spoofax-pygments/core/pom.xml b/spoofax-pygments/core/pom.xml index c2a4c1b..edb3f80 100644 --- a/spoofax-pygments/core/pom.xml +++ b/spoofax-pygments/core/pom.xml @@ -21,6 +21,12 @@ 2.6.0-SNAPSHOT + + org.metaborg + org.metaborg.spoofax.core + 2.6.0-SNAPSHOT + + org.json json diff --git a/spoofax-pygments/core/src/main/java/ch/bruin/spoofaxPygmentizeCore/PygmentsTokenOutput.java b/spoofax-pygments/core/src/main/java/ch/bruin/spoofaxPygmentizeCore/PygmentsTokenOutput.java index 1aad060..eed400e 100644 --- a/spoofax-pygments/core/src/main/java/ch/bruin/spoofaxPygmentizeCore/PygmentsTokenOutput.java +++ b/spoofax-pygments/core/src/main/java/ch/bruin/spoofaxPygmentizeCore/PygmentsTokenOutput.java @@ -1,7 +1,6 @@ package ch.bruin.spoofaxPygmentizeCore; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.jetbrains.annotations.NotNull; import org.json.JSONObject; import org.metaborg.core.style.IStyle; import org.metaborg.core.style.Style; @@ -64,7 +63,7 @@ public void outputResult(JSGLR2Success result, PrintStream output esvInputStream = PygmentsTokenOutput.class.getResourceAsStream("/defaulteditor.esv.af"); } - final TermReader reader = new TermReader(new TermFactory().getFactoryWithStorageType(IStrategoTerm.IMMUTABLE)); + final TermReader reader = new TermReader(new TermFactory()); final IStrategoTerm esvTerm = reader.parseFromStream(esvInputStream); final StylerFacet stylerFacet = StylerFacetFromESV.create((IStrategoAppl) esvTerm); @@ -127,7 +126,6 @@ private Map initParentMap(IStrategoTerm rootTerm) return parentMap; } - @NotNull private String mapTokenToPygmentizeToken(IToken token, StylerFacet stylerFacet, Map styleMap, Map parentMap) { final IStrategoTerm term = (IStrategoTerm) token.getAstNode(); @@ -163,30 +161,30 @@ private String mapTokenToPygmentizeToken(IToken token, StylerFacet stylerFacet, private String mapTokenKindToString(IToken token) { switch (token.getKind()) { - case IToken.TK_IDENTIFIER: + case TK_IDENTIFIER: return "IDENTIFIER"; - case IToken.TK_NUMBER: + case TK_NUMBER: return "NUMBER"; - case IToken.TK_STRING: + case TK_STRING: return "STRING"; - case IToken.TK_ERROR_KEYWORD: - case IToken.TK_KEYWORD: + case TK_ERROR_KEYWORD: + case TK_KEYWORD: return "KEYWORD"; - case IToken.TK_OPERATOR: + case TK_OPERATOR: return "OPERATOR"; - case IToken.TK_VAR: + case TK_VAR: return "VAR"; - case IToken.TK_ERROR_LAYOUT: - case IToken.TK_LAYOUT: + case TK_ERROR_LAYOUT: + case TK_LAYOUT: return "LAYOUT"; default: - case IToken.TK_UNKNOWN: - case IToken.TK_ERROR: - case IToken.TK_EOF: - case IToken.TK_ERROR_EOF_UNEXPECTED: - case IToken.TK_ESCAPE_OPERATOR: - case IToken.TK_RESERVED: - case IToken.TK_NO_TOKEN_KIND: + case TK_UNKNOWN: + case TK_ERROR: + case TK_EOF: + case TK_ERROR_EOF_UNEXPECTED: + case TK_ESCAPE_OPERATOR: + case TK_RESERVED: + case TK_NO_TOKEN_KIND: return null; } } diff --git a/spoofax-pygments/release.sh b/spoofax-pygments/release.sh index cacbdb2..2981547 100755 --- a/spoofax-pygments/release.sh +++ b/spoofax-pygments/release.sh @@ -2,6 +2,6 @@ set -e -(cd core && mvn install) +(cd core && mvn clean install) cp core/target/*-shaded.jar spoofax-pygmentize-core.jar