Skip to content

Commit

Permalink
Merge pull request #6 from mpsijm/update-jsglr2-cli
Browse files Browse the repository at this point in the history
Update to latest JSGLR2 CLI
  • Loading branch information
ChielBruin authored Jul 9, 2020
2 parents 2f880a7 + b887dc8 commit 86f7f28
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
6 changes: 6 additions & 0 deletions spoofax-pygments/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<version>2.6.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.metaborg</groupId>
<artifactId>org.metaborg.spoofax.core</artifactId>
<version>2.6.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -64,7 +63,7 @@ public void outputResult(JSGLR2Success<IStrategoTerm> 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);

Expand Down Expand Up @@ -127,7 +126,6 @@ private Map<IStrategoTerm, IStrategoTerm> initParentMap(IStrategoTerm rootTerm)
return parentMap;
}

@NotNull
private String mapTokenToPygmentizeToken(IToken token, StylerFacet stylerFacet, Map<String, IStyle> styleMap,
Map<IStrategoTerm, IStrategoTerm> parentMap) {
final IStrategoTerm term = (IStrategoTerm) token.getAstNode();
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion spoofax-pygments/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e

(cd core && mvn install)
(cd core && mvn clean install)

cp core/target/*-shaded.jar spoofax-pygmentize-core.jar

0 comments on commit 86f7f28

Please sign in to comment.