JPQL syntax highlighting via Semantic Tokens

This commit is contained in:
aboyko
2024-04-10 09:57:13 -04:00
parent cf8f50615e
commit 95b8e2f5bd
51 changed files with 16831 additions and 56 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016 Pivotal, Inc.
* Copyright (c) 2016, 2024 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,7 @@ import java.util.BitSet;
import java.util.List;
import org.antlr.v4.runtime.ANTLRErrorListener;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.ConsoleErrorListener;
import org.antlr.v4.runtime.ParserRuleContext;
@@ -53,8 +53,8 @@ public class AntlrParser implements Parser {
ArrayList<Problem> syntaxErrors = new ArrayList<>();
ArrayList<Problem> problems = new ArrayList<>();
ArrayList<PropertiesAst.Node> astNodes = new ArrayList<>();
JavaPropertiesLexer lexer = new JavaPropertiesLexer(new ANTLRInputStream(text.toCharArray(), text.length()));
JavaPropertiesLexer lexer = new JavaPropertiesLexer(CharStreams.fromString(text));
CommonTokenStream tokens = new CommonTokenStream(lexer);
JavaPropertiesParser parser = new JavaPropertiesParser(tokens);

View File

@@ -1,4 +1,4 @@
// Generated from java-escape by ANTLR 4.11.1
// Generated from JavaProperties.g4 by ANTLR 4.13.1
package org.springframework.ide.vscode.java.properties.antlr.parser;
import org.antlr.v4.runtime.ParserRuleContext;

View File

@@ -1,4 +1,4 @@
// Generated from java-escape by ANTLR 4.11.1
// Generated from JavaProperties.g4 by ANTLR 4.13.1
package org.springframework.ide.vscode.java.properties.antlr.parser;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
@@ -9,9 +9,9 @@ import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"})
public class JavaPropertiesLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); }
static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =

View File

@@ -1,4 +1,4 @@
// Generated from java-escape by ANTLR 4.11.1
// Generated from JavaProperties.g4 by ANTLR 4.13.1
package org.springframework.ide.vscode.java.properties.antlr.parser;
import org.antlr.v4.runtime.tree.ParseTreeListener;

View File

@@ -1,4 +1,4 @@
// Generated from java-escape by ANTLR 4.11.1
// Generated from JavaProperties.g4 by ANTLR 4.13.1
package org.springframework.ide.vscode.java.properties.antlr.parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
@@ -11,7 +11,7 @@ import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
public class JavaPropertiesParser extends Parser {
static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); }
static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
@@ -78,7 +78,7 @@ public class JavaPropertiesParser extends Parser {
}
@Override
public String getGrammarFileName() { return "java-escape"; }
public String getGrammarFileName() { return "JavaProperties.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@@ -127,7 +127,7 @@ public class JavaPropertiesParser extends Parser {
setState(25);
_errHandler.sync(this);
_la = _input.LA(1);
while (((_la) & ~0x3f) == 0 && ((1L << _la) & 498L) != 0) {
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 498L) != 0)) {
{
{
setState(22);
@@ -339,7 +339,7 @@ public class JavaPropertiesParser extends Parser {
setState(53);
_errHandler.sync(this);
_la = _input.LA(1);
while (((_la) & ~0x3f) == 0 && ((1L << _la) & 446L) != 0) {
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 446L) != 0)) {
{
{
setState(50);
@@ -653,7 +653,7 @@ public class JavaPropertiesParser extends Parser {
{
setState(80);
_la = _input.LA(1);
if ( !(((_la) & ~0x3f) == 0 && ((1L << _la) & 140L) != 0) ) {
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 140L) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
@@ -664,7 +664,7 @@ public class JavaPropertiesParser extends Parser {
setState(84);
_errHandler.sync(this);
_la = _input.LA(1);
while (((_la) & ~0x3f) == 0 && ((1L << _la) & 446L) != 0) {
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 446L) != 0)) {
{
{
setState(81);
@@ -820,7 +820,7 @@ public class JavaPropertiesParser extends Parser {
{
setState(97);
_la = _input.LA(1);
if ( !(((_la) & ~0x3f) == 0 && ((1L << _la) & 510L) != 0) ) {
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 510L) != 0)) ) {
_errHandler.recoverInline(this);
}
else {