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

@@ -86,6 +86,11 @@
contentType="org.springframework.boot.ide.pom.xml"
id="org.eclipse.languageserver.languages.springboot">
</contentTypeMapping>
<contentTypeMapping
contentType="org.springframework.boot.ide.boot.jpa-named-queries"
id="org.eclipse.languageserver.languages.springboot"
languageId="jpa-query-properties">
</contentTypeMapping>
</extension>
@@ -188,6 +193,18 @@
content-type="org.springframework.boot.ide.pom.xml"
file-names="pom.xml">
</file-association>
<content-type
base-type="org.eclipse.core.runtime.text"
default-charset="UTF-8"
file-names="jpa-named-queries.properties"
id="org.springframework.boot.ide.boot.jpa-named-queries"
name="JPA Named Queries File"
priority="high">
</content-type>
<file-association
content-type="org.springframework.boot.ide.boot.jpa-named-queries"
file-names="jpa-named-queries.properties">
</file-association>
</extension>
<extension
@@ -401,10 +418,6 @@
contentTypeId="org.springframework.boot.ide.properties.application.properties"
/>
</editor>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="org.springframework.tooling.ls.eclipse.commons.YamlGenericEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
@@ -412,14 +425,10 @@
id="SpringBootYMLPropertyEditor"
name="Generic Editor - Spring YAML Properties"
symbolicFontName="org.eclipse.jdt.ui.PropertiesFileEditor.textfont">
<contentTypeBinding
contentTypeId="org.springframework.boot.ide.properties.application.yml"
/>
<contentTypeBinding
contentTypeId="org.springframework.boot.ide.properties.application.yml">
</contentTypeBinding>
</editor>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
@@ -427,36 +436,48 @@
id="SpringFactoriesEditor"
name="Generic Editor - Spring Factories"
symbolicFontName="org.eclipse.jdt.ui.PropertiesFileEditor.textfont">
<contentTypeBinding
contentTypeId="org.springframework.boot.ide.boot.factories"
/>
<contentTypeBinding
contentTypeId="org.springframework.boot.ide.boot.factories">
</contentTypeBinding>
</editor>
<editor
class="org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="false"
icon="icons/spring_obj.gif"
id="JpaQueryPropertiesEditor"
name="Generic Editor - JPA Named Queries"
symbolicFontName="org.eclipse.jdt.ui.PropertiesFileEditor.textfont">
<contentTypeBinding
contentTypeId="org.springframework.boot.ide.boot.jpa-named-queries">
</contentTypeBinding>
</editor>
</extension>
<extension
point="org.eclipse.ui.genericeditor.presentationReconcilers">
<presentationReconciler
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
contentType="org.springframework.boot.ide.properties.application.properties">
</presentationReconciler>
</extension>
<extension
point="org.eclipse.ui.genericeditor.presentationReconcilers">
<presentationReconciler
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
contentType="org.springframework.boot.ide.properties.application.yml">
</presentationReconciler>
</extension>
<extension
point="org.eclipse.ui.genericeditor.presentationReconcilers">
<presentationReconciler
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
contentType="org.springframework.boot.ide.properties.application.properties">
</presentationReconciler>
<presentationReconciler
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
contentType="org.springframework.boot.ide.boot.factories">
</presentationReconciler>
<presentationReconciler
class="org.eclipse.tm4e.ui.text.TMPresentationReconciler"
contentType="org.springframework.boot.ide.boot.jpa-named-queries">
</presentationReconciler>
</extension>
<extension
point="org.eclipse.tm4e.registry.grammars">
<grammar
@@ -479,16 +500,17 @@
contentTypeId="org.springframework.boot.ide.properties.application.properties"
scopeName="source.java-properties">
</scopeNameContentTypeBinding>
</extension>
<extension
point="org.eclipse.tm4e.registry.grammars">
<scopeNameContentTypeBinding
contentTypeId="org.springframework.boot.ide.boot.factories"
scopeName="source.java-properties">
</scopeNameContentTypeBinding>
<scopeNameContentTypeBinding
contentTypeId="org.springframework.boot.ide.boot.jpa-named-queries"
scopeName="source.java-properties">
</scopeNameContentTypeBinding>
</extension>
<extension
id="springxml-completion-computer"
point="org.eclipse.wst.sse.ui.completionProposal">

View File

@@ -48,4 +48,6 @@ public class Constants {
public static final String PREF_MODULITH = "boot-java.modulith-project-tracking";
public static final String PREF_JPQL = "boot-java.jpql";
}

View File

@@ -206,6 +206,7 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
validation.put("spel", validationSpelExpressions);
validation.put("java", javaValidation);
bootJavaObj.put("jpql", preferenceStore.getBoolean(Constants.PREF_JPQL));
bootJavaObj.put("live-information", liveInformation);
bootJavaObj.put("support-spring-xml-config", supportXML);
bootJavaObj.put("change-detection", bootChangeDetection);

View File

@@ -43,6 +43,9 @@ public class BootJavaPreferencesPage extends FieldEditorPreferencePage implement
addField(new BooleanFieldEditor(Constants.PREF_CHANGE_DETECTION, "Live Boot Change Detection", fieldEditorParent));
// JPQL Support switch
addField(new BooleanFieldEditor(Constants.PREF_JPQL, "JPA Query language support", fieldEditorParent));
// Experimental Modulith support
addField(new BooleanFieldEditor(Constants.PREF_MODULITH, "Spring Boot Modulith automatic project tracking and metadata update", fieldEditorParent));

View File

@@ -64,6 +64,8 @@ public class PrefsInitializer extends AbstractPreferenceInitializer {
preferenceStore.setDefault(Constants.PREF_LIVE_INFORMATION_ALL_JVM_PROCESSES, false);
preferenceStore.setDefault(Constants.PREF_JPQL, true);
}
}

View File

@@ -16,6 +16,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -31,12 +32,20 @@ import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.HoverParams;
import org.eclipse.lsp4j.InlayHint;
import org.eclipse.lsp4j.InlayHintParams;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensDelta;
import org.eclipse.lsp4j.SemanticTokensDeltaParams;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SemanticTokensRangeParams;
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
import org.eclipse.lsp4j.TextDocumentIdentifier;
import org.eclipse.lsp4j.WorkspaceSymbol;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.springframework.context.ApplicationContext;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.CodeActionHandler;
import org.springframework.ide.vscode.commons.languageserver.util.CodeLensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentSymbolHandler;
@@ -81,6 +90,7 @@ public class CompositeLanguageServerComponents implements LanguageServerComponen
private final CodeLensHandler codeLensHandler;
private final DocumentSymbolHandler docSymbolHandler;
private final InlayHintHandler inlayHintHandler;
private final SemanticTokensHandler semanticTokensHanlder;
public CompositeLanguageServerComponents(ApplicationContext appContext, Builder builder) {
SimpleLanguageServer server = appContext.getBean(SimpleLanguageServer.class);
@@ -202,6 +212,60 @@ public class CompositeLanguageServerComponents implements LanguageServerComponen
return Collections.emptyList();
}
};
List<SemanticTokensHandler> semanticTokenHandlers = componentsByLanguageId.values().stream().flatMap(l -> l.stream()).map(c -> c.getSemanticTokensHandler()).filter(o -> o.isPresent()).map(o -> o.get()).collect(Collectors.toList());
List<SemanticTokensWithRegistrationOptions> listCapabilities = semanticTokenHandlers.stream().map(sth -> sth.getCapability()).filter(Objects::nonNull).collect(Collectors.toList());
for (int i = 1; i < listCapabilities.size(); i++) {
SemanticTokensWithRegistrationOptions first = listCapabilities.get(0);
SemanticTokensWithRegistrationOptions current = listCapabilities.get(i);
if (!Objects.equals(first.getFull(), current.getFull())
|| !Objects.equals(first.getLegend(), current.getLegend())
|| !Objects.equals(first.getRange(), current.getRange())) {
throw new IllegalStateException("Incompatible Semantic Token registrations for composite language server components");
}
}
this.semanticTokensHanlder = semanticTokenHandlers.isEmpty() ? null : new SemanticTokensHandler() {
@Override
public SemanticTokensWithRegistrationOptions getCapability() {
SemanticTokensWithRegistrationOptions capabilities = new SemanticTokensWithRegistrationOptions();
capabilities.setDocumentSelector(listCapabilities.stream().map(c -> c.getDocumentSelector()).flatMap(l -> l.stream()).collect(Collectors.toList()));
if (!listCapabilities.isEmpty()) {
SemanticTokensWithRegistrationOptions first = listCapabilities.get(0);
capabilities.setFull(first.getFull());
capabilities.setLegend(first.getLegend());
capabilities.setRange(first.getRange());
}
return capabilities;
}
@Override
public SemanticTokens semanticTokensFull(SemanticTokensParams params, CancelChecker cancelChecker) {
return findHandler(params.getTextDocument()).map(sth -> sth.semanticTokensFull(params, cancelChecker)).orElse(SemanticTokensHandler.super.semanticTokensFull(params, cancelChecker));
}
@Override
public Either<SemanticTokens, SemanticTokensDelta> semanticTokensFullDelta(
SemanticTokensDeltaParams params, CancelChecker cancelChecker) {
return findHandler(params.getTextDocument()).map(sth -> sth.semanticTokensFullDelta(params, cancelChecker)).orElse(SemanticTokensHandler.super.semanticTokensFullDelta(params, cancelChecker));
}
@Override
public SemanticTokens semanticTokensRange(SemanticTokensRangeParams params, CancelChecker cancelChecker) {
return findHandler(params.getTextDocument()).map(sth -> sth.semanticTokensRange(params, cancelChecker)).orElse(SemanticTokensHandler.super.semanticTokensRange(params, cancelChecker));
}
private Optional<SemanticTokensHandler> findHandler(TextDocumentIdentifier docId) {
TextDocument doc = server.getTextDocumentService().getLatestSnapshot(docId.getUri());
LanguageId language = doc.getLanguageId();
List<LanguageServerComponents> subComponents = componentsByLanguageId.get(language);
if (subComponents != null) {
return subComponents.stream().filter(sc -> sc.getSemanticTokensHandler().isPresent()).map(sc -> sc.getSemanticTokensHandler().get()).findFirst();
}
return Optional.empty();
}
};
}
@Override
@@ -248,6 +312,11 @@ public class CompositeLanguageServerComponents implements LanguageServerComponen
return Optional.of(inlayHintHandler);
}
@Override
public Optional<SemanticTokensHandler> getSemanticTokensHandler() {
return Optional.ofNullable(semanticTokensHanlder);
}
private static TextDocument getDoc(ApplicationContext appContext, String uri) {
TextDocument doc = appContext.getBean(SimpleLanguageServer.class).getTextDocumentService().getLatestSnapshot(uri);

View File

@@ -14,6 +14,7 @@ import java.util.Optional;
import java.util.Set;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.CodeActionHandler;
import org.springframework.ide.vscode.commons.languageserver.util.CodeLensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentSymbolHandler;
@@ -30,4 +31,5 @@ public interface LanguageServerComponents {
default Optional<DocumentSymbolHandler> getDocumentSymbolProvider() { return Optional.empty(); }
default Optional<CodeLensHandler> getCodeLensHandler() { return Optional.empty(); }
default Optional<InlayHintHandler> getInlayHintHandler() { return Optional.empty(); }
default Optional<SemanticTokensHandler> getSemanticTokensHandler() { return Optional.empty(); }
}

View File

@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.commons.languageserver.semantic.tokens;
import java.util.Arrays;
import java.util.Objects;
public record SemanticTokenData(int start, int end, String type, String[] modifiers) implements Comparable<SemanticTokenData>{
@Override
public int compareTo(SemanticTokenData o) {
if (start == o.start) {
return end - o.end;
}
return start - o.start;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(modifiers);
result = prime * result + Objects.hash(end, start, type);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SemanticTokenData other = (SemanticTokenData) obj;
return end == other.end && Arrays.equals(modifiers, other.modifiers) && start == other.start
&& Objects.equals(type, other.type);
}
}

View File

@@ -0,0 +1,22 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.commons.languageserver.semantic.tokens;
import java.util.Collections;
import java.util.List;
public interface SemanticTokensDataProvider {
List<String> getTokenTypes();
default List<String> getTypeModifiers() { return Collections.emptyList(); }
List<SemanticTokenData> computeTokens(String text, int initialOffset);
}

View File

@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.commons.languageserver.semantic.tokens;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensDelta;
import org.eclipse.lsp4j.SemanticTokensDeltaParams;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SemanticTokensRangeParams;
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
public interface SemanticTokensHandler {
SemanticTokensWithRegistrationOptions getCapability();
default SemanticTokens semanticTokensFull(SemanticTokensParams params, CancelChecker cancelChecker) {
return new SemanticTokens();
}
default Either<SemanticTokens, SemanticTokensDelta> semanticTokensFullDelta(SemanticTokensDeltaParams params, CancelChecker cancelChecker) {
return Either.forLeft(new SemanticTokens());
}
default SemanticTokens semanticTokensRange(SemanticTokensRangeParams params, CancelChecker cancelChecker) {
return new SemanticTokens();
}
}

View File

@@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.commons.languageserver.semantic.tokens;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import org.eclipse.lsp4j.SemanticTokensLegend;
public class SemanticTokensUtils {
private static int getSemanticTokenTypeIndex(SemanticTokensLegend legend, String tokenType) {
return legend.getTokenTypes().indexOf(tokenType);
}
private static int getSemanticTokenModifiersFlags(SemanticTokensLegend legend, String[] modifiers) {
int flags = 0;
for (String modifier : modifiers) {
int bit = legend.getTokenModifiers().indexOf(modifier);
if (bit < 0) {
throw new IllegalArgumentException("Cannot find modifier '%s' in the legend: %s".formatted(modifier, legend));
} else {
flags |= (1 << bit);
}
}
return flags;
}
public static List<Integer> mapTokensDataToLsp(List<SemanticTokenData> tokensData, SemanticTokensLegend legend, Function<Integer, Integer> getLineNumber, Function<Integer, Integer> getColumnNumber) {
// Sort tokens by start offset
Collections.sort(tokensData);
List<Integer> data = new ArrayList<>(tokensData.size() * 5);
// Encode relative positions for tokens
int previousLine = 0;
int previousColumn = 0;
for (SemanticTokenData tokenData : tokensData) {
int currentLine = getLineNumber.apply(tokenData.start());
int currentColumn = getColumnNumber.apply(tokenData.start());
data.add(currentLine - previousLine);
data.add(currentLine == previousLine ? currentColumn - previousColumn : currentColumn);
data.add(tokenData.end() - tokenData.start());
data.add(SemanticTokensUtils.getSemanticTokenTypeIndex(legend, tokenData.type()));
data.add(SemanticTokensUtils.getSemanticTokenModifiersFlags(legend, tokenData.modifiers()));
previousLine = currentLine;
previousColumn = currentColumn;
}
return data;
}
}

View File

@@ -59,6 +59,7 @@ import org.eclipse.lsp4j.ProgressParams;
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.Registration;
import org.eclipse.lsp4j.RegistrationParams;
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.SetTraceParams;
import org.eclipse.lsp4j.TextDocumentIdentifier;
@@ -383,7 +384,9 @@ public final class SimpleLanguageServer implements Sts4LanguageServer, SpringInd
log.debug("workspaceRoots = "+getWorkspaceService().getWorkspaceRoots());
log.debug("hasCompletionSnippetSupport = "+hasCompletionSnippetSupport);
log.debug("hasExecuteCommandSupport = "+hasExecuteCommandSupport);
getTextDocumentService().clientCapabilities = params.getCapabilities().getTextDocument();
InitializeResult result = new InitializeResult();
if (hasExecuteCommandSupport) {
@@ -541,6 +544,9 @@ public final class SimpleLanguageServer implements Sts4LanguageServer, SpringInd
if (hasWorkspaceSymbolHandler()) {
c.setWorkspaceSymbolProvider(true);
}
// TODO: Check if server supports all token types from the legend
SemanticTokensWithRegistrationOptions semanticTokensCapability = getTextDocumentService().getSemanticTokensWithRegistrationOptions();
c.setSemanticTokensProvider(semanticTokensCapability);
WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions();
workspaceFoldersOptions.setSupported(true);

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2022 VMware Inc.
* Copyright (c) 2016, 2024 VMware 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
@@ -59,6 +59,12 @@ import org.eclipse.lsp4j.LocationLink;
import org.eclipse.lsp4j.PublishDiagnosticsParams;
import org.eclipse.lsp4j.ReferenceParams;
import org.eclipse.lsp4j.RenameParams;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensDelta;
import org.eclipse.lsp4j.SemanticTokensDeltaParams;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SemanticTokensRangeParams;
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
import org.eclipse.lsp4j.SignatureHelp;
import org.eclipse.lsp4j.SignatureHelpParams;
import org.eclipse.lsp4j.SymbolInformation;
@@ -81,6 +87,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.ide.vscode.commons.languageserver.config.LanguageServerProperties;
import org.springframework.ide.vscode.commons.languageserver.quickfix.Quickfix;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.util.Assert;
import org.springframework.ide.vscode.commons.util.BadLocationException;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
@@ -122,6 +129,9 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
private CodeLensResolveHandler codeLensResolveHandler;
private CodeActionHandler codeActionHandler;
private InlayHintHandler inlayHintHandler;
private SemanticTokensHandler semanticTokensHandler;
TextDocumentClientCapabilities clientCapabilities;
final private ApplicationContext appContext;
@@ -446,6 +456,34 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
}
}
@Override
public CompletableFuture<SemanticTokens> semanticTokensFull(SemanticTokensParams params) {
if (semanticTokensHandler == null) {
return CompletableFuture.completedFuture(new SemanticTokens());
} else {
return CompletableFutures.computeAsync(messageWorkerThreadPool, cancelChecker -> semanticTokensHandler.semanticTokensFull(params, cancelChecker));
}
}
@Override
public CompletableFuture<Either<SemanticTokens, SemanticTokensDelta>> semanticTokensFullDelta(
SemanticTokensDeltaParams params) {
if (semanticTokensHandler == null) {
return CompletableFuture.completedFuture(Either.forLeft(new SemanticTokens()));
} else {
return CompletableFutures.computeAsync(messageWorkerThreadPool, cancelChecker -> semanticTokensHandler.semanticTokensFullDelta(params, cancelChecker));
}
}
@Override
public CompletableFuture<SemanticTokens> semanticTokensRange(SemanticTokensRangeParams params) {
if (semanticTokensHandler == null) {
return CompletableFuture.completedFuture(new SemanticTokens());
} else {
return CompletableFutures.computeAsync(messageWorkerThreadPool, cancelChecker -> semanticTokensHandler.semanticTokensRange(params, cancelChecker));
}
}
private List<Either<Command, CodeAction>> computeCodeActions(CancelChecker cancelToken, CodeActionCapabilities capabilities, TextDocument doc, CodeActionParams params) {
Builder<Either<Command,CodeAction>> listBuilder = ImmutableList.builder();
CodeActionContext context = params.getContext();
@@ -702,11 +740,20 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
public boolean hasCodeLensResolveProvider() {
return this.codeLensResolveHandler != null;
}
final SemanticTokensWithRegistrationOptions getSemanticTokensWithRegistrationOptions() {
return semanticTokensHandler == null ? null : semanticTokensHandler.getCapability();
}
public synchronized void onDocumentSymbol(DocumentSymbolHandler h) {
Assert.isNull("A DocumentSymbolHandler is already set, multiple handlers not supported yet", documentSymbolHandler);
this.documentSymbolHandler = h;
}
public synchronized void onSemanticTokens(SemanticTokensHandler h) {
Assert.isNull("A SemanticTokensHandler is already set, multiple handlers not supported yet", semanticTokensHandler);
this.semanticTokensHandler = h;
}
public boolean hasDocumentSymbolHandler() {
return this.documentSymbolHandler != null;
@@ -721,7 +768,7 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
return this.documentHighlightHandler != null;
}
public synchronized void onCompletion(CompletionHandler h) {
public synchronized void onCompletion(CompletionHandler h) {
Assert.isNull("A completion handler is already set, multiple handlers not supported yet", completionHandler);
this.completionHandler = h;
}
@@ -748,5 +795,5 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
public boolean hasReferencesHandler() {
return this.referencesHandler != null;
}
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2022 Pivotal, Inc.
* Copyright (c) 2017, 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
@@ -32,6 +32,7 @@ public class LanguageId {
public static final LanguageId BOOT_PROPERTIES = of("spring-boot-properties");
public static final LanguageId BOOT_PROPERTIES_YAML = of("spring-boot-properties-yaml");
public static final LanguageId SPRING_FACTORIES = of("spring-factories");
public static final LanguageId JPA_QUERY_PROPERTIES = of("jpa-query-properties");
private final String id;

View File

@@ -2,3 +2,7 @@ target
.idea
*.iml
antlr-*.jar
/src/main/java/org/springframework/ide/vscode/java/properties/antlr/parser/JavaProperties.interp
/src/main/java/org/springframework/ide/vscode/java/properties/antlr/parser/JavaProperties.tokens
/src/main/java/org/springframework/ide/vscode/java/properties/antlr/parser/JavaPropertiesLexer.interp
/src/main/java/org/springframework/ide/vscode/java/properties/antlr/parser/JavaPropertiesLexer.tokens

View File

@@ -1,6 +1,6 @@
#!/bin/bash
set -e
ANTLR_VERSION=4.11.1
ANTLR_VERSION=4.13.1
if [ ! -f antlr-${ANTLR_VERSION}.jar ]; then
curl https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar --output antlr-${ANTLR_VERSION}.jar
fi

View File

@@ -28,7 +28,7 @@
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.11.1</version>
<version>${antlr.version}</version>
</dependency>
</dependencies>

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 {

View File

@@ -0,0 +1,6 @@
/antlr-4.13.1.jar
/src/main/java/org/springframework/ide/vscode/jpql/antlr/parser/Jpql.interp
/src/main/java/org/springframework/ide/vscode/jpql/antlr/parser/Jpql.tokens
/src/main/java/org/springframework/ide/vscode/jpql/antlr/parser/JpqlLexer.interp
/src/main/java/org/springframework/ide/vscode/jpql/antlr/parser/JpqlLexer.tokens
/target

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
ANTLR_VERSION=4.13.1
if [ ! -f antlr-${ANTLR_VERSION}.jar ]; then
curl https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar --output antlr-${ANTLR_VERSION}.jar
fi
workdir=$(pwd)
cd grammars
java -jar ${workdir}/antlr-${ANTLR_VERSION}.jar Jpql.g4 -o ${workdir}/src/main/java/org/springframework/ide/vscode/jpql/antlr/parser -package org.springframework.ide.vscode.jpql.antlr.parser

View File

@@ -0,0 +1,866 @@
/*
* Copyright 2011-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar Jpql;
@header {
/**
* JPQL per https://jakarta.ee/specifications/persistence/3.1/jakarta-persistence-spec-3.1.html#bnf
*
* This is JPA BNF for JPQL. There are gaps and inconsistencies in the BNF itself, explained by other fragments of the spec.
*
* @see https://github.com/jakartaee/persistence/blob/master/spec/src/main/asciidoc/ch04-query-language.adoc#bnf
* @author Greg Turnquist
* @author Christoph Strobl
* @since 3.1
*/
}
/*
Parser rules
*/
start
: ql_statement EOF
;
ql_statement
: select_statement
| update_statement
| delete_statement
;
select_statement
: select_clause from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)?
;
update_statement
: update_clause (where_clause)?
;
delete_statement
: delete_clause (where_clause)?
;
from_clause
: FROM identification_variable_declaration (',' identificationVariableDeclarationOrCollectionMemberDeclaration )*
;
// This parser rule is needed to iterate over these two types from #from_clause
identificationVariableDeclarationOrCollectionMemberDeclaration
: identification_variable_declaration
| collection_member_declaration
;
identification_variable_declaration
: range_variable_declaration (join | fetch_join)*
;
range_variable_declaration
: entity_name AS? identification_variable
;
join
: join_spec join_association_path_expression AS? identification_variable (join_condition)?
| join_spec join_association_path_expression where_clause
;
fetch_join
: join_spec FETCH join_association_path_expression
;
join_spec
: ((LEFT (OUTER)?) | INNER)? JOIN
;
join_condition
: ON conditional_expression
;
join_association_path_expression
: join_collection_valued_path_expression
| join_single_valued_path_expression
| TREAT '(' join_collection_valued_path_expression AS subtype ')'
| TREAT '(' join_single_valued_path_expression AS subtype ')'
;
join_collection_valued_path_expression
: identification_variable '.' (single_valued_embeddable_object_field '.')* collection_valued_field
;
join_single_valued_path_expression
: identification_variable '.' (single_valued_embeddable_object_field '.')* single_valued_object_field
;
collection_member_declaration
: IN '(' collection_valued_path_expression ')' AS? identification_variable
;
qualified_identification_variable
: map_field_identification_variable
| ENTRY '(' identification_variable ')'
;
map_field_identification_variable
: KEY '(' identification_variable ')'
| VALUE '(' identification_variable ')'
;
single_valued_path_expression
: qualified_identification_variable
| TREAT '(' qualified_identification_variable AS subtype ')'
| state_field_path_expression
| single_valued_object_path_expression
;
general_identification_variable
: identification_variable
| map_field_identification_variable
;
general_subpath
: simple_subpath
| treated_subpath ('.' single_valued_object_field)*
;
simple_subpath
: general_identification_variable
| general_identification_variable ('.' single_valued_object_field)*
;
treated_subpath
: TREAT '(' general_subpath AS subtype ')'
;
state_field_path_expression
: general_subpath '.' state_field
;
state_valued_path_expression
: state_field_path_expression
| general_identification_variable
;
single_valued_object_path_expression
: general_subpath '.' single_valued_object_field
;
collection_valued_path_expression
: general_subpath '.' collection_value_field // BNF at end of spec has a typo
;
update_clause
: UPDATE entity_name (AS? identification_variable)? SET update_item (',' update_item)*
;
update_item
: (identification_variable '.')? (single_valued_embeddable_object_field '.')* (state_field | single_valued_object_field) EQUAL new_value
;
new_value
: scalar_expression
| simple_entity_expression
| NULL
;
delete_clause
: DELETE FROM entity_name (AS? identification_variable)?
;
select_clause
: SELECT (DISTINCT)? select_item (',' select_item)*
;
select_item
: select_expression (AS? result_variable)?
;
select_expression
: single_valued_path_expression
| scalar_expression
| aggregate_expression
| identification_variable
| OBJECT '(' identification_variable ')'
| constructor_expression
;
constructor_expression
: NEW constructor_name '(' constructor_item (',' constructor_item)* ')'
;
constructor_item
: single_valued_path_expression
| scalar_expression
| aggregate_expression
| identification_variable
| literal
;
aggregate_expression
: (AVG | MAX | MIN | SUM) '(' (DISTINCT)? state_valued_path_expression ')'
| COUNT '(' (DISTINCT)? (identification_variable | state_valued_path_expression | single_valued_object_path_expression) ')'
| function_invocation
;
where_clause
: WHERE conditional_expression
;
groupby_clause
: GROUP BY groupby_item (',' groupby_item)*
;
groupby_item
: single_valued_path_expression
| identification_variable
;
having_clause
: HAVING conditional_expression
;
orderby_clause
: ORDER BY orderby_item (',' orderby_item)*
;
// TODO Error in spec BNF, correctly shown elsewhere in spec.
orderby_item
: (state_field_path_expression | general_identification_variable | result_variable ) (ASC | DESC)?
;
subquery
: simple_select_clause subquery_from_clause (where_clause)? (groupby_clause)? (having_clause)?
;
subquery_from_clause
: FROM subselect_identification_variable_declaration (',' (subselect_identification_variable_declaration | collection_member_declaration))*
;
subselect_identification_variable_declaration
: identification_variable_declaration
| derived_path_expression AS? identification_variable (join)*
| derived_collection_member_declaration
;
derived_path_expression
: general_derived_path '.' single_valued_object_field
| general_derived_path '.' collection_valued_field
;
general_derived_path
: simple_derived_path
| treated_derived_path ('.' single_valued_object_field)*
;
simple_derived_path
: superquery_identification_variable ('.' single_valued_object_field)*
;
treated_derived_path
: TREAT '(' general_derived_path AS subtype ')'
;
derived_collection_member_declaration
: IN superquery_identification_variable '.' (single_valued_object_field '.')* collection_valued_field
;
simple_select_clause
: SELECT (DISTINCT)? simple_select_expression
;
simple_select_expression
: single_valued_path_expression
| scalar_expression
| aggregate_expression
| identification_variable
;
scalar_expression
: arithmetic_expression
| string_expression
| enum_expression
| datetime_expression
| boolean_expression
| case_expression
| entity_type_expression
;
conditional_expression
: conditional_term
| conditional_expression OR conditional_term
;
conditional_term
: conditional_factor
| conditional_term AND conditional_factor
;
conditional_factor
: (NOT)? conditional_primary
;
conditional_primary
: simple_cond_expression
| '(' conditional_expression ')'
;
simple_cond_expression
: comparison_expression
| between_expression
| in_expression
| like_expression
| null_comparison_expression
| empty_collection_comparison_expression
| collection_member_expression
| exists_expression
;
between_expression
: arithmetic_expression (NOT)? BETWEEN arithmetic_expression AND arithmetic_expression
| string_expression (NOT)? BETWEEN string_expression AND string_expression
| datetime_expression (NOT)? BETWEEN datetime_expression AND datetime_expression
;
in_expression
: (state_valued_path_expression | type_discriminator) (NOT)? IN (('(' in_item (',' in_item)* ')') | ( '(' subquery ')') | collection_valued_input_parameter)
;
in_item
: literal
| single_valued_input_parameter
;
like_expression
: string_expression (NOT)? LIKE pattern_value (ESCAPE escape_character)?
;
null_comparison_expression
: (single_valued_path_expression | input_parameter) IS (NOT)? NULL
;
empty_collection_comparison_expression
: collection_valued_path_expression IS (NOT)? EMPTY
;
collection_member_expression
: entity_or_value_expression (NOT)? MEMBER (OF)? collection_valued_path_expression
;
entity_or_value_expression
: single_valued_object_path_expression
| state_field_path_expression
| simple_entity_or_value_expression
;
simple_entity_or_value_expression
: identification_variable
| input_parameter
| literal
;
exists_expression
: (NOT)? EXISTS '(' subquery ')'
;
all_or_any_expression
: (ALL | ANY | SOME) '(' subquery ')'
;
comparison_expression
: string_expression comparison_operator (string_expression | all_or_any_expression)
| boolean_expression op=(EQUAL | NOT_EQUAL) (boolean_expression | all_or_any_expression)
| enum_expression op=(EQUAL | NOT_EQUAL) (enum_expression | all_or_any_expression)
| datetime_expression comparison_operator (datetime_expression | all_or_any_expression)
| entity_expression op=(EQUAL | NOT_EQUAL) (entity_expression | all_or_any_expression)
| arithmetic_expression comparison_operator (arithmetic_expression | all_or_any_expression)
| entity_type_expression op=(EQUAL | NOT_EQUAL) entity_type_expression
;
comparison_operator
: op=EQUAL
| op='>'
| op='>='
| op='<'
| op='<='
| op=NOT_EQUAL
;
arithmetic_expression
: arithmetic_term
| arithmetic_expression op=('+' | '-') arithmetic_term
;
arithmetic_term
: arithmetic_factor
| arithmetic_term op=('*' | '/') arithmetic_factor
;
arithmetic_factor
: op=('+' | '-')? arithmetic_primary
;
arithmetic_primary
: state_valued_path_expression
| numeric_literal
| '(' arithmetic_expression ')'
| input_parameter
| functions_returning_numerics
| aggregate_expression
| case_expression
| function_invocation
| '(' subquery ')'
;
string_expression
: state_valued_path_expression
| string_literal
| input_parameter
| functions_returning_strings
| aggregate_expression
| case_expression
| function_invocation
| '(' subquery ')'
;
datetime_expression
: state_valued_path_expression
| input_parameter
| functions_returning_datetime
| aggregate_expression
| case_expression
| function_invocation
| date_time_timestamp_literal
| '(' subquery ')'
;
boolean_expression
: state_valued_path_expression
| boolean_literal
| input_parameter
| case_expression
| function_invocation
| '(' subquery ')'
;
enum_expression
: state_valued_path_expression
| enum_literal
| input_parameter
| case_expression
| '(' subquery ')'
;
entity_expression
: single_valued_object_path_expression
| simple_entity_expression
;
simple_entity_expression
: identification_variable
| input_parameter
;
entity_type_expression
: type_discriminator
| entity_type_literal
| input_parameter
;
type_discriminator
: TYPE '(' (general_identification_variable | single_valued_object_path_expression | input_parameter) ')'
;
functions_returning_numerics
: LENGTH '(' string_expression ')'
| LOCATE '(' string_expression ',' string_expression (',' arithmetic_expression)? ')'
| ABS '(' arithmetic_expression ')'
| CEILING '(' arithmetic_expression ')'
| EXP '(' arithmetic_expression ')'
| FLOOR '(' arithmetic_expression ')'
| LN '(' arithmetic_expression ')'
| SIGN '(' arithmetic_expression ')'
| SQRT '(' arithmetic_expression ')'
| MOD '(' arithmetic_expression ',' arithmetic_expression ')'
| POWER '(' arithmetic_expression ',' arithmetic_expression ')'
| ROUND '(' arithmetic_expression ',' arithmetic_expression ')'
| SIZE '(' collection_valued_path_expression ')'
| INDEX '(' identification_variable ')'
| extract_datetime_field
;
functions_returning_datetime
: CURRENT_DATE
| CURRENT_TIME
| CURRENT_TIMESTAMP
| LOCAL DATE
| LOCAL TIME
| LOCAL DATETIME
| extract_datetime_part
;
functions_returning_strings
: CONCAT '(' string_expression ',' string_expression (',' string_expression)* ')'
| SUBSTRING '(' string_expression ',' arithmetic_expression (',' arithmetic_expression)? ')'
| TRIM '(' ((trim_specification)? (trim_character)? FROM)? string_expression ')'
| LOWER '(' string_expression ')'
| UPPER '(' string_expression ')'
;
trim_specification
: LEADING
| TRAILING
| BOTH
;
function_invocation
: FUNCTION '(' function_name (',' function_arg)* ')'
;
extract_datetime_field
: EXTRACT '(' datetime_field FROM datetime_expression ')'
;
datetime_field
: identification_variable
;
extract_datetime_part
: EXTRACT '(' datetime_part FROM datetime_expression ')'
;
datetime_part
: identification_variable
;
function_arg
: literal
| state_valued_path_expression
| input_parameter
| scalar_expression
;
case_expression
: general_case_expression
| simple_case_expression
| coalesce_expression
| nullif_expression
;
general_case_expression
: CASE when_clause (when_clause)* ELSE scalar_expression END
;
when_clause
: WHEN conditional_expression THEN scalar_expression
;
simple_case_expression
: CASE case_operand simple_when_clause (simple_when_clause)* ELSE scalar_expression END
;
case_operand
: state_valued_path_expression
| type_discriminator
;
simple_when_clause
: WHEN scalar_expression THEN scalar_expression
;
coalesce_expression
: COALESCE '(' scalar_expression (',' scalar_expression)+ ')'
;
nullif_expression
: NULLIF '(' scalar_expression ',' scalar_expression ')'
;
/*******************
Gaps in the spec.
*******************/
trim_character
: CHARACTER
| character_valued_input_parameter
;
identification_variable
: IDENTIFICATION_VARIABLE
| f=(COUNT
| DATE
| INNER
| KEY
| LEFT
| NEW
| ORDER
| OUTER
| POWER
| FLOOR
| SIGN
| TIME
| TYPE
| VALUE)
;
constructor_name
: state_field_path_expression
;
literal
: STRINGLITERAL
| JAVASTRINGLITERAL
| INTLITERAL
| FLOATLITERAL
| LONGLITERAL
| boolean_literal
| entity_type_literal
;
input_parameter
: ':' SPEL
| '?' SPEL
| '?' INTLITERAL
| ':' identification_variable ('%')?
;
pattern_value
: string_expression
;
date_time_timestamp_literal
: STRINGLITERAL
;
entity_type_literal
: identification_variable
;
escape_character
: CHARACTER
| character_valued_input_parameter //
;
numeric_literal
: INTLITERAL
| FLOATLITERAL
| LONGLITERAL
;
boolean_literal
: TRUE
| FALSE
;
enum_literal
: state_field_path_expression
;
string_literal
: CHARACTER
| STRINGLITERAL
;
single_valued_embeddable_object_field
: identification_variable
;
subtype
: identification_variable
;
collection_valued_field
: identification_variable
;
single_valued_object_field
: identification_variable
;
state_field
: identification_variable
;
collection_value_field
: identification_variable
;
entity_name
: identification_variable ('.' identification_variable)* // Hibernate sometimes expands the entity name to FQDN when using named queries
;
result_variable
: identification_variable
;
superquery_identification_variable
: identification_variable
;
collection_valued_input_parameter
: input_parameter
;
single_valued_input_parameter
: input_parameter
;
function_name
: string_literal
;
character_valued_input_parameter
: CHARACTER
| input_parameter
;
/*
Lexer rules
*/
WS : [ \t\r\n] -> skip ;
// Build up case-insentive tokens
fragment A: 'a' | 'A';
fragment B: 'b' | 'B';
fragment C: 'c' | 'C';
fragment D: 'd' | 'D';
fragment E: 'e' | 'E';
fragment F: 'f' | 'F';
fragment G: 'g' | 'G';
fragment H: 'h' | 'H';
fragment I: 'i' | 'I';
fragment J: 'j' | 'J';
fragment K: 'k' | 'K';
fragment L: 'l' | 'L';
fragment M: 'm' | 'M';
fragment N: 'n' | 'N';
fragment O: 'o' | 'O';
fragment P: 'p' | 'P';
fragment Q: 'q' | 'Q';
fragment R: 'r' | 'R';
fragment S: 's' | 'S';
fragment T: 't' | 'T';
fragment U: 'u' | 'U';
fragment V: 'v' | 'V';
fragment W: 'w' | 'W';
fragment X: 'x' | 'X';
fragment Y: 'y' | 'Y';
fragment Z: 'z' | 'Z';
// The following are reserved identifiers:
ABS : A B S;
ALL : A L L;
AND : A N D;
ANY : A N Y;
AS : A S;
ASC : A S C;
AVG : A V G;
BETWEEN : B E T W E E N;
BOTH : B O T H;
BY : B Y;
CASE : C A S E;
CEILING : C E I L I N G;
COALESCE : C O A L E S C E;
CONCAT : C O N C A T;
COUNT : C O U N T;
CURRENT_DATE : C U R R E N T '_' D A T E;
CURRENT_TIME : C U R R E N T '_' T I M E;
CURRENT_TIMESTAMP : C U R R E N T '_' T I M E S T A M P;
DATE : D A T E;
DATETIME : D A T E T I M E ;
DELETE : D E L E T E;
DESC : D E S C;
DISTINCT : D I S T I N C T;
END : E N D;
ELSE : E L S E;
EMPTY : E M P T Y;
ENTRY : E N T R Y;
ESCAPE : E S C A P E;
EXISTS : E X I S T S;
EXP : E X P;
EXTRACT : E X T R A C T;
FALSE : F A L S E;
FETCH : F E T C H;
FLOOR : F L O O R;
FROM : F R O M;
FUNCTION : F U N C T I O N;
GROUP : G R O U P;
HAVING : H A V I N G;
IN : I N;
INDEX : I N D E X;
INNER : I N N E R;
IS : I S;
JOIN : J O I N;
KEY : K E Y;
LEADING : L E A D I N G;
LEFT : L E F T;
LENGTH : L E N G T H;
LIKE : L I K E;
LN : L N;
LOCAL : L O C A L;
LOCATE : L O C A T E;
LOWER : L O W E R;
MAX : M A X;
MEMBER : M E M B E R;
MIN : M I N;
MOD : M O D;
NEW : N E W;
NOT : N O T;
NULL : N U L L;
NULLIF : N U L L I F;
OBJECT : O B J E C T;
OF : O F;
ON : O N;
OR : O R;
ORDER : O R D E R;
OUTER : O U T E R;
POWER : P O W E R;
ROUND : R O U N D;
SELECT : S E L E C T;
SET : S E T;
SIGN : S I G N;
SIZE : S I Z E;
SOME : S O M E;
SQRT : S Q R T;
SUBSTRING : S U B S T R I N G;
SUM : S U M;
THEN : T H E N;
TIME : T I M E;
TRAILING : T R A I L I N G;
TREAT : T R E A T;
TRIM : T R I M;
TRUE : T R U E;
TYPE : T Y P E;
UPDATE : U P D A T E;
UPPER : U P P E R;
VALUE : V A L U E;
WHEN : W H E N;
WHERE : W H E R E;
EQUAL : '=' ;
NOT_EQUAL : '<>' | '!=' ;
CHARACTER : '\'' (~ ('\'' | '\\')) '\'' ;
IDENTIFICATION_VARIABLE : ('a' .. 'z' | 'A' .. 'Z' | '\u0080' .. '\ufffe' | '$' | '_') ('a' .. 'z' | 'A' .. 'Z' | '\u0080' .. '\ufffe' | '0' .. '9' | '$' | '_')* ;
STRINGLITERAL : '\'' (~ ('\'' | '\\'))* '\'' ;
JAVASTRINGLITERAL : '"' ( ('\\' [btnfr"']) | ~('"'))* '"';
FLOATLITERAL : ('0' .. '9')* '.' ('0' .. '9')+ (E ('0' .. '9')+)* (F|D)?;
INTLITERAL : ('0' .. '9')+ ;
LONGLITERAL : ('0' .. '9')+L ;
SPEL : ('$')('{')(.)*?('}') ;

View File

@@ -0,0 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>1.54.0-SNAPSHOT</version>
</parent>
<artifactId>jpql</artifactId>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>${antlr.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,751 @@
// Generated from Jpql.g4 by ANTLR 4.13.1
package org.springframework.ide.vscode.jpql.antlr.parser;
/**
* JPQL per https://jakarta.ee/specifications/persistence/3.1/jakarta-persistence-spec-3.1.html#bnf
*
* This is JPA BNF for JPQL. There are gaps and inconsistencies in the BNF itself, explained by other fragments of the spec.
*
* @see https://github.com/jakartaee/persistence/blob/master/spec/src/main/asciidoc/ch04-query-language.adoc#bnf
* @author Greg Turnquist
* @author Christoph Strobl
* @since 3.1
*/
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
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", "this-escape"})
public class JpqlLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, WS=16, ABS=17,
ALL=18, AND=19, ANY=20, AS=21, ASC=22, AVG=23, BETWEEN=24, BOTH=25, BY=26,
CASE=27, CEILING=28, COALESCE=29, CONCAT=30, COUNT=31, CURRENT_DATE=32,
CURRENT_TIME=33, CURRENT_TIMESTAMP=34, DATE=35, DATETIME=36, DELETE=37,
DESC=38, DISTINCT=39, END=40, ELSE=41, EMPTY=42, ENTRY=43, ESCAPE=44,
EXISTS=45, EXP=46, EXTRACT=47, FALSE=48, FETCH=49, FLOOR=50, FROM=51,
FUNCTION=52, GROUP=53, HAVING=54, IN=55, INDEX=56, INNER=57, IS=58, JOIN=59,
KEY=60, LEADING=61, LEFT=62, LENGTH=63, LIKE=64, LN=65, LOCAL=66, LOCATE=67,
LOWER=68, MAX=69, MEMBER=70, MIN=71, MOD=72, NEW=73, NOT=74, NULL=75,
NULLIF=76, OBJECT=77, OF=78, ON=79, OR=80, ORDER=81, OUTER=82, POWER=83,
ROUND=84, SELECT=85, SET=86, SIGN=87, SIZE=88, SOME=89, SQRT=90, SUBSTRING=91,
SUM=92, THEN=93, TIME=94, TRAILING=95, TREAT=96, TRIM=97, TRUE=98, TYPE=99,
UPDATE=100, UPPER=101, VALUE=102, WHEN=103, WHERE=104, EQUAL=105, NOT_EQUAL=106,
CHARACTER=107, IDENTIFICATION_VARIABLE=108, STRINGLITERAL=109, JAVASTRINGLITERAL=110,
FLOATLITERAL=111, INTLITERAL=112, LONGLITERAL=113, SPEL=114;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
public static String[] modeNames = {
"DEFAULT_MODE"
};
private static String[] makeRuleNames() {
return new String[] {
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "WS", "A", "B",
"C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "ABS", "ALL", "AND",
"ANY", "AS", "ASC", "AVG", "BETWEEN", "BOTH", "BY", "CASE", "CEILING",
"COALESCE", "CONCAT", "COUNT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
"DATE", "DATETIME", "DELETE", "DESC", "DISTINCT", "END", "ELSE", "EMPTY",
"ENTRY", "ESCAPE", "EXISTS", "EXP", "EXTRACT", "FALSE", "FETCH", "FLOOR",
"FROM", "FUNCTION", "GROUP", "HAVING", "IN", "INDEX", "INNER", "IS",
"JOIN", "KEY", "LEADING", "LEFT", "LENGTH", "LIKE", "LN", "LOCAL", "LOCATE",
"LOWER", "MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "NULLIF",
"OBJECT", "OF", "ON", "OR", "ORDER", "OUTER", "POWER", "ROUND", "SELECT",
"SET", "SIGN", "SIZE", "SOME", "SQRT", "SUBSTRING", "SUM", "THEN", "TIME",
"TRAILING", "TREAT", "TRIM", "TRUE", "TYPE", "UPDATE", "UPPER", "VALUE",
"WHEN", "WHERE", "EQUAL", "NOT_EQUAL", "CHARACTER", "IDENTIFICATION_VARIABLE",
"STRINGLITERAL", "JAVASTRINGLITERAL", "FLOATLITERAL", "INTLITERAL", "LONGLITERAL",
"SPEL"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "','", "'('", "')'", "'.'", "'>'", "'>='", "'<'", "'<='", "'+'",
"'-'", "'*'", "'/'", "':'", "'?'", "'%'", null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
"'='"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, "WS", "ABS", "ALL", "AND", "ANY", "AS", "ASC",
"AVG", "BETWEEN", "BOTH", "BY", "CASE", "CEILING", "COALESCE", "CONCAT",
"COUNT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATE",
"DATETIME", "DELETE", "DESC", "DISTINCT", "END", "ELSE", "EMPTY", "ENTRY",
"ESCAPE", "EXISTS", "EXP", "EXTRACT", "FALSE", "FETCH", "FLOOR", "FROM",
"FUNCTION", "GROUP", "HAVING", "IN", "INDEX", "INNER", "IS", "JOIN",
"KEY", "LEADING", "LEFT", "LENGTH", "LIKE", "LN", "LOCAL", "LOCATE",
"LOWER", "MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "NULLIF",
"OBJECT", "OF", "ON", "OR", "ORDER", "OUTER", "POWER", "ROUND", "SELECT",
"SET", "SIGN", "SIZE", "SOME", "SQRT", "SUBSTRING", "SUM", "THEN", "TIME",
"TRAILING", "TREAT", "TRIM", "TRUE", "TYPE", "UPDATE", "UPPER", "VALUE",
"WHEN", "WHERE", "EQUAL", "NOT_EQUAL", "CHARACTER", "IDENTIFICATION_VARIABLE",
"STRINGLITERAL", "JAVASTRINGLITERAL", "FLOATLITERAL", "INTLITERAL", "LONGLITERAL",
"SPEL"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public JpqlLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Jpql.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getChannelNames() { return channelNames; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\u0004\u0000r\u03ce\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
"\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
"\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
"\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002"+
"\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002"+
"\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002"+
"\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002"+
"\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
"\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
"\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
"!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007"+
"&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007"+
"+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u0007"+
"0\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u0007"+
"5\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0002:\u0007"+
":\u0002;\u0007;\u0002<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007"+
"?\u0002@\u0007@\u0002A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007"+
"D\u0002E\u0007E\u0002F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007"+
"I\u0002J\u0007J\u0002K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007"+
"N\u0002O\u0007O\u0002P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007"+
"S\u0002T\u0007T\u0002U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002X\u0007"+
"X\u0002Y\u0007Y\u0002Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002]\u0007"+
"]\u0002^\u0007^\u0002_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002b\u0007"+
"b\u0002c\u0007c\u0002d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002g\u0007"+
"g\u0002h\u0007h\u0002i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002l\u0007"+
"l\u0002m\u0007m\u0002n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002q\u0007"+
"q\u0002r\u0007r\u0002s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002v\u0007"+
"v\u0002w\u0007w\u0002x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002{\u0007"+
"{\u0002|\u0007|\u0002}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f\u0002"+
"\u0080\u0007\u0080\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082\u0002"+
"\u0083\u0007\u0083\u0002\u0084\u0007\u0084\u0002\u0085\u0007\u0085\u0002"+
"\u0086\u0007\u0086\u0002\u0087\u0007\u0087\u0002\u0088\u0007\u0088\u0002"+
"\u0089\u0007\u0089\u0002\u008a\u0007\u008a\u0002\u008b\u0007\u008b\u0001"+
"\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001"+
"\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001"+
"\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001"+
"\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001"+
"\f\u0001\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f"+
"\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+
"\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014"+
"\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017"+
"\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a"+
"\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d"+
"\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001!"+
"\u0001!\u0001\"\u0001\"\u0001#\u0001#\u0001$\u0001$\u0001%\u0001%\u0001"+
"&\u0001&\u0001\'\u0001\'\u0001(\u0001(\u0001)\u0001)\u0001*\u0001*\u0001"+
"*\u0001*\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001,\u0001,\u0001"+
"-\u0001-\u0001-\u0001-\u0001.\u0001.\u0001.\u0001/\u0001/\u0001/\u0001"+
"/\u00010\u00010\u00010\u00010\u00011\u00011\u00011\u00011\u00011\u0001"+
"1\u00011\u00011\u00012\u00012\u00012\u00012\u00012\u00013\u00013\u0001"+
"3\u00014\u00014\u00014\u00014\u00014\u00015\u00015\u00015\u00015\u0001"+
"5\u00015\u00015\u00015\u00016\u00016\u00016\u00016\u00016\u00016\u0001"+
"6\u00016\u00016\u00017\u00017\u00017\u00017\u00017\u00017\u00017\u0001"+
"8\u00018\u00018\u00018\u00018\u00018\u00019\u00019\u00019\u00019\u0001"+
"9\u00019\u00019\u00019\u00019\u00019\u00019\u00019\u00019\u0001:\u0001"+
":\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001"+
":\u0001:\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001"+
";\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001"+
"<\u0001<\u0001<\u0001<\u0001<\u0001=\u0001=\u0001=\u0001=\u0001=\u0001"+
"=\u0001=\u0001=\u0001=\u0001>\u0001>\u0001>\u0001>\u0001>\u0001>\u0001"+
">\u0001?\u0001?\u0001?\u0001?\u0001?\u0001@\u0001@\u0001@\u0001@\u0001"+
"@\u0001@\u0001@\u0001@\u0001@\u0001A\u0001A\u0001A\u0001A\u0001B\u0001"+
"B\u0001B\u0001B\u0001B\u0001C\u0001C\u0001C\u0001C\u0001C\u0001C\u0001"+
"D\u0001D\u0001D\u0001D\u0001D\u0001D\u0001E\u0001E\u0001E\u0001E\u0001"+
"E\u0001E\u0001E\u0001F\u0001F\u0001F\u0001F\u0001F\u0001F\u0001F\u0001"+
"G\u0001G\u0001G\u0001G\u0001H\u0001H\u0001H\u0001H\u0001H\u0001H\u0001"+
"H\u0001H\u0001I\u0001I\u0001I\u0001I\u0001I\u0001I\u0001J\u0001J\u0001"+
"J\u0001J\u0001J\u0001J\u0001K\u0001K\u0001K\u0001K\u0001K\u0001K\u0001"+
"L\u0001L\u0001L\u0001L\u0001L\u0001M\u0001M\u0001M\u0001M\u0001M\u0001"+
"M\u0001M\u0001M\u0001M\u0001N\u0001N\u0001N\u0001N\u0001N\u0001N\u0001"+
"O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001O\u0001P\u0001P\u0001P\u0001"+
"Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001Q\u0001R\u0001R\u0001R\u0001R\u0001"+
"R\u0001R\u0001S\u0001S\u0001S\u0001T\u0001T\u0001T\u0001T\u0001T\u0001"+
"U\u0001U\u0001U\u0001U\u0001V\u0001V\u0001V\u0001V\u0001V\u0001V\u0001"+
"V\u0001V\u0001W\u0001W\u0001W\u0001W\u0001W\u0001X\u0001X\u0001X\u0001"+
"X\u0001X\u0001X\u0001X\u0001Y\u0001Y\u0001Y\u0001Y\u0001Y\u0001Z\u0001"+
"Z\u0001Z\u0001[\u0001[\u0001[\u0001[\u0001[\u0001[\u0001\\\u0001\\\u0001"+
"\\\u0001\\\u0001\\\u0001\\\u0001\\\u0001]\u0001]\u0001]\u0001]\u0001]"+
"\u0001]\u0001^\u0001^\u0001^\u0001^\u0001_\u0001_\u0001_\u0001_\u0001"+
"_\u0001_\u0001_\u0001`\u0001`\u0001`\u0001`\u0001a\u0001a\u0001a\u0001"+
"a\u0001b\u0001b\u0001b\u0001b\u0001c\u0001c\u0001c\u0001c\u0001d\u0001"+
"d\u0001d\u0001d\u0001d\u0001e\u0001e\u0001e\u0001e\u0001e\u0001e\u0001"+
"e\u0001f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001f\u0001g\u0001g\u0001"+
"g\u0001h\u0001h\u0001h\u0001i\u0001i\u0001i\u0001j\u0001j\u0001j\u0001"+
"j\u0001j\u0001j\u0001k\u0001k\u0001k\u0001k\u0001k\u0001k\u0001l\u0001"+
"l\u0001l\u0001l\u0001l\u0001l\u0001m\u0001m\u0001m\u0001m\u0001m\u0001"+
"m\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001n\u0001o\u0001o\u0001"+
"o\u0001o\u0001p\u0001p\u0001p\u0001p\u0001p\u0001q\u0001q\u0001q\u0001"+
"q\u0001q\u0001r\u0001r\u0001r\u0001r\u0001r\u0001s\u0001s\u0001s\u0001"+
"s\u0001s\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001"+
"t\u0001t\u0001u\u0001u\u0001u\u0001u\u0001v\u0001v\u0001v\u0001v\u0001"+
"v\u0001w\u0001w\u0001w\u0001w\u0001w\u0001x\u0001x\u0001x\u0001x\u0001"+
"x\u0001x\u0001x\u0001x\u0001x\u0001y\u0001y\u0001y\u0001y\u0001y\u0001"+
"y\u0001z\u0001z\u0001z\u0001z\u0001z\u0001{\u0001{\u0001{\u0001{\u0001"+
"{\u0001|\u0001|\u0001|\u0001|\u0001|\u0001}\u0001}\u0001}\u0001}\u0001"+
"}\u0001}\u0001}\u0001~\u0001~\u0001~\u0001~\u0001~\u0001~\u0001\u007f"+
"\u0001\u007f\u0001\u007f\u0001\u007f\u0001\u007f\u0001\u007f\u0001\u0080"+
"\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0081\u0001\u0081"+
"\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0082\u0001\u0082"+
"\u0001\u0083\u0001\u0083\u0001\u0083\u0001\u0083\u0003\u0083\u037d\b\u0083"+
"\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0084\u0001\u0085\u0001\u0085"+
"\u0005\u0085\u0385\b\u0085\n\u0085\f\u0085\u0388\t\u0085\u0001\u0086\u0001"+
"\u0086\u0005\u0086\u038c\b\u0086\n\u0086\f\u0086\u038f\t\u0086\u0001\u0086"+
"\u0001\u0086\u0001\u0087\u0001\u0087\u0001\u0087\u0001\u0087\u0005\u0087"+
"\u0397\b\u0087\n\u0087\f\u0087\u039a\t\u0087\u0001\u0087\u0001\u0087\u0001"+
"\u0088\u0005\u0088\u039f\b\u0088\n\u0088\f\u0088\u03a2\t\u0088\u0001\u0088"+
"\u0001\u0088\u0004\u0088\u03a6\b\u0088\u000b\u0088\f\u0088\u03a7\u0001"+
"\u0088\u0001\u0088\u0004\u0088\u03ac\b\u0088\u000b\u0088\f\u0088\u03ad"+
"\u0005\u0088\u03b0\b\u0088\n\u0088\f\u0088\u03b3\t\u0088\u0001\u0088\u0001"+
"\u0088\u0003\u0088\u03b7\b\u0088\u0001\u0089\u0004\u0089\u03ba\b\u0089"+
"\u000b\u0089\f\u0089\u03bb\u0001\u008a\u0004\u008a\u03bf\b\u008a\u000b"+
"\u008a\f\u008a\u03c0\u0001\u008a\u0001\u008a\u0001\u008b\u0001\u008b\u0001"+
"\u008b\u0005\u008b\u03c8\b\u008b\n\u008b\f\u008b\u03cb\t\u008b\u0001\u008b"+
"\u0001\u008b\u0001\u03c9\u0000\u008c\u0001\u0001\u0003\u0002\u0005\u0003"+
"\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015"+
"\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0000#\u0000"+
"%\u0000\'\u0000)\u0000+\u0000-\u0000/\u00001\u00003\u00005\u00007\u0000"+
"9\u0000;\u0000=\u0000?\u0000A\u0000C\u0000E\u0000G\u0000I\u0000K\u0000"+
"M\u0000O\u0000Q\u0000S\u0000U\u0011W\u0012Y\u0013[\u0014]\u0015_\u0016"+
"a\u0017c\u0018e\u0019g\u001ai\u001bk\u001cm\u001do\u001eq\u001fs u!w\""+
"y#{$}%\u007f&\u0081\'\u0083(\u0085)\u0087*\u0089+\u008b,\u008d-\u008f"+
".\u0091/\u00930\u00951\u00972\u00993\u009b4\u009d5\u009f6\u00a17\u00a3"+
"8\u00a59\u00a7:\u00a9;\u00ab<\u00ad=\u00af>\u00b1?\u00b3@\u00b5A\u00b7"+
"B\u00b9C\u00bbD\u00bdE\u00bfF\u00c1G\u00c3H\u00c5I\u00c7J\u00c9K\u00cb"+
"L\u00cdM\u00cfN\u00d1O\u00d3P\u00d5Q\u00d7R\u00d9S\u00dbT\u00ddU\u00df"+
"V\u00e1W\u00e3X\u00e5Y\u00e7Z\u00e9[\u00eb\\\u00ed]\u00ef^\u00f1_\u00f3"+
"`\u00f5a\u00f7b\u00f9c\u00fbd\u00fde\u00fff\u0101g\u0103h\u0105i\u0107"+
"j\u0109k\u010bl\u010dm\u010fn\u0111o\u0113p\u0115q\u0117r\u0001\u0000"+
" \u0003\u0000\t\n\r\r \u0002\u0000AAaa\u0002\u0000BBbb\u0002\u0000CC"+
"cc\u0002\u0000DDdd\u0002\u0000EEee\u0002\u0000FFff\u0002\u0000GGgg\u0002"+
"\u0000HHhh\u0002\u0000IIii\u0002\u0000JJjj\u0002\u0000KKkk\u0002\u0000"+
"LLll\u0002\u0000MMmm\u0002\u0000NNnn\u0002\u0000OOoo\u0002\u0000PPpp\u0002"+
"\u0000QQqq\u0002\u0000RRrr\u0002\u0000SSss\u0002\u0000TTtt\u0002\u0000"+
"UUuu\u0002\u0000VVvv\u0002\u0000WWww\u0002\u0000XXxx\u0002\u0000YYyy\u0002"+
"\u0000ZZzz\u0002\u0000\'\'\\\\\u0005\u0000$$AZ__az\u0080\u8000\ufffe\u0006"+
"\u0000$$09AZ__az\u0080\u8000\ufffe\u0007\u0000\"\"\'\'bbffnnrrtt\u0001"+
"\u0000\"\"\u03c1\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001"+
"\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001"+
"\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000"+
"\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000"+
"\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000"+
"\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000"+
"\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000"+
"\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000"+
"\u0000\u0000U\u0001\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000"+
"Y\u0001\u0000\u0000\u0000\u0000[\u0001\u0000\u0000\u0000\u0000]\u0001"+
"\u0000\u0000\u0000\u0000_\u0001\u0000\u0000\u0000\u0000a\u0001\u0000\u0000"+
"\u0000\u0000c\u0001\u0000\u0000\u0000\u0000e\u0001\u0000\u0000\u0000\u0000"+
"g\u0001\u0000\u0000\u0000\u0000i\u0001\u0000\u0000\u0000\u0000k\u0001"+
"\u0000\u0000\u0000\u0000m\u0001\u0000\u0000\u0000\u0000o\u0001\u0000\u0000"+
"\u0000\u0000q\u0001\u0000\u0000\u0000\u0000s\u0001\u0000\u0000\u0000\u0000"+
"u\u0001\u0000\u0000\u0000\u0000w\u0001\u0000\u0000\u0000\u0000y\u0001"+
"\u0000\u0000\u0000\u0000{\u0001\u0000\u0000\u0000\u0000}\u0001\u0000\u0000"+
"\u0000\u0000\u007f\u0001\u0000\u0000\u0000\u0000\u0081\u0001\u0000\u0000"+
"\u0000\u0000\u0083\u0001\u0000\u0000\u0000\u0000\u0085\u0001\u0000\u0000"+
"\u0000\u0000\u0087\u0001\u0000\u0000\u0000\u0000\u0089\u0001\u0000\u0000"+
"\u0000\u0000\u008b\u0001\u0000\u0000\u0000\u0000\u008d\u0001\u0000\u0000"+
"\u0000\u0000\u008f\u0001\u0000\u0000\u0000\u0000\u0091\u0001\u0000\u0000"+
"\u0000\u0000\u0093\u0001\u0000\u0000\u0000\u0000\u0095\u0001\u0000\u0000"+
"\u0000\u0000\u0097\u0001\u0000\u0000\u0000\u0000\u0099\u0001\u0000\u0000"+
"\u0000\u0000\u009b\u0001\u0000\u0000\u0000\u0000\u009d\u0001\u0000\u0000"+
"\u0000\u0000\u009f\u0001\u0000\u0000\u0000\u0000\u00a1\u0001\u0000\u0000"+
"\u0000\u0000\u00a3\u0001\u0000\u0000\u0000\u0000\u00a5\u0001\u0000\u0000"+
"\u0000\u0000\u00a7\u0001\u0000\u0000\u0000\u0000\u00a9\u0001\u0000\u0000"+
"\u0000\u0000\u00ab\u0001\u0000\u0000\u0000\u0000\u00ad\u0001\u0000\u0000"+
"\u0000\u0000\u00af\u0001\u0000\u0000\u0000\u0000\u00b1\u0001\u0000\u0000"+
"\u0000\u0000\u00b3\u0001\u0000\u0000\u0000\u0000\u00b5\u0001\u0000\u0000"+
"\u0000\u0000\u00b7\u0001\u0000\u0000\u0000\u0000\u00b9\u0001\u0000\u0000"+
"\u0000\u0000\u00bb\u0001\u0000\u0000\u0000\u0000\u00bd\u0001\u0000\u0000"+
"\u0000\u0000\u00bf\u0001\u0000\u0000\u0000\u0000\u00c1\u0001\u0000\u0000"+
"\u0000\u0000\u00c3\u0001\u0000\u0000\u0000\u0000\u00c5\u0001\u0000\u0000"+
"\u0000\u0000\u00c7\u0001\u0000\u0000\u0000\u0000\u00c9\u0001\u0000\u0000"+
"\u0000\u0000\u00cb\u0001\u0000\u0000\u0000\u0000\u00cd\u0001\u0000\u0000"+
"\u0000\u0000\u00cf\u0001\u0000\u0000\u0000\u0000\u00d1\u0001\u0000\u0000"+
"\u0000\u0000\u00d3\u0001\u0000\u0000\u0000\u0000\u00d5\u0001\u0000\u0000"+
"\u0000\u0000\u00d7\u0001\u0000\u0000\u0000\u0000\u00d9\u0001\u0000\u0000"+
"\u0000\u0000\u00db\u0001\u0000\u0000\u0000\u0000\u00dd\u0001\u0000\u0000"+
"\u0000\u0000\u00df\u0001\u0000\u0000\u0000\u0000\u00e1\u0001\u0000\u0000"+
"\u0000\u0000\u00e3\u0001\u0000\u0000\u0000\u0000\u00e5\u0001\u0000\u0000"+
"\u0000\u0000\u00e7\u0001\u0000\u0000\u0000\u0000\u00e9\u0001\u0000\u0000"+
"\u0000\u0000\u00eb\u0001\u0000\u0000\u0000\u0000\u00ed\u0001\u0000\u0000"+
"\u0000\u0000\u00ef\u0001\u0000\u0000\u0000\u0000\u00f1\u0001\u0000\u0000"+
"\u0000\u0000\u00f3\u0001\u0000\u0000\u0000\u0000\u00f5\u0001\u0000\u0000"+
"\u0000\u0000\u00f7\u0001\u0000\u0000\u0000\u0000\u00f9\u0001\u0000\u0000"+
"\u0000\u0000\u00fb\u0001\u0000\u0000\u0000\u0000\u00fd\u0001\u0000\u0000"+
"\u0000\u0000\u00ff\u0001\u0000\u0000\u0000\u0000\u0101\u0001\u0000\u0000"+
"\u0000\u0000\u0103\u0001\u0000\u0000\u0000\u0000\u0105\u0001\u0000\u0000"+
"\u0000\u0000\u0107\u0001\u0000\u0000\u0000\u0000\u0109\u0001\u0000\u0000"+
"\u0000\u0000\u010b\u0001\u0000\u0000\u0000\u0000\u010d\u0001\u0000\u0000"+
"\u0000\u0000\u010f\u0001\u0000\u0000\u0000\u0000\u0111\u0001\u0000\u0000"+
"\u0000\u0000\u0113\u0001\u0000\u0000\u0000\u0000\u0115\u0001\u0000\u0000"+
"\u0000\u0000\u0117\u0001\u0000\u0000\u0000\u0001\u0119\u0001\u0000\u0000"+
"\u0000\u0003\u011b\u0001\u0000\u0000\u0000\u0005\u011d\u0001\u0000\u0000"+
"\u0000\u0007\u011f\u0001\u0000\u0000\u0000\t\u0121\u0001\u0000\u0000\u0000"+
"\u000b\u0123\u0001\u0000\u0000\u0000\r\u0126\u0001\u0000\u0000\u0000\u000f"+
"\u0128\u0001\u0000\u0000\u0000\u0011\u012b\u0001\u0000\u0000\u0000\u0013"+
"\u012d\u0001\u0000\u0000\u0000\u0015\u012f\u0001\u0000\u0000\u0000\u0017"+
"\u0131\u0001\u0000\u0000\u0000\u0019\u0133\u0001\u0000\u0000\u0000\u001b"+
"\u0135\u0001\u0000\u0000\u0000\u001d\u0137\u0001\u0000\u0000\u0000\u001f"+
"\u0139\u0001\u0000\u0000\u0000!\u013d\u0001\u0000\u0000\u0000#\u013f\u0001"+
"\u0000\u0000\u0000%\u0141\u0001\u0000\u0000\u0000\'\u0143\u0001\u0000"+
"\u0000\u0000)\u0145\u0001\u0000\u0000\u0000+\u0147\u0001\u0000\u0000\u0000"+
"-\u0149\u0001\u0000\u0000\u0000/\u014b\u0001\u0000\u0000\u00001\u014d"+
"\u0001\u0000\u0000\u00003\u014f\u0001\u0000\u0000\u00005\u0151\u0001\u0000"+
"\u0000\u00007\u0153\u0001\u0000\u0000\u00009\u0155\u0001\u0000\u0000\u0000"+
";\u0157\u0001\u0000\u0000\u0000=\u0159\u0001\u0000\u0000\u0000?\u015b"+
"\u0001\u0000\u0000\u0000A\u015d\u0001\u0000\u0000\u0000C\u015f\u0001\u0000"+
"\u0000\u0000E\u0161\u0001\u0000\u0000\u0000G\u0163\u0001\u0000\u0000\u0000"+
"I\u0165\u0001\u0000\u0000\u0000K\u0167\u0001\u0000\u0000\u0000M\u0169"+
"\u0001\u0000\u0000\u0000O\u016b\u0001\u0000\u0000\u0000Q\u016d\u0001\u0000"+
"\u0000\u0000S\u016f\u0001\u0000\u0000\u0000U\u0171\u0001\u0000\u0000\u0000"+
"W\u0175\u0001\u0000\u0000\u0000Y\u0179\u0001\u0000\u0000\u0000[\u017d"+
"\u0001\u0000\u0000\u0000]\u0181\u0001\u0000\u0000\u0000_\u0184\u0001\u0000"+
"\u0000\u0000a\u0188\u0001\u0000\u0000\u0000c\u018c\u0001\u0000\u0000\u0000"+
"e\u0194\u0001\u0000\u0000\u0000g\u0199\u0001\u0000\u0000\u0000i\u019c"+
"\u0001\u0000\u0000\u0000k\u01a1\u0001\u0000\u0000\u0000m\u01a9\u0001\u0000"+
"\u0000\u0000o\u01b2\u0001\u0000\u0000\u0000q\u01b9\u0001\u0000\u0000\u0000"+
"s\u01bf\u0001\u0000\u0000\u0000u\u01cc\u0001\u0000\u0000\u0000w\u01d9"+
"\u0001\u0000\u0000\u0000y\u01eb\u0001\u0000\u0000\u0000{\u01f0\u0001\u0000"+
"\u0000\u0000}\u01f9\u0001\u0000\u0000\u0000\u007f\u0200\u0001\u0000\u0000"+
"\u0000\u0081\u0205\u0001\u0000\u0000\u0000\u0083\u020e\u0001\u0000\u0000"+
"\u0000\u0085\u0212\u0001\u0000\u0000\u0000\u0087\u0217\u0001\u0000\u0000"+
"\u0000\u0089\u021d\u0001\u0000\u0000\u0000\u008b\u0223\u0001\u0000\u0000"+
"\u0000\u008d\u022a\u0001\u0000\u0000\u0000\u008f\u0231\u0001\u0000\u0000"+
"\u0000\u0091\u0235\u0001\u0000\u0000\u0000\u0093\u023d\u0001\u0000\u0000"+
"\u0000\u0095\u0243\u0001\u0000\u0000\u0000\u0097\u0249\u0001\u0000\u0000"+
"\u0000\u0099\u024f\u0001\u0000\u0000\u0000\u009b\u0254\u0001\u0000\u0000"+
"\u0000\u009d\u025d\u0001\u0000\u0000\u0000\u009f\u0263\u0001\u0000\u0000"+
"\u0000\u00a1\u026a\u0001\u0000\u0000\u0000\u00a3\u026d\u0001\u0000\u0000"+
"\u0000\u00a5\u0273\u0001\u0000\u0000\u0000\u00a7\u0279\u0001\u0000\u0000"+
"\u0000\u00a9\u027c\u0001\u0000\u0000\u0000\u00ab\u0281\u0001\u0000\u0000"+
"\u0000\u00ad\u0285\u0001\u0000\u0000\u0000\u00af\u028d\u0001\u0000\u0000"+
"\u0000\u00b1\u0292\u0001\u0000\u0000\u0000\u00b3\u0299\u0001\u0000\u0000"+
"\u0000\u00b5\u029e\u0001\u0000\u0000\u0000\u00b7\u02a1\u0001\u0000\u0000"+
"\u0000\u00b9\u02a7\u0001\u0000\u0000\u0000\u00bb\u02ae\u0001\u0000\u0000"+
"\u0000\u00bd\u02b4\u0001\u0000\u0000\u0000\u00bf\u02b8\u0001\u0000\u0000"+
"\u0000\u00c1\u02bf\u0001\u0000\u0000\u0000\u00c3\u02c3\u0001\u0000\u0000"+
"\u0000\u00c5\u02c7\u0001\u0000\u0000\u0000\u00c7\u02cb\u0001\u0000\u0000"+
"\u0000\u00c9\u02cf\u0001\u0000\u0000\u0000\u00cb\u02d4\u0001\u0000\u0000"+
"\u0000\u00cd\u02db\u0001\u0000\u0000\u0000\u00cf\u02e2\u0001\u0000\u0000"+
"\u0000\u00d1\u02e5\u0001\u0000\u0000\u0000\u00d3\u02e8\u0001\u0000\u0000"+
"\u0000\u00d5\u02eb\u0001\u0000\u0000\u0000\u00d7\u02f1\u0001\u0000\u0000"+
"\u0000\u00d9\u02f7\u0001\u0000\u0000\u0000\u00db\u02fd\u0001\u0000\u0000"+
"\u0000\u00dd\u0303\u0001\u0000\u0000\u0000\u00df\u030a\u0001\u0000\u0000"+
"\u0000\u00e1\u030e\u0001\u0000\u0000\u0000\u00e3\u0313\u0001\u0000\u0000"+
"\u0000\u00e5\u0318\u0001\u0000\u0000\u0000\u00e7\u031d\u0001\u0000\u0000"+
"\u0000\u00e9\u0322\u0001\u0000\u0000\u0000\u00eb\u032c\u0001\u0000\u0000"+
"\u0000\u00ed\u0330\u0001\u0000\u0000\u0000\u00ef\u0335\u0001\u0000\u0000"+
"\u0000\u00f1\u033a\u0001\u0000\u0000\u0000\u00f3\u0343\u0001\u0000\u0000"+
"\u0000\u00f5\u0349\u0001\u0000\u0000\u0000\u00f7\u034e\u0001\u0000\u0000"+
"\u0000\u00f9\u0353\u0001\u0000\u0000\u0000\u00fb\u0358\u0001\u0000\u0000"+
"\u0000\u00fd\u035f\u0001\u0000\u0000\u0000\u00ff\u0365\u0001\u0000\u0000"+
"\u0000\u0101\u036b\u0001\u0000\u0000\u0000\u0103\u0370\u0001\u0000\u0000"+
"\u0000\u0105\u0376\u0001\u0000\u0000\u0000\u0107\u037c\u0001\u0000\u0000"+
"\u0000\u0109\u037e\u0001\u0000\u0000\u0000\u010b\u0382\u0001\u0000\u0000"+
"\u0000\u010d\u0389\u0001\u0000\u0000\u0000\u010f\u0392\u0001\u0000\u0000"+
"\u0000\u0111\u03a0\u0001\u0000\u0000\u0000\u0113\u03b9\u0001\u0000\u0000"+
"\u0000\u0115\u03be\u0001\u0000\u0000\u0000\u0117\u03c4\u0001\u0000\u0000"+
"\u0000\u0119\u011a\u0005,\u0000\u0000\u011a\u0002\u0001\u0000\u0000\u0000"+
"\u011b\u011c\u0005(\u0000\u0000\u011c\u0004\u0001\u0000\u0000\u0000\u011d"+
"\u011e\u0005)\u0000\u0000\u011e\u0006\u0001\u0000\u0000\u0000\u011f\u0120"+
"\u0005.\u0000\u0000\u0120\b\u0001\u0000\u0000\u0000\u0121\u0122\u0005"+
">\u0000\u0000\u0122\n\u0001\u0000\u0000\u0000\u0123\u0124\u0005>\u0000"+
"\u0000\u0124\u0125\u0005=\u0000\u0000\u0125\f\u0001\u0000\u0000\u0000"+
"\u0126\u0127\u0005<\u0000\u0000\u0127\u000e\u0001\u0000\u0000\u0000\u0128"+
"\u0129\u0005<\u0000\u0000\u0129\u012a\u0005=\u0000\u0000\u012a\u0010\u0001"+
"\u0000\u0000\u0000\u012b\u012c\u0005+\u0000\u0000\u012c\u0012\u0001\u0000"+
"\u0000\u0000\u012d\u012e\u0005-\u0000\u0000\u012e\u0014\u0001\u0000\u0000"+
"\u0000\u012f\u0130\u0005*\u0000\u0000\u0130\u0016\u0001\u0000\u0000\u0000"+
"\u0131\u0132\u0005/\u0000\u0000\u0132\u0018\u0001\u0000\u0000\u0000\u0133"+
"\u0134\u0005:\u0000\u0000\u0134\u001a\u0001\u0000\u0000\u0000\u0135\u0136"+
"\u0005?\u0000\u0000\u0136\u001c\u0001\u0000\u0000\u0000\u0137\u0138\u0005"+
"%\u0000\u0000\u0138\u001e\u0001\u0000\u0000\u0000\u0139\u013a\u0007\u0000"+
"\u0000\u0000\u013a\u013b\u0001\u0000\u0000\u0000\u013b\u013c\u0006\u000f"+
"\u0000\u0000\u013c \u0001\u0000\u0000\u0000\u013d\u013e\u0007\u0001\u0000"+
"\u0000\u013e\"\u0001\u0000\u0000\u0000\u013f\u0140\u0007\u0002\u0000\u0000"+
"\u0140$\u0001\u0000\u0000\u0000\u0141\u0142\u0007\u0003\u0000\u0000\u0142"+
"&\u0001\u0000\u0000\u0000\u0143\u0144\u0007\u0004\u0000\u0000\u0144(\u0001"+
"\u0000\u0000\u0000\u0145\u0146\u0007\u0005\u0000\u0000\u0146*\u0001\u0000"+
"\u0000\u0000\u0147\u0148\u0007\u0006\u0000\u0000\u0148,\u0001\u0000\u0000"+
"\u0000\u0149\u014a\u0007\u0007\u0000\u0000\u014a.\u0001\u0000\u0000\u0000"+
"\u014b\u014c\u0007\b\u0000\u0000\u014c0\u0001\u0000\u0000\u0000\u014d"+
"\u014e\u0007\t\u0000\u0000\u014e2\u0001\u0000\u0000\u0000\u014f\u0150"+
"\u0007\n\u0000\u0000\u01504\u0001\u0000\u0000\u0000\u0151\u0152\u0007"+
"\u000b\u0000\u0000\u01526\u0001\u0000\u0000\u0000\u0153\u0154\u0007\f"+
"\u0000\u0000\u01548\u0001\u0000\u0000\u0000\u0155\u0156\u0007\r\u0000"+
"\u0000\u0156:\u0001\u0000\u0000\u0000\u0157\u0158\u0007\u000e\u0000\u0000"+
"\u0158<\u0001\u0000\u0000\u0000\u0159\u015a\u0007\u000f\u0000\u0000\u015a"+
">\u0001\u0000\u0000\u0000\u015b\u015c\u0007\u0010\u0000\u0000\u015c@\u0001"+
"\u0000\u0000\u0000\u015d\u015e\u0007\u0011\u0000\u0000\u015eB\u0001\u0000"+
"\u0000\u0000\u015f\u0160\u0007\u0012\u0000\u0000\u0160D\u0001\u0000\u0000"+
"\u0000\u0161\u0162\u0007\u0013\u0000\u0000\u0162F\u0001\u0000\u0000\u0000"+
"\u0163\u0164\u0007\u0014\u0000\u0000\u0164H\u0001\u0000\u0000\u0000\u0165"+
"\u0166\u0007\u0015\u0000\u0000\u0166J\u0001\u0000\u0000\u0000\u0167\u0168"+
"\u0007\u0016\u0000\u0000\u0168L\u0001\u0000\u0000\u0000\u0169\u016a\u0007"+
"\u0017\u0000\u0000\u016aN\u0001\u0000\u0000\u0000\u016b\u016c\u0007\u0018"+
"\u0000\u0000\u016cP\u0001\u0000\u0000\u0000\u016d\u016e\u0007\u0019\u0000"+
"\u0000\u016eR\u0001\u0000\u0000\u0000\u016f\u0170\u0007\u001a\u0000\u0000"+
"\u0170T\u0001\u0000\u0000\u0000\u0171\u0172\u0003!\u0010\u0000\u0172\u0173"+
"\u0003#\u0011\u0000\u0173\u0174\u0003E\"\u0000\u0174V\u0001\u0000\u0000"+
"\u0000\u0175\u0176\u0003!\u0010\u0000\u0176\u0177\u00037\u001b\u0000\u0177"+
"\u0178\u00037\u001b\u0000\u0178X\u0001\u0000\u0000\u0000\u0179\u017a\u0003"+
"!\u0010\u0000\u017a\u017b\u0003;\u001d\u0000\u017b\u017c\u0003\'\u0013"+
"\u0000\u017cZ\u0001\u0000\u0000\u0000\u017d\u017e\u0003!\u0010\u0000\u017e"+
"\u017f\u0003;\u001d\u0000\u017f\u0180\u0003Q(\u0000\u0180\\\u0001\u0000"+
"\u0000\u0000\u0181\u0182\u0003!\u0010\u0000\u0182\u0183\u0003E\"\u0000"+
"\u0183^\u0001\u0000\u0000\u0000\u0184\u0185\u0003!\u0010\u0000\u0185\u0186"+
"\u0003E\"\u0000\u0186\u0187\u0003%\u0012\u0000\u0187`\u0001\u0000\u0000"+
"\u0000\u0188\u0189\u0003!\u0010\u0000\u0189\u018a\u0003K%\u0000\u018a"+
"\u018b\u0003-\u0016\u0000\u018bb\u0001\u0000\u0000\u0000\u018c\u018d\u0003"+
"#\u0011\u0000\u018d\u018e\u0003)\u0014\u0000\u018e\u018f\u0003G#\u0000"+
"\u018f\u0190\u0003M&\u0000\u0190\u0191\u0003)\u0014\u0000\u0191\u0192"+
"\u0003)\u0014\u0000\u0192\u0193\u0003;\u001d\u0000\u0193d\u0001\u0000"+
"\u0000\u0000\u0194\u0195\u0003#\u0011\u0000\u0195\u0196\u0003=\u001e\u0000"+
"\u0196\u0197\u0003G#\u0000\u0197\u0198\u0003/\u0017\u0000\u0198f\u0001"+
"\u0000\u0000\u0000\u0199\u019a\u0003#\u0011\u0000\u019a\u019b\u0003Q("+
"\u0000\u019bh\u0001\u0000\u0000\u0000\u019c\u019d\u0003%\u0012\u0000\u019d"+
"\u019e\u0003!\u0010\u0000\u019e\u019f\u0003E\"\u0000\u019f\u01a0\u0003"+
")\u0014\u0000\u01a0j\u0001\u0000\u0000\u0000\u01a1\u01a2\u0003%\u0012"+
"\u0000\u01a2\u01a3\u0003)\u0014\u0000\u01a3\u01a4\u00031\u0018\u0000\u01a4"+
"\u01a5\u00037\u001b\u0000\u01a5\u01a6\u00031\u0018\u0000\u01a6\u01a7\u0003"+
";\u001d\u0000\u01a7\u01a8\u0003-\u0016\u0000\u01a8l\u0001\u0000\u0000"+
"\u0000\u01a9\u01aa\u0003%\u0012\u0000\u01aa\u01ab\u0003=\u001e\u0000\u01ab"+
"\u01ac\u0003!\u0010\u0000\u01ac\u01ad\u00037\u001b\u0000\u01ad\u01ae\u0003"+
")\u0014\u0000\u01ae\u01af\u0003E\"\u0000\u01af\u01b0\u0003%\u0012\u0000"+
"\u01b0\u01b1\u0003)\u0014\u0000\u01b1n\u0001\u0000\u0000\u0000\u01b2\u01b3"+
"\u0003%\u0012\u0000\u01b3\u01b4\u0003=\u001e\u0000\u01b4\u01b5\u0003;"+
"\u001d\u0000\u01b5\u01b6\u0003%\u0012\u0000\u01b6\u01b7\u0003!\u0010\u0000"+
"\u01b7\u01b8\u0003G#\u0000\u01b8p\u0001\u0000\u0000\u0000\u01b9\u01ba"+
"\u0003%\u0012\u0000\u01ba\u01bb\u0003=\u001e\u0000\u01bb\u01bc\u0003I"+
"$\u0000\u01bc\u01bd\u0003;\u001d\u0000\u01bd\u01be\u0003G#\u0000\u01be"+
"r\u0001\u0000\u0000\u0000\u01bf\u01c0\u0003%\u0012\u0000\u01c0\u01c1\u0003"+
"I$\u0000\u01c1\u01c2\u0003C!\u0000\u01c2\u01c3\u0003C!\u0000\u01c3\u01c4"+
"\u0003)\u0014\u0000\u01c4\u01c5\u0003;\u001d\u0000\u01c5\u01c6\u0003G"+
"#\u0000\u01c6\u01c7\u0005_\u0000\u0000\u01c7\u01c8\u0003\'\u0013\u0000"+
"\u01c8\u01c9\u0003!\u0010\u0000\u01c9\u01ca\u0003G#\u0000\u01ca\u01cb"+
"\u0003)\u0014\u0000\u01cbt\u0001\u0000\u0000\u0000\u01cc\u01cd\u0003%"+
"\u0012\u0000\u01cd\u01ce\u0003I$\u0000\u01ce\u01cf\u0003C!\u0000\u01cf"+
"\u01d0\u0003C!\u0000\u01d0\u01d1\u0003)\u0014\u0000\u01d1\u01d2\u0003"+
";\u001d\u0000\u01d2\u01d3\u0003G#\u0000\u01d3\u01d4\u0005_\u0000\u0000"+
"\u01d4\u01d5\u0003G#\u0000\u01d5\u01d6\u00031\u0018\u0000\u01d6\u01d7"+
"\u00039\u001c\u0000\u01d7\u01d8\u0003)\u0014\u0000\u01d8v\u0001\u0000"+
"\u0000\u0000\u01d9\u01da\u0003%\u0012\u0000\u01da\u01db\u0003I$\u0000"+
"\u01db\u01dc\u0003C!\u0000\u01dc\u01dd\u0003C!\u0000\u01dd\u01de\u0003"+
")\u0014\u0000\u01de\u01df\u0003;\u001d\u0000\u01df\u01e0\u0003G#\u0000"+
"\u01e0\u01e1\u0005_\u0000\u0000\u01e1\u01e2\u0003G#\u0000\u01e2\u01e3"+
"\u00031\u0018\u0000\u01e3\u01e4\u00039\u001c\u0000\u01e4\u01e5\u0003)"+
"\u0014\u0000\u01e5\u01e6\u0003E\"\u0000\u01e6\u01e7\u0003G#\u0000\u01e7"+
"\u01e8\u0003!\u0010\u0000\u01e8\u01e9\u00039\u001c\u0000\u01e9\u01ea\u0003"+
"?\u001f\u0000\u01eax\u0001\u0000\u0000\u0000\u01eb\u01ec\u0003\'\u0013"+
"\u0000\u01ec\u01ed\u0003!\u0010\u0000\u01ed\u01ee\u0003G#\u0000\u01ee"+
"\u01ef\u0003)\u0014\u0000\u01efz\u0001\u0000\u0000\u0000\u01f0\u01f1\u0003"+
"\'\u0013\u0000\u01f1\u01f2\u0003!\u0010\u0000\u01f2\u01f3\u0003G#\u0000"+
"\u01f3\u01f4\u0003)\u0014\u0000\u01f4\u01f5\u0003G#\u0000\u01f5\u01f6"+
"\u00031\u0018\u0000\u01f6\u01f7\u00039\u001c\u0000\u01f7\u01f8\u0003)"+
"\u0014\u0000\u01f8|\u0001\u0000\u0000\u0000\u01f9\u01fa\u0003\'\u0013"+
"\u0000\u01fa\u01fb\u0003)\u0014\u0000\u01fb\u01fc\u00037\u001b\u0000\u01fc"+
"\u01fd\u0003)\u0014\u0000\u01fd\u01fe\u0003G#\u0000\u01fe\u01ff\u0003"+
")\u0014\u0000\u01ff~\u0001\u0000\u0000\u0000\u0200\u0201\u0003\'\u0013"+
"\u0000\u0201\u0202\u0003)\u0014\u0000\u0202\u0203\u0003E\"\u0000\u0203"+
"\u0204\u0003%\u0012\u0000\u0204\u0080\u0001\u0000\u0000\u0000\u0205\u0206"+
"\u0003\'\u0013\u0000\u0206\u0207\u00031\u0018\u0000\u0207\u0208\u0003"+
"E\"\u0000\u0208\u0209\u0003G#\u0000\u0209\u020a\u00031\u0018\u0000\u020a"+
"\u020b\u0003;\u001d\u0000\u020b\u020c\u0003%\u0012\u0000\u020c\u020d\u0003"+
"G#\u0000\u020d\u0082\u0001\u0000\u0000\u0000\u020e\u020f\u0003)\u0014"+
"\u0000\u020f\u0210\u0003;\u001d\u0000\u0210\u0211\u0003\'\u0013\u0000"+
"\u0211\u0084\u0001\u0000\u0000\u0000\u0212\u0213\u0003)\u0014\u0000\u0213"+
"\u0214\u00037\u001b\u0000\u0214\u0215\u0003E\"\u0000\u0215\u0216\u0003"+
")\u0014\u0000\u0216\u0086\u0001\u0000\u0000\u0000\u0217\u0218\u0003)\u0014"+
"\u0000\u0218\u0219\u00039\u001c\u0000\u0219\u021a\u0003?\u001f\u0000\u021a"+
"\u021b\u0003G#\u0000\u021b\u021c\u0003Q(\u0000\u021c\u0088\u0001\u0000"+
"\u0000\u0000\u021d\u021e\u0003)\u0014\u0000\u021e\u021f\u0003;\u001d\u0000"+
"\u021f\u0220\u0003G#\u0000\u0220\u0221\u0003C!\u0000\u0221\u0222\u0003"+
"Q(\u0000\u0222\u008a\u0001\u0000\u0000\u0000\u0223\u0224\u0003)\u0014"+
"\u0000\u0224\u0225\u0003E\"\u0000\u0225\u0226\u0003%\u0012\u0000\u0226"+
"\u0227\u0003!\u0010\u0000\u0227\u0228\u0003?\u001f\u0000\u0228\u0229\u0003"+
")\u0014\u0000\u0229\u008c\u0001\u0000\u0000\u0000\u022a\u022b\u0003)\u0014"+
"\u0000\u022b\u022c\u0003O\'\u0000\u022c\u022d\u00031\u0018\u0000\u022d"+
"\u022e\u0003E\"\u0000\u022e\u022f\u0003G#\u0000\u022f\u0230\u0003E\"\u0000"+
"\u0230\u008e\u0001\u0000\u0000\u0000\u0231\u0232\u0003)\u0014\u0000\u0232"+
"\u0233\u0003O\'\u0000\u0233\u0234\u0003?\u001f\u0000\u0234\u0090\u0001"+
"\u0000\u0000\u0000\u0235\u0236\u0003)\u0014\u0000\u0236\u0237\u0003O\'"+
"\u0000\u0237\u0238\u0003G#\u0000\u0238\u0239\u0003C!\u0000\u0239\u023a"+
"\u0003!\u0010\u0000\u023a\u023b\u0003%\u0012\u0000\u023b\u023c\u0003G"+
"#\u0000\u023c\u0092\u0001\u0000\u0000\u0000\u023d\u023e\u0003+\u0015\u0000"+
"\u023e\u023f\u0003!\u0010\u0000\u023f\u0240\u00037\u001b\u0000\u0240\u0241"+
"\u0003E\"\u0000\u0241\u0242\u0003)\u0014\u0000\u0242\u0094\u0001\u0000"+
"\u0000\u0000\u0243\u0244\u0003+\u0015\u0000\u0244\u0245\u0003)\u0014\u0000"+
"\u0245\u0246\u0003G#\u0000\u0246\u0247\u0003%\u0012\u0000\u0247\u0248"+
"\u0003/\u0017\u0000\u0248\u0096\u0001\u0000\u0000\u0000\u0249\u024a\u0003"+
"+\u0015\u0000\u024a\u024b\u00037\u001b\u0000\u024b\u024c\u0003=\u001e"+
"\u0000\u024c\u024d\u0003=\u001e\u0000\u024d\u024e\u0003C!\u0000\u024e"+
"\u0098\u0001\u0000\u0000\u0000\u024f\u0250\u0003+\u0015\u0000\u0250\u0251"+
"\u0003C!\u0000\u0251\u0252\u0003=\u001e\u0000\u0252\u0253\u00039\u001c"+
"\u0000\u0253\u009a\u0001\u0000\u0000\u0000\u0254\u0255\u0003+\u0015\u0000"+
"\u0255\u0256\u0003I$\u0000\u0256\u0257\u0003;\u001d\u0000\u0257\u0258"+
"\u0003%\u0012\u0000\u0258\u0259\u0003G#\u0000\u0259\u025a\u00031\u0018"+
"\u0000\u025a\u025b\u0003=\u001e\u0000\u025b\u025c\u0003;\u001d\u0000\u025c"+
"\u009c\u0001\u0000\u0000\u0000\u025d\u025e\u0003-\u0016\u0000\u025e\u025f"+
"\u0003C!\u0000\u025f\u0260\u0003=\u001e\u0000\u0260\u0261\u0003I$\u0000"+
"\u0261\u0262\u0003?\u001f\u0000\u0262\u009e\u0001\u0000\u0000\u0000\u0263"+
"\u0264\u0003/\u0017\u0000\u0264\u0265\u0003!\u0010\u0000\u0265\u0266\u0003"+
"K%\u0000\u0266\u0267\u00031\u0018\u0000\u0267\u0268\u0003;\u001d\u0000"+
"\u0268\u0269\u0003-\u0016\u0000\u0269\u00a0\u0001\u0000\u0000\u0000\u026a"+
"\u026b\u00031\u0018\u0000\u026b\u026c\u0003;\u001d\u0000\u026c\u00a2\u0001"+
"\u0000\u0000\u0000\u026d\u026e\u00031\u0018\u0000\u026e\u026f\u0003;\u001d"+
"\u0000\u026f\u0270\u0003\'\u0013\u0000\u0270\u0271\u0003)\u0014\u0000"+
"\u0271\u0272\u0003O\'\u0000\u0272\u00a4\u0001\u0000\u0000\u0000\u0273"+
"\u0274\u00031\u0018\u0000\u0274\u0275\u0003;\u001d\u0000\u0275\u0276\u0003"+
";\u001d\u0000\u0276\u0277\u0003)\u0014\u0000\u0277\u0278\u0003C!\u0000"+
"\u0278\u00a6\u0001\u0000\u0000\u0000\u0279\u027a\u00031\u0018\u0000\u027a"+
"\u027b\u0003E\"\u0000\u027b\u00a8\u0001\u0000\u0000\u0000\u027c\u027d"+
"\u00033\u0019\u0000\u027d\u027e\u0003=\u001e\u0000\u027e\u027f\u00031"+
"\u0018\u0000\u027f\u0280\u0003;\u001d\u0000\u0280\u00aa\u0001\u0000\u0000"+
"\u0000\u0281\u0282\u00035\u001a\u0000\u0282\u0283\u0003)\u0014\u0000\u0283"+
"\u0284\u0003Q(\u0000\u0284\u00ac\u0001\u0000\u0000\u0000\u0285\u0286\u0003"+
"7\u001b\u0000\u0286\u0287\u0003)\u0014\u0000\u0287\u0288\u0003!\u0010"+
"\u0000\u0288\u0289\u0003\'\u0013\u0000\u0289\u028a\u00031\u0018\u0000"+
"\u028a\u028b\u0003;\u001d\u0000\u028b\u028c\u0003-\u0016\u0000\u028c\u00ae"+
"\u0001\u0000\u0000\u0000\u028d\u028e\u00037\u001b\u0000\u028e\u028f\u0003"+
")\u0014\u0000\u028f\u0290\u0003+\u0015\u0000\u0290\u0291\u0003G#\u0000"+
"\u0291\u00b0\u0001\u0000\u0000\u0000\u0292\u0293\u00037\u001b\u0000\u0293"+
"\u0294\u0003)\u0014\u0000\u0294\u0295\u0003;\u001d\u0000\u0295\u0296\u0003"+
"-\u0016\u0000\u0296\u0297\u0003G#\u0000\u0297\u0298\u0003/\u0017\u0000"+
"\u0298\u00b2\u0001\u0000\u0000\u0000\u0299\u029a\u00037\u001b\u0000\u029a"+
"\u029b\u00031\u0018\u0000\u029b\u029c\u00035\u001a\u0000\u029c\u029d\u0003"+
")\u0014\u0000\u029d\u00b4\u0001\u0000\u0000\u0000\u029e\u029f\u00037\u001b"+
"\u0000\u029f\u02a0\u0003;\u001d\u0000\u02a0\u00b6\u0001\u0000\u0000\u0000"+
"\u02a1\u02a2\u00037\u001b\u0000\u02a2\u02a3\u0003=\u001e\u0000\u02a3\u02a4"+
"\u0003%\u0012\u0000\u02a4\u02a5\u0003!\u0010\u0000\u02a5\u02a6\u00037"+
"\u001b\u0000\u02a6\u00b8\u0001\u0000\u0000\u0000\u02a7\u02a8\u00037\u001b"+
"\u0000\u02a8\u02a9\u0003=\u001e\u0000\u02a9\u02aa\u0003%\u0012\u0000\u02aa"+
"\u02ab\u0003!\u0010\u0000\u02ab\u02ac\u0003G#\u0000\u02ac\u02ad\u0003"+
")\u0014\u0000\u02ad\u00ba\u0001\u0000\u0000\u0000\u02ae\u02af\u00037\u001b"+
"\u0000\u02af\u02b0\u0003=\u001e\u0000\u02b0\u02b1\u0003M&\u0000\u02b1"+
"\u02b2\u0003)\u0014\u0000\u02b2\u02b3\u0003C!\u0000\u02b3\u00bc\u0001"+
"\u0000\u0000\u0000\u02b4\u02b5\u00039\u001c\u0000\u02b5\u02b6\u0003!\u0010"+
"\u0000\u02b6\u02b7\u0003O\'\u0000\u02b7\u00be\u0001\u0000\u0000\u0000"+
"\u02b8\u02b9\u00039\u001c\u0000\u02b9\u02ba\u0003)\u0014\u0000\u02ba\u02bb"+
"\u00039\u001c\u0000\u02bb\u02bc\u0003#\u0011\u0000\u02bc\u02bd\u0003)"+
"\u0014\u0000\u02bd\u02be\u0003C!\u0000\u02be\u00c0\u0001\u0000\u0000\u0000"+
"\u02bf\u02c0\u00039\u001c\u0000\u02c0\u02c1\u00031\u0018\u0000\u02c1\u02c2"+
"\u0003;\u001d\u0000\u02c2\u00c2\u0001\u0000\u0000\u0000\u02c3\u02c4\u0003"+
"9\u001c\u0000\u02c4\u02c5\u0003=\u001e\u0000\u02c5\u02c6\u0003\'\u0013"+
"\u0000\u02c6\u00c4\u0001\u0000\u0000\u0000\u02c7\u02c8\u0003;\u001d\u0000"+
"\u02c8\u02c9\u0003)\u0014\u0000\u02c9\u02ca\u0003M&\u0000\u02ca\u00c6"+
"\u0001\u0000\u0000\u0000\u02cb\u02cc\u0003;\u001d\u0000\u02cc\u02cd\u0003"+
"=\u001e\u0000\u02cd\u02ce\u0003G#\u0000\u02ce\u00c8\u0001\u0000\u0000"+
"\u0000\u02cf\u02d0\u0003;\u001d\u0000\u02d0\u02d1\u0003I$\u0000\u02d1"+
"\u02d2\u00037\u001b\u0000\u02d2\u02d3\u00037\u001b\u0000\u02d3\u00ca\u0001"+
"\u0000\u0000\u0000\u02d4\u02d5\u0003;\u001d\u0000\u02d5\u02d6\u0003I$"+
"\u0000\u02d6\u02d7\u00037\u001b\u0000\u02d7\u02d8\u00037\u001b\u0000\u02d8"+
"\u02d9\u00031\u0018\u0000\u02d9\u02da\u0003+\u0015\u0000\u02da\u00cc\u0001"+
"\u0000\u0000\u0000\u02db\u02dc\u0003=\u001e\u0000\u02dc\u02dd\u0003#\u0011"+
"\u0000\u02dd\u02de\u00033\u0019\u0000\u02de\u02df\u0003)\u0014\u0000\u02df"+
"\u02e0\u0003%\u0012\u0000\u02e0\u02e1\u0003G#\u0000\u02e1\u00ce\u0001"+
"\u0000\u0000\u0000\u02e2\u02e3\u0003=\u001e\u0000\u02e3\u02e4\u0003+\u0015"+
"\u0000\u02e4\u00d0\u0001\u0000\u0000\u0000\u02e5\u02e6\u0003=\u001e\u0000"+
"\u02e6\u02e7\u0003;\u001d\u0000\u02e7\u00d2\u0001\u0000\u0000\u0000\u02e8"+
"\u02e9\u0003=\u001e\u0000\u02e9\u02ea\u0003C!\u0000\u02ea\u00d4\u0001"+
"\u0000\u0000\u0000\u02eb\u02ec\u0003=\u001e\u0000\u02ec\u02ed\u0003C!"+
"\u0000\u02ed\u02ee\u0003\'\u0013\u0000\u02ee\u02ef\u0003)\u0014\u0000"+
"\u02ef\u02f0\u0003C!\u0000\u02f0\u00d6\u0001\u0000\u0000\u0000\u02f1\u02f2"+
"\u0003=\u001e\u0000\u02f2\u02f3\u0003I$\u0000\u02f3\u02f4\u0003G#\u0000"+
"\u02f4\u02f5\u0003)\u0014\u0000\u02f5\u02f6\u0003C!\u0000\u02f6\u00d8"+
"\u0001\u0000\u0000\u0000\u02f7\u02f8\u0003?\u001f\u0000\u02f8\u02f9\u0003"+
"=\u001e\u0000\u02f9\u02fa\u0003M&\u0000\u02fa\u02fb\u0003)\u0014\u0000"+
"\u02fb\u02fc\u0003C!\u0000\u02fc\u00da\u0001\u0000\u0000\u0000\u02fd\u02fe"+
"\u0003C!\u0000\u02fe\u02ff\u0003=\u001e\u0000\u02ff\u0300\u0003I$\u0000"+
"\u0300\u0301\u0003;\u001d\u0000\u0301\u0302\u0003\'\u0013\u0000\u0302"+
"\u00dc\u0001\u0000\u0000\u0000\u0303\u0304\u0003E\"\u0000\u0304\u0305"+
"\u0003)\u0014\u0000\u0305\u0306\u00037\u001b\u0000\u0306\u0307\u0003)"+
"\u0014\u0000\u0307\u0308\u0003%\u0012\u0000\u0308\u0309\u0003G#\u0000"+
"\u0309\u00de\u0001\u0000\u0000\u0000\u030a\u030b\u0003E\"\u0000\u030b"+
"\u030c\u0003)\u0014\u0000\u030c\u030d\u0003G#\u0000\u030d\u00e0\u0001"+
"\u0000\u0000\u0000\u030e\u030f\u0003E\"\u0000\u030f\u0310\u00031\u0018"+
"\u0000\u0310\u0311\u0003-\u0016\u0000\u0311\u0312\u0003;\u001d\u0000\u0312"+
"\u00e2\u0001\u0000\u0000\u0000\u0313\u0314\u0003E\"\u0000\u0314\u0315"+
"\u00031\u0018\u0000\u0315\u0316\u0003S)\u0000\u0316\u0317\u0003)\u0014"+
"\u0000\u0317\u00e4\u0001\u0000\u0000\u0000\u0318\u0319\u0003E\"\u0000"+
"\u0319\u031a\u0003=\u001e\u0000\u031a\u031b\u00039\u001c\u0000\u031b\u031c"+
"\u0003)\u0014\u0000\u031c\u00e6\u0001\u0000\u0000\u0000\u031d\u031e\u0003"+
"E\"\u0000\u031e\u031f\u0003A \u0000\u031f\u0320\u0003C!\u0000\u0320\u0321"+
"\u0003G#\u0000\u0321\u00e8\u0001\u0000\u0000\u0000\u0322\u0323\u0003E"+
"\"\u0000\u0323\u0324\u0003I$\u0000\u0324\u0325\u0003#\u0011\u0000\u0325"+
"\u0326\u0003E\"\u0000\u0326\u0327\u0003G#\u0000\u0327\u0328\u0003C!\u0000"+
"\u0328\u0329\u00031\u0018\u0000\u0329\u032a\u0003;\u001d\u0000\u032a\u032b"+
"\u0003-\u0016\u0000\u032b\u00ea\u0001\u0000\u0000\u0000\u032c\u032d\u0003"+
"E\"\u0000\u032d\u032e\u0003I$\u0000\u032e\u032f\u00039\u001c\u0000\u032f"+
"\u00ec\u0001\u0000\u0000\u0000\u0330\u0331\u0003G#\u0000\u0331\u0332\u0003"+
"/\u0017\u0000\u0332\u0333\u0003)\u0014\u0000\u0333\u0334\u0003;\u001d"+
"\u0000\u0334\u00ee\u0001\u0000\u0000\u0000\u0335\u0336\u0003G#\u0000\u0336"+
"\u0337\u00031\u0018\u0000\u0337\u0338\u00039\u001c\u0000\u0338\u0339\u0003"+
")\u0014\u0000\u0339\u00f0\u0001\u0000\u0000\u0000\u033a\u033b\u0003G#"+
"\u0000\u033b\u033c\u0003C!\u0000\u033c\u033d\u0003!\u0010\u0000\u033d"+
"\u033e\u00031\u0018\u0000\u033e\u033f\u00037\u001b\u0000\u033f\u0340\u0003"+
"1\u0018\u0000\u0340\u0341\u0003;\u001d\u0000\u0341\u0342\u0003-\u0016"+
"\u0000\u0342\u00f2\u0001\u0000\u0000\u0000\u0343\u0344\u0003G#\u0000\u0344"+
"\u0345\u0003C!\u0000\u0345\u0346\u0003)\u0014\u0000\u0346\u0347\u0003"+
"!\u0010\u0000\u0347\u0348\u0003G#\u0000\u0348\u00f4\u0001\u0000\u0000"+
"\u0000\u0349\u034a\u0003G#\u0000\u034a\u034b\u0003C!\u0000\u034b\u034c"+
"\u00031\u0018\u0000\u034c\u034d\u00039\u001c\u0000\u034d\u00f6\u0001\u0000"+
"\u0000\u0000\u034e\u034f\u0003G#\u0000\u034f\u0350\u0003C!\u0000\u0350"+
"\u0351\u0003I$\u0000\u0351\u0352\u0003)\u0014\u0000\u0352\u00f8\u0001"+
"\u0000\u0000\u0000\u0353\u0354\u0003G#\u0000\u0354\u0355\u0003Q(\u0000"+
"\u0355\u0356\u0003?\u001f\u0000\u0356\u0357\u0003)\u0014\u0000\u0357\u00fa"+
"\u0001\u0000\u0000\u0000\u0358\u0359\u0003I$\u0000\u0359\u035a\u0003?"+
"\u001f\u0000\u035a\u035b\u0003\'\u0013\u0000\u035b\u035c\u0003!\u0010"+
"\u0000\u035c\u035d\u0003G#\u0000\u035d\u035e\u0003)\u0014\u0000\u035e"+
"\u00fc\u0001\u0000\u0000\u0000\u035f\u0360\u0003I$\u0000\u0360\u0361\u0003"+
"?\u001f\u0000\u0361\u0362\u0003?\u001f\u0000\u0362\u0363\u0003)\u0014"+
"\u0000\u0363\u0364\u0003C!\u0000\u0364\u00fe\u0001\u0000\u0000\u0000\u0365"+
"\u0366\u0003K%\u0000\u0366\u0367\u0003!\u0010\u0000\u0367\u0368\u0003"+
"7\u001b\u0000\u0368\u0369\u0003I$\u0000\u0369\u036a\u0003)\u0014\u0000"+
"\u036a\u0100\u0001\u0000\u0000\u0000\u036b\u036c\u0003M&\u0000\u036c\u036d"+
"\u0003/\u0017\u0000\u036d\u036e\u0003)\u0014\u0000\u036e\u036f\u0003;"+
"\u001d\u0000\u036f\u0102\u0001\u0000\u0000\u0000\u0370\u0371\u0003M&\u0000"+
"\u0371\u0372\u0003/\u0017\u0000\u0372\u0373\u0003)\u0014\u0000\u0373\u0374"+
"\u0003C!\u0000\u0374\u0375\u0003)\u0014\u0000\u0375\u0104\u0001\u0000"+
"\u0000\u0000\u0376\u0377\u0005=\u0000\u0000\u0377\u0106\u0001\u0000\u0000"+
"\u0000\u0378\u0379\u0005<\u0000\u0000\u0379\u037d\u0005>\u0000\u0000\u037a"+
"\u037b\u0005!\u0000\u0000\u037b\u037d\u0005=\u0000\u0000\u037c\u0378\u0001"+
"\u0000\u0000\u0000\u037c\u037a\u0001\u0000\u0000\u0000\u037d\u0108\u0001"+
"\u0000\u0000\u0000\u037e\u037f\u0005\'\u0000\u0000\u037f\u0380\b\u001b"+
"\u0000\u0000\u0380\u0381\u0005\'\u0000\u0000\u0381\u010a\u0001\u0000\u0000"+
"\u0000\u0382\u0386\u0007\u001c\u0000\u0000\u0383\u0385\u0007\u001d\u0000"+
"\u0000\u0384\u0383\u0001\u0000\u0000\u0000\u0385\u0388\u0001\u0000\u0000"+
"\u0000\u0386\u0384\u0001\u0000\u0000\u0000\u0386\u0387\u0001\u0000\u0000"+
"\u0000\u0387\u010c\u0001\u0000\u0000\u0000\u0388\u0386\u0001\u0000\u0000"+
"\u0000\u0389\u038d\u0005\'\u0000\u0000\u038a\u038c\b\u001b\u0000\u0000"+
"\u038b\u038a\u0001\u0000\u0000\u0000\u038c\u038f\u0001\u0000\u0000\u0000"+
"\u038d\u038b\u0001\u0000\u0000\u0000\u038d\u038e\u0001\u0000\u0000\u0000"+
"\u038e\u0390\u0001\u0000\u0000\u0000\u038f\u038d\u0001\u0000\u0000\u0000"+
"\u0390\u0391\u0005\'\u0000\u0000\u0391\u010e\u0001\u0000\u0000\u0000\u0392"+
"\u0398\u0005\"\u0000\u0000\u0393\u0394\u0005\\\u0000\u0000\u0394\u0397"+
"\u0007\u001e\u0000\u0000\u0395\u0397\b\u001f\u0000\u0000\u0396\u0393\u0001"+
"\u0000\u0000\u0000\u0396\u0395\u0001\u0000\u0000\u0000\u0397\u039a\u0001"+
"\u0000\u0000\u0000\u0398\u0396\u0001\u0000\u0000\u0000\u0398\u0399\u0001"+
"\u0000\u0000\u0000\u0399\u039b\u0001\u0000\u0000\u0000\u039a\u0398\u0001"+
"\u0000\u0000\u0000\u039b\u039c\u0005\"\u0000\u0000\u039c\u0110\u0001\u0000"+
"\u0000\u0000\u039d\u039f\u000209\u0000\u039e\u039d\u0001\u0000\u0000\u0000"+
"\u039f\u03a2\u0001\u0000\u0000\u0000\u03a0\u039e\u0001\u0000\u0000\u0000"+
"\u03a0\u03a1\u0001\u0000\u0000\u0000\u03a1\u03a3\u0001\u0000\u0000\u0000"+
"\u03a2\u03a0\u0001\u0000\u0000\u0000\u03a3\u03a5\u0005.\u0000\u0000\u03a4"+
"\u03a6\u000209\u0000\u03a5\u03a4\u0001\u0000\u0000\u0000\u03a6\u03a7\u0001"+
"\u0000\u0000\u0000\u03a7\u03a5\u0001\u0000\u0000\u0000\u03a7\u03a8\u0001"+
"\u0000\u0000\u0000\u03a8\u03b1\u0001\u0000\u0000\u0000\u03a9\u03ab\u0003"+
")\u0014\u0000\u03aa\u03ac\u000209\u0000\u03ab\u03aa\u0001\u0000\u0000"+
"\u0000\u03ac\u03ad\u0001\u0000\u0000\u0000\u03ad\u03ab\u0001\u0000\u0000"+
"\u0000\u03ad\u03ae\u0001\u0000\u0000\u0000\u03ae\u03b0\u0001\u0000\u0000"+
"\u0000\u03af\u03a9\u0001\u0000\u0000\u0000\u03b0\u03b3\u0001\u0000\u0000"+
"\u0000\u03b1\u03af\u0001\u0000\u0000\u0000\u03b1\u03b2\u0001\u0000\u0000"+
"\u0000\u03b2\u03b6\u0001\u0000\u0000\u0000\u03b3\u03b1\u0001\u0000\u0000"+
"\u0000\u03b4\u03b7\u0003+\u0015\u0000\u03b5\u03b7\u0003\'\u0013\u0000"+
"\u03b6\u03b4\u0001\u0000\u0000\u0000\u03b6\u03b5\u0001\u0000\u0000\u0000"+
"\u03b6\u03b7\u0001\u0000\u0000\u0000\u03b7\u0112\u0001\u0000\u0000\u0000"+
"\u03b8\u03ba\u000209\u0000\u03b9\u03b8\u0001\u0000\u0000\u0000\u03ba\u03bb"+
"\u0001\u0000\u0000\u0000\u03bb\u03b9\u0001\u0000\u0000\u0000\u03bb\u03bc"+
"\u0001\u0000\u0000\u0000\u03bc\u0114\u0001\u0000\u0000\u0000\u03bd\u03bf"+
"\u000209\u0000\u03be\u03bd\u0001\u0000\u0000\u0000\u03bf\u03c0\u0001\u0000"+
"\u0000\u0000\u03c0\u03be\u0001\u0000\u0000\u0000\u03c0\u03c1\u0001\u0000"+
"\u0000\u0000\u03c1\u03c2\u0001\u0000\u0000\u0000\u03c2\u03c3\u00037\u001b"+
"\u0000\u03c3\u0116\u0001\u0000\u0000\u0000\u03c4\u03c5\u0005$\u0000\u0000"+
"\u03c5\u03c9\u0005{\u0000\u0000\u03c6\u03c8\t\u0000\u0000\u0000\u03c7"+
"\u03c6\u0001\u0000\u0000\u0000\u03c8\u03cb\u0001\u0000\u0000\u0000\u03c9"+
"\u03ca\u0001\u0000\u0000\u0000\u03c9\u03c7\u0001\u0000\u0000\u0000\u03ca"+
"\u03cc\u0001\u0000\u0000\u0000\u03cb\u03c9\u0001\u0000\u0000\u0000\u03cc"+
"\u03cd\u0005}\u0000\u0000\u03cd\u0118\u0001\u0000\u0000\u0000\u000e\u0000"+
"\u037c\u0386\u038d\u0396\u0398\u03a0\u03a7\u03ad\u03b1\u03b6\u03bb\u03c0"+
"\u03c9\u0001\u0006\u0000\u0000";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}

View File

@@ -31,6 +31,7 @@
<module>commons-gradle</module>
<module>commons-rewrite</module>
<module>language-server-starter</module>
<module>jpql</module>
</modules>
<repositories>
@@ -125,6 +126,8 @@
<gradle-tooling.version>8.5</gradle-tooling.version>
<gradle-core.version>6.1.1</gradle-core.version>
<antlr.version>4.13.1</antlr.version>
<signing.skip>true</signing.skip>
<signing.alias>vmware</signing.alias>

View File

@@ -89,6 +89,11 @@
<artifactId>java-properties</artifactId>
<version>${dependencies.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>jpql</artifactId>
<version>${dependencies.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-java</artifactId>

View File

@@ -101,6 +101,11 @@ public class BootJavaConfig implements InitializingBean {
return isAll != null && isAll.booleanValue();
}
public boolean isJpqlEnabled() {
Boolean isEnabled = settings.getBoolean("boot-java", "jpql");
return isEnabled != null && isEnabled.booleanValue();
}
public String[] xmlBeansFoldersToScan() {
String foldersStr = settings.getString("boot-java", "support-spring-xml-config", "scan-folders");
if (foldersStr != null) {

View File

@@ -361,6 +361,9 @@ public class BootLanguageServerBootApp {
String fileName = path.getFileName().toString();
switch (Files.getFileExtension(fileName)) {
case "properties":
if (path.endsWith("/META-INF/jpa-named-queries.properties")) {
return LanguageId.JPA_QUERY_PROPERTIES;
}
return LanguageId.BOOT_PROPERTIES;
case "yml":
return LanguageId.BOOT_PROPERTIES_YAML;

View File

@@ -25,6 +25,9 @@ import org.springframework.context.ApplicationContext;
import org.springframework.ide.vscode.boot.factories.SpringFactoriesLanguageServerComponents;
import org.springframework.ide.vscode.boot.index.cache.IndexCache;
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpaQueryPropertiesLanguageServerComponents;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSemanticTokens;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSupportState;
import org.springframework.ide.vscode.boot.java.links.JavaElementLocationProvider;
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider;
@@ -122,7 +125,8 @@ public class BootLanguageServerInitializer implements InitializingBean {
new BootJavaLanguageServerComponents(appContext),
new SpringXMLLanguageServerComponents(server, springIndexer, params, config),
new SpringFactoriesLanguageServerComponents(projectFinder, springIndexer, config),
new PomLanguageServerComponents(server, projectFinder, params.projectObserver, appContext.getBean(SpringProjectsProvider.class))
new PomLanguageServerComponents(server, projectFinder, params.projectObserver, appContext.getBean(SpringProjectsProvider.class)),
new JpaQueryPropertiesLanguageServerComponents(server.getTextDocumentService(), projectFinder, appContext.getBean(JpqlSemanticTokens.class), appContext.getBean(JpqlSupportState.class))
);
for (LanguageServerComponents c : componentsList) {
@@ -152,6 +156,8 @@ public class BootLanguageServerInitializer implements InitializingBean {
components.getDocumentSymbolProvider().ifPresent(documents::onDocumentSymbol);
components.getInlayHintHandler().ifPresent(documents::onInlayHint);
components.getSemanticTokensHandler().ifPresent(documents::onSemanticTokens);
startListeningToPerformReconcile();

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 VMware, Inc.
* Copyright (c) 2023, 2024 VMware, 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
@@ -12,6 +12,9 @@ package org.springframework.ide.vscode.boot.app;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JdtDataQuerySemanticTokensProvider;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSemanticTokens;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSupportState;
import org.springframework.ide.vscode.boot.java.reconcilers.AddConfigurationIfBeansPresentReconciler;
import org.springframework.ide.vscode.boot.java.reconcilers.AnnotationNodeReconciler;
import org.springframework.ide.vscode.boot.java.reconcilers.AuthorizeHttpRequestsReconciler;
@@ -106,5 +109,9 @@ public class JdtConfig {
@Bean EntityIdForRepoReconciler entityIdForRepoReconciler(SimpleLanguageServer server) {
return new EntityIdForRepoReconciler();
}
@Bean JdtDataQuerySemanticTokensProvider jpqlJdtSemanticTokensProvider(JpqlSemanticTokens provider, JpqlSupportState supportState) {
return new JdtDataQuerySemanticTokensProvider(provider, supportState);
}
}

View File

@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.app;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSemanticTokens;
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSupportState;
import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
@Configuration(proxyBeanMethods = false)
public class SpringDataConfig {
@Bean
JpqlSemanticTokens jpqlSemanticTokens() {
return new JpqlSemanticTokens();
}
@Bean
JpqlSupportState jpqlSupportState(SimpleLanguageServer server, ProjectObserver projectObserver, BootJavaConfig config) {
return new JpqlSupportState(server, projectObserver, config);
}
}

View File

@@ -62,6 +62,7 @@ import org.springframework.ide.vscode.commons.languageserver.composable.Language
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.CodeActionHandler;
import org.springframework.ide.vscode.commons.languageserver.util.CodeLensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentHighlightHandler;
@@ -111,6 +112,7 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent
private BootJavaReconcileEngine reconcileEngine;
private BootJavaCodeActionProvider codeActionProvider;
private DocumentSymbolHandler docSymbolProvider;
private JdtSemanticTokensHandler semanticTokensHandler;
private SpringProcessTracker liveProcessTracker;
@@ -183,6 +185,11 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent
codeActionProvider = appContext.getBean(BootJavaCodeActionProvider.class);
Map<String, JdtSemanticTokensProvider> jdtSemanticTokensProviders = appContext.getBeansOfType(JdtSemanticTokensProvider.class);
if (!jdtSemanticTokensProviders.isEmpty()) {
semanticTokensHandler = new JdtSemanticTokensHandler(cuCache, projectFinder, jdtSemanticTokensProviders.values());
}
config.addListener(ignore -> {
log.info("update live process tracker settings - start");
@@ -353,5 +360,10 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent
return Optional.ofNullable(codeActionProvider);
}
@Override
public Optional<SemanticTokensHandler> getSemanticTokensHandler() {
return Optional.ofNullable(semanticTokensHandler);
}
}

View File

@@ -0,0 +1,80 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java;
import java.net.URI;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.lsp4j.DocumentFilter;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensLegend;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensUtils;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
public class JdtSemanticTokensHandler implements SemanticTokensHandler {
private final CompilationUnitCache cuCache;
private final JavaProjectFinder projectFinder;
private final Collection<JdtSemanticTokensProvider> tokenProviders;
private final SemanticTokensLegend legend;
public JdtSemanticTokensHandler(CompilationUnitCache cuCache, JavaProjectFinder projectFinder, Collection<JdtSemanticTokensProvider> tokenProviders) {
this.cuCache = cuCache;
this.projectFinder = projectFinder;
this.tokenProviders = tokenProviders;
this.legend = new SemanticTokensLegend(
tokenProviders.stream().flatMap(tp -> tp.getTokenTypes().stream()).distinct().collect(Collectors.toList()),
tokenProviders.stream().flatMap(tp -> tp.getTokenModifiers().stream()).distinct().collect(Collectors.toList())
);
}
@Override
public SemanticTokensWithRegistrationOptions getCapability() {
SemanticTokensWithRegistrationOptions capabilities = new SemanticTokensWithRegistrationOptions();
DocumentFilter documentFilter = new DocumentFilter();
documentFilter.setLanguage(LanguageId.JAVA.getId());
capabilities.setDocumentSelector(List.of(documentFilter));
capabilities.setFull(true);
capabilities.setLegend(legend);
return capabilities;
}
@Override
public SemanticTokens semanticTokensFull(SemanticTokensParams params, CancelChecker cancelChecker) {
Optional<IJavaProject> optProject = projectFinder.find(params.getTextDocument());
if (optProject.isPresent()) {
IJavaProject jp = optProject.get();
List<JdtSemanticTokensProvider> applicableTokenProviders = tokenProviders.stream().filter(tp -> tp.isApplicable(jp)).collect(Collectors.toList());
if (!applicableTokenProviders.isEmpty()) {
return cuCache.withCompilationUnit(jp, URI.create(params.getTextDocument().getUri()), cu -> computeTokens(applicableTokenProviders, cu));
}
}
return new SemanticTokens();
}
private SemanticTokens computeTokens(List<JdtSemanticTokensProvider> applicableTokenProviders, CompilationUnit cu) {
List<SemanticTokenData> tokensData = applicableTokenProviders.stream().map(tp -> tp.computeTokens(cu)).flatMap(t -> t.stream()).collect(Collectors.toList());
return new SemanticTokens(SemanticTokensUtils.mapTokensDataToLsp(tokensData, legend, offset -> cu.getLineNumber(offset) - 1, cu::getColumnNumber));
}
}

View File

@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
public interface JdtSemanticTokensProvider {
List<String> getTokenTypes();
default List<String> getTokenModifiers() { return Collections.emptyList(); }
List<SemanticTokenData> computeTokens(CompilationUnit cu);
boolean isApplicable(IJavaProject project);
}

View File

@@ -0,0 +1,140 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.IAnnotationBinding;
import org.eclipse.jdt.core.dom.IMemberValuePairBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.MemberValuePair;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.StringLiteral;
import org.springframework.ide.vscode.boot.java.JdtSemanticTokensProvider;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.java.SpringProjectUtil;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
public class JdtDataQuerySemanticTokensProvider implements JdtSemanticTokensProvider {
private static final String QUERY = "Query";
private static final String FQN_QUERY = "org.springframework.data.jpa.repository." + QUERY;
private final JpqlSemanticTokens provider;
private final JpqlSupportState supportState;
public JdtDataQuerySemanticTokensProvider(JpqlSemanticTokens provider, JpqlSupportState supportState) {
this.provider = provider;
this.supportState = supportState;
}
@Override
public List<String> getTokenTypes() {
return provider.getTokenTypes();
}
@Override
public List<SemanticTokenData> computeTokens(CompilationUnit cu) {
List<SemanticTokenData> tokensData = new ArrayList<>();
cu.accept(new ASTVisitor() {
@Override
public boolean visit(NormalAnnotation a) {
if (isQueryAnnotation(a)) {
Expression queryValueNode = ((List<?>) a.values()).stream()
.filter(MemberValuePair.class::isInstance)
.map(MemberValuePair.class::cast)
.filter(p -> "value".equals(p.getName().getIdentifier()))
.findFirst().map(p -> p.getValue())
.get();
if (queryValueNode instanceof StringLiteral) {
IAnnotationBinding annotationBinding = a.resolveAnnotationBinding();
String query = getJpaQuery(annotationBinding);
if (query != null && !query.isBlank()) {
int valueOffset = queryValueNode.getStartPosition() + 1;
tokensData.addAll(provider.computeTokens(query, valueOffset));
}
}
}
return false;
}
@Override
public boolean visit(SingleMemberAnnotation a) {
if (isQueryAnnotation(a) && a.getValue() instanceof StringLiteral) {
IAnnotationBinding annotationBinding = a.resolveAnnotationBinding();
String query = getJpaQuery(annotationBinding);
if (query != null && !query.isBlank()) {
int valueOffset = a.getValue().getStartPosition() + 1;
tokensData.addAll(provider.computeTokens(query, valueOffset));
}
}
return false;
}
@Override
public boolean visit(MethodInvocation node) {
if ("createQuery".equals(node.getName().getIdentifier()) && node.arguments().size() <= 2 && node.arguments().get(0) instanceof StringLiteral queryExpr) {
IMethodBinding methodBinding = node.resolveMethodBinding();
if ("jakarta.persistence.EntityManager".equals(methodBinding.getDeclaringClass().getQualifiedName())) {
if (methodBinding.getParameterTypes().length <= 2 && "java.lang.String".equals(methodBinding.getParameterTypes()[0].getQualifiedName())) {
tokensData.addAll(provider.computeTokens(queryExpr.getLiteralValue(), queryExpr.getStartPosition() + 1));
}
}
}
return super.visit(node);
}
});
return tokensData;
}
private static boolean isQueryAnnotation(Annotation a) {
return FQN_QUERY.equals(a.getTypeName().getFullyQualifiedName())
|| QUERY.equals(a.getTypeName().getFullyQualifiedName());
}
private static String getJpaQuery(IAnnotationBinding annotationBinding) {
if (annotationBinding != null && annotationBinding.getAnnotationType() != null) {
if (FQN_QUERY.equals(annotationBinding.getAnnotationType().getQualifiedName())) {
String query = null;
boolean isNative = false;
for (IMemberValuePairBinding pair : annotationBinding.getAllMemberValuePairs()) {
switch (pair.getName()) {
case "value":
query = (String) pair.getValue();
break;
case "nativeQuery":
isNative = (Boolean) pair.getValue();
break;
default:
}
}
return isNative ? null : query;
}
}
return null;
}
@Override
public boolean isApplicable(IJavaProject project) {
return supportState.isEnabled() && SpringProjectUtil.hasDependencyStartingWith(project, "spring-data-jpa", null);
}
}

View File

@@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import java.util.Optional;
import java.util.Set;
import org.springframework.ide.vscode.commons.languageserver.composable.LanguageServerComponents;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
public class JpaQueryPropertiesLanguageServerComponents implements LanguageServerComponents {
private final QueryPropertiesSemanticTokensHandler semanticTokensHandler;
public JpaQueryPropertiesLanguageServerComponents(SimpleTextDocumentService documents, JavaProjectFinder projectsFinder, JpqlSemanticTokens jpqlSemanticTokensProvider, JpqlSupportState supportState) {
this.semanticTokensHandler = new QueryPropertiesSemanticTokensHandler(documents, projectsFinder, jpqlSemanticTokensProvider, supportState);
}
@Override
public Set<LanguageId> getInterestingLanguages() {
return Set.of(LanguageId.JPA_QUERY_PROPERTIES);
}
@Override
public Optional<SemanticTokensHandler> getSemanticTokensHandler() {
return Optional.of(semanticTokensHandler);
}
}

View File

@@ -0,0 +1,147 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensDataProvider;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlBaseListener;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlLexer;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlParser;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlParser.Collection_valued_fieldContext;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlParser.Entity_nameContext;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlParser.Entity_type_literalContext;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlParser.Single_valued_object_fieldContext;
import org.springframework.ide.vscode.jpql.antlr.parser.JpqlParser.State_fieldContext;
public class JpqlSemanticTokens implements SemanticTokensDataProvider {
private static List<String> TOKEN_TYPES = List.of("keyword", "type", "class", "string", "number", "operator",
"variable", "method", "modifier", "regexp");
@Override
public List<String> getTokenTypes() {
return TOKEN_TYPES;
}
@Override
public List<SemanticTokenData> computeTokens(String text, int initialOffset) {
List<SemanticTokenData> tokens = new ArrayList<>();
JpqlLexer lexer = new JpqlLexer(CharStreams.fromString(text));
CommonTokenStream antlrTokens = new CommonTokenStream(lexer);
JpqlParser parser = new JpqlParser(antlrTokens);
HashSet<Token> coloredTokens = new HashSet<>();
parser.addParseListener(new JpqlBaseListener() {
private void addToken(Token token, String tokenType) {
tokens.add(new SemanticTokenData(token.getStartIndex() + initialOffset,
token.getStartIndex() + token.getText().length() + initialOffset, tokenType, new String[0]));
coloredTokens.add(token);
}
private void processTerminalNode(TerminalNode node) {
if (coloredTokens.contains(node.getSymbol())) {
return;
}
int type = node.getSymbol().getType();
switch (type) {
case JpqlParser.STRINGLITERAL:
case JpqlParser.CHARACTER:
addToken(node.getSymbol(), "string");
break;
case JpqlParser.LONGLITERAL:
case JpqlParser.INTLITERAL:
case JpqlParser.FLOATLITERAL:
addToken(node.getSymbol(), "number");
break;
case JpqlParser.IDENTIFICATION_VARIABLE:
addToken(node.getSymbol(), "variable");
break;
case JpqlParser.JAVASTRINGLITERAL:
addToken(node.getSymbol(), "class");
break;
case JpqlParser.EQUAL:
case JpqlParser.NOT_EQUAL:
addToken(node.getSymbol(), "operator");
break;
case JpqlParser.WS:
break;
case JpqlParser.SPEL:
addToken(node.getSymbol(), "regexp");
break;
default:
if (JpqlParser.WS < type && type <= JpqlParser.WHERE) {
addToken(node.getSymbol(), "keyword");
} else {
addToken(node.getSymbol(), "modifier");
}
}
}
@Override
public void enterState_field(State_fieldContext ctx) {
if (!coloredTokens.contains(ctx.getStart())) {
addToken(ctx.getStart(), "method");
}
}
@Override
public void enterSingle_valued_object_field(Single_valued_object_fieldContext ctx) {
if (!coloredTokens.contains(ctx.getStart())) {
addToken(ctx.getStart(), "method");
}
}
@Override
public void enterCollection_valued_field(Collection_valued_fieldContext ctx) {
if (!coloredTokens.contains(ctx.getStart())) {
addToken(ctx.getStart(), "method");
}
}
@Override
public void enterEntity_name(Entity_nameContext ctx) {
if (!coloredTokens.contains(ctx.getStart())) {
addToken(ctx.getStart(), "class");
}
}
@Override
public void enterEntity_type_literal(Entity_type_literalContext ctx) {
if (!coloredTokens.contains(ctx.getStart())) {
addToken(ctx.getStart(), "type");
}
}
@Override
public void visitTerminal(TerminalNode node) {
processTerminalNode(node);
}
@Override
public void visitErrorNode(ErrorNode node) {
processTerminalNode(node);
}
});
parser.ql_statement();
return tokens;
}
}

View File

@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import org.springframework.ide.vscode.boot.app.BootJavaConfig;
import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
public final class JpqlSupportState {
private final SimpleLanguageServer server;
private boolean enabled;
public JpqlSupportState(SimpleLanguageServer server, ProjectObserver projectObserver, BootJavaConfig config) {
this(server, projectObserver, config, config.isJpqlEnabled());
}
public JpqlSupportState(SimpleLanguageServer server, ProjectObserver projectObserver, BootJavaConfig config, boolean enabled) {
this.server = server;
this.enabled = enabled;
config.addListener(v -> setEnabled(config.isJpqlEnabled()));
projectObserver.addListener(ProjectObserver.onAny(jp -> server.getAsync().execute(() -> server.getClient().refreshSemanticTokens())));
}
public synchronized boolean isEnabled() {
return enabled;
}
private synchronized void setEnabled(boolean enabled) {
if (this.enabled != enabled) {
this.enabled = enabled;
server.getAsync().execute(() -> server.getClient().refreshSemanticTokens());
}
}
}

View File

@@ -0,0 +1,109 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.eclipse.lsp4j.DocumentFilter;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensLegend;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.java.SpringProjectUtil;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensHandler;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensUtils;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
import org.springframework.ide.vscode.commons.util.BadLocationException;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
import org.springframework.ide.vscode.java.properties.antlr.parser.AntlrParser;
import org.springframework.ide.vscode.java.properties.parser.ParseResults;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Value;
public class QueryPropertiesSemanticTokensHandler implements SemanticTokensHandler {
private static final Logger log = LoggerFactory.getLogger(QueryPropertiesSemanticTokensHandler.class);
private final JavaProjectFinder projectFinder;
private final SimpleTextDocumentService documents;
private final JpqlSemanticTokens tokensProvider;
private final JpqlSupportState supportState;
public QueryPropertiesSemanticTokensHandler(SimpleTextDocumentService documents, JavaProjectFinder projectFinder, JpqlSemanticTokens jpqlTokensProvider, JpqlSupportState supportState) {
this.documents = documents;
this.projectFinder = projectFinder;
this.tokensProvider = jpqlTokensProvider;
this.supportState = supportState;
}
@Override
public SemanticTokensWithRegistrationOptions getCapability() {
SemanticTokensWithRegistrationOptions capabilities = new SemanticTokensWithRegistrationOptions();
DocumentFilter documentFilter = new DocumentFilter();
documentFilter.setLanguage(LanguageId.JPA_QUERY_PROPERTIES.getId());
capabilities.setDocumentSelector(List.of(documentFilter));
capabilities.setFull(true);
capabilities.setLegend(new SemanticTokensLegend(tokensProvider.getTokenTypes(), tokensProvider.getTypeModifiers()));
return capabilities;
}
@Override
public SemanticTokens semanticTokensFull(SemanticTokensParams params, CancelChecker cancelChecker) {
if (!supportState.isEnabled()) {
return new SemanticTokens();
}
Optional<IJavaProject> optProject = projectFinder.find(params.getTextDocument());
if (optProject.isPresent() && SpringProjectUtil.hasDependencyStartingWith(optProject.get(), "spring-data-jpa", null)) {
TextDocument doc = documents.getLatestSnapshot(params.getTextDocument().getUri());
if (doc != null) {
AntlrParser propertiesParser = new AntlrParser();
ParseResults result = propertiesParser.parse(doc.get());
List<SemanticTokenData> data = new ArrayList<>();
for (PropertiesAst.KeyValuePair node : result.ast.getNodes(PropertiesAst.KeyValuePair.class)) {
Value value = node.getValue();
if (value != null) {
data.addAll(tokensProvider.computeTokens(value.decode(), value.getOffset()));
}
}
Collections.sort(data);
SemanticTokensLegend legend = new SemanticTokensLegend(tokensProvider.getTokenTypes(), tokensProvider.getTypeModifiers());
return new SemanticTokens(SemanticTokensUtils.mapTokensDataToLsp(data, legend, t -> {
try {
return doc.getLineOfOffset(t);
} catch (BadLocationException e) {
log.error("", e);
}
return -1;
}, o -> {
try {
return o - doc.getLineOffset(doc.getLineOfOffset(o));
} catch (BadLocationException e) {
log.error("", e);
}
return -1;
}));
}
}
return SemanticTokensHandler.super.semanticTokensFull(params, cancelChecker);
}
}

View File

@@ -0,0 +1,212 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import static org.assertj.core.api.Assertions.assertThat;
import java.nio.file.Paths;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Import;
import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
import org.springframework.ide.vscode.boot.bootiful.HoverTestConf;
import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@BootLanguageServerTest
@Import(HoverTestConf.class)
public class JdtDataQuerySemanticTokensProviderTest {
@Autowired JdtDataQuerySemanticTokensProvider provider;
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
private MavenJavaProject jp;
@BeforeEach
public void setup() throws Exception {
jp = projects.mavenProject("spring-modulith-example-full");
}
@Test
void singleMemberAnnotation() throws Exception {
String source = """
package my.package
import org.springframework.data.jpa.repository.Query;
public interface OwnerRepository {
@Query("SELECT DISTINCT owner FROM Owner owner")
void findByLastName();
}
""";
String uri = Paths.get(jp.getLocationUri()).resolve("src/main/resource/my/package/OwnerRepository.java").toUri().toASCIIString();
CompilationUnit cu = CompilationUnitCache.parse2(source.toCharArray(), uri, "OwnerRepository.java", jp);
assertThat(cu).isNotNull();
List<SemanticTokenData> tokens = provider.computeTokens(cu);
SemanticTokenData token = tokens.get(0);
assertThat(token).isEqualTo(new SemanticTokenData(120, 126, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("SELECT");
token = tokens.get(1);
assertThat(token).isEqualTo(new SemanticTokenData(127, 135, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("DISTINCT");
token = tokens.get(2);
assertThat(token).isEqualTo(new SemanticTokenData(136, 141, "variable", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("owner");
token = tokens.get(3);
assertThat(token).isEqualTo(new SemanticTokenData(142, 146, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("FROM");
token = tokens.get(4);
assertThat(token).isEqualTo(new SemanticTokenData(147, 152, "class", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("Owner");
token = tokens.get(5);
assertThat(token).isEqualTo(new SemanticTokenData(153, 158, "variable", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("owner");
}
@Test
void normalAnnotation() throws Exception {
String source = """
package my.package
import org.springframework.data.jpa.repository.Query;
public interface OwnerRepository {
@Query(value = "SELECT DISTINCT owner FROM Owner owner")
void findByLastName();
}
""";
String uri = Paths.get(jp.getLocationUri()).resolve("src/main/resource/my/package/OwnerRepository.java").toUri().toASCIIString();
CompilationUnit cu = CompilationUnitCache.parse2(source.toCharArray(), uri, "OwnerRepository.java", jp);
assertThat(cu).isNotNull();
List<SemanticTokenData> tokens = provider.computeTokens(cu);
SemanticTokenData token = tokens.get(0);
assertThat(token).isEqualTo(new SemanticTokenData(128, 134, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("SELECT");
token = tokens.get(1);
assertThat(token).isEqualTo(new SemanticTokenData(135, 143, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("DISTINCT");
token = tokens.get(2);
assertThat(token).isEqualTo(new SemanticTokenData(144, 149, "variable", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("owner");
token = tokens.get(3);
assertThat(token).isEqualTo(new SemanticTokenData(150, 154, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("FROM");
token = tokens.get(4);
assertThat(token).isEqualTo(new SemanticTokenData(155, 160, "class", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("Owner");
token = tokens.get(5);
assertThat(token).isEqualTo(new SemanticTokenData(161, 166, "variable", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("owner");
}
@Test
void createQueryMethod() throws Exception {
String source = """
package my.package
import jakarta.persistence.EntityManager;
public interface OwnerRepository {
default void findByLastName(EntityManager manager) {
manager.createQuery("SELECT DISTINCT owner FROM Owner owner")
}
}
""";
String uri = Paths.get(jp.getLocationUri()).resolve("src/main/resource/my/package/OwnerRepository.java").toUri().toASCIIString();
CompilationUnit cu = CompilationUnitCache.parse2(source.toCharArray(), uri, "OwnerRepository.java", jp);
assertThat(cu).isNotNull();
List<SemanticTokenData> tokens = provider.computeTokens(cu);
SemanticTokenData token = tokens.get(0);
assertThat(token).isEqualTo(new SemanticTokenData(176, 182, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("SELECT");
token = tokens.get(1);
assertThat(token).isEqualTo(new SemanticTokenData(183, 191, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("DISTINCT");
token = tokens.get(2);
assertThat(token).isEqualTo(new SemanticTokenData(192, 197, "variable", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("owner");
token = tokens.get(3);
assertThat(token).isEqualTo(new SemanticTokenData(198, 202, "keyword", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("FROM");
token = tokens.get(4);
assertThat(token).isEqualTo(new SemanticTokenData(203, 208, "class", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("Owner");
token = tokens.get(5);
assertThat(token).isEqualTo(new SemanticTokenData(209, 214, "variable", new String[0]));
assertThat(source.substring(token.start(), token.end())).isEqualTo("owner");
}
@Test
void nativeQuery() throws Exception {
String source = """
package my.package
import org.springframework.data.jpa.repository.Query;
public interface OwnerRepository {
@Query(value = "SELECT DISTINCT owner FROM Owner owner", nativeQuery = true)
void findByLastName();
}
""";
String uri = Paths.get(jp.getLocationUri()).resolve("src/main/resource/my/package/OwnerRepository.java").toUri().toASCIIString();
CompilationUnit cu = CompilationUnitCache.parse2(source.toCharArray(), uri, "OwnerRepository.java", jp);
assertThat(cu).isNotNull();
List<SemanticTokenData> tokens = provider.computeTokens(cu);
assertThat(tokens.size()).isZero();
}
}

View File

@@ -0,0 +1,115 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
public class JpqlSemanticTokensTest {
private JpqlSemanticTokens provider = new JpqlSemanticTokens();
@Test
void simpleQuery_1() {
List<SemanticTokenData> tokens = provider.computeTokens("SELECT owner FROM Owner owner", 0);
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0]));
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 12, "variable", new String[0]));
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(13, 17, "keyword", new String[0]));
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(18, 23, "class", new String[0]));
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(24, 29, "variable", new String[0]));
assertThat(tokens.size()).isEqualTo(5);
}
@Test
void initialOffset() {
List<SemanticTokenData> tokens = provider.computeTokens("SELECT owner FROM Owner owner", 3);
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(3, 9, "keyword", new String[0]));
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(10, 15, "variable", new String[0]));
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(16, 20, "keyword", new String[0]));
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(21, 26, "class", new String[0]));
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(27, 32, "variable", new String[0]));
assertThat(tokens.size()).isEqualTo(5);
}
@Test
void query_with_conflicting_groupby() {
List<SemanticTokenData> tokens = provider.computeTokens("SELECT g FROM Group g GROUP BY g.name", 0);
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0]));
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 8, "variable", new String[0]));
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(9, 13, "keyword", new String[0]));
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(14, 19, "class", new String[0]));
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(20, 21, "variable", new String[0]));
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(22, 27, "keyword", new String[0]));
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(28, 30, "keyword", new String[0]));
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(31, 32, "variable", new String[0]));
assertThat(tokens.get(8)).isEqualTo(new SemanticTokenData(32, 33, "modifier", new String[0]));
assertThat(tokens.get(9)).isEqualTo(new SemanticTokenData(33, 37, "method", new String[0]));
assertThat(tokens.size()).isEqualTo(10);
}
@Test
void query_with_parameter() {
List<SemanticTokenData> tokens = provider.computeTokens("SELECT DISTINCT owner FROM Owner owner left join owner.pets WHERE owner.lastName LIKE :lastName%", 0);
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0])); // SELECT
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 15, "keyword", new String[0])); // DISTINCT
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(16, 21, "variable", new String[0])); // owner
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(22, 26, "keyword", new String[0])); // FROM
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(27, 32, "class", new String[0])); // Owner
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(33, 38, "variable", new String[0])); // owner
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(39, 43, "keyword", new String[0])); // left
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(44, 48, "keyword", new String[0])); // join
assertThat(tokens.get(8)).isEqualTo(new SemanticTokenData(50, 55, "variable", new String[0])); // owner
assertThat(tokens.get(9)).isEqualTo(new SemanticTokenData(55, 56, "modifier", new String[0])); // .
assertThat(tokens.get(10)).isEqualTo(new SemanticTokenData(56, 60, "method", new String[0])); // pets
assertThat(tokens.get(11)).isEqualTo(new SemanticTokenData(61, 66, "keyword", new String[0])); // WHERE
assertThat(tokens.get(12)).isEqualTo(new SemanticTokenData(67, 72, "variable", new String[0])); // owner
assertThat(tokens.get(13)).isEqualTo(new SemanticTokenData(72, 73, "modifier", new String[0])); // .
assertThat(tokens.get(14)).isEqualTo(new SemanticTokenData(73, 81, "method", new String[0])); // lastName
assertThat(tokens.get(15)).isEqualTo(new SemanticTokenData(82, 86, "keyword", new String[0])); // LIKE
assertThat(tokens.get(16)).isEqualTo(new SemanticTokenData(87, 88, "modifier", new String[0])); // :
assertThat(tokens.get(17)).isEqualTo(new SemanticTokenData(88, 96, "variable", new String[0])); // lastName
assertThat(tokens.get(18)).isEqualTo(new SemanticTokenData(96, 97, "modifier", new String[0])); // lastName
assertThat(tokens.size()).isEqualTo(19);
}
@Test
void query_with_SPEL() {
List<SemanticTokenData> tokens = provider.computeTokens("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:${id}", 0);
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0])); // SELECT
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 12, "variable", new String[0])); // owner
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(13, 17, "keyword", new String[0])); // FROM
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(18, 23, "class", new String[0])); // Owner
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(24, 29, "variable", new String[0])); // owner
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(30, 34, "keyword", new String[0])); // left
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(35, 39, "keyword", new String[0])); // join
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(40, 45, "keyword", new String[0])); // fetch
assertThat(tokens.get(8)).isEqualTo(new SemanticTokenData(46, 51, "variable", new String[0])); // owner
assertThat(tokens.get(9)).isEqualTo(new SemanticTokenData(51, 52, "modifier", new String[0])); // .
assertThat(tokens.get(10)).isEqualTo(new SemanticTokenData(52, 56, "method", new String[0])); // pets
assertThat(tokens.get(11)).isEqualTo(new SemanticTokenData(57, 62, "keyword", new String[0])); // WHERE
assertThat(tokens.get(12)).isEqualTo(new SemanticTokenData(63, 68, "variable", new String[0])); // owner
assertThat(tokens.get(13)).isEqualTo(new SemanticTokenData(68, 69, "modifier", new String[0])); // .
assertThat(tokens.get(14)).isEqualTo(new SemanticTokenData(69, 71, "method", new String[0])); // id
assertThat(tokens.get(15)).isEqualTo(new SemanticTokenData(72, 73, "operator", new String[0])); // =
assertThat(tokens.get(16)).isEqualTo(new SemanticTokenData(73, 74, "modifier", new String[0])); // :
assertThat(tokens.get(17)).isEqualTo(new SemanticTokenData(74, 79, "regexp", new String[0])); // ${id}
assertThat(tokens.size()).isEqualTo(18);
}
}

View File

@@ -27,6 +27,7 @@ const YAML_LANGUAGE_ID = "spring-boot-properties-yaml";
const JAVA_LANGUAGE_ID = "java";
const XML_LANGUAGE_ID = "xml";
const FACTORIES_LANGUAGE_ID = "spring-factories";
const JPA_QUERY_PROPERTIES_LANGUAGE_ID = "jpa-query-properties";
const STOP_ASKING = "Stop Asking";
@@ -122,6 +123,10 @@ export function activate(context: ExtensionContext): Thenable<ExtensionAPI> {
{
language: FACTORIES_LANGUAGE_ID,
scheme: 'file'
},
{
language: JPA_QUERY_PROPERTIES_LANGUAGE_ID,
pattern: "**/jpa-named-queries.properties"
}
],
synchronize: {

View File

@@ -69,6 +69,16 @@
"*.factories"
],
"configuration": "./properties-support/language-configuration.json"
},
{
"id": "jpa-query-properties",
"aliases": [
"JPA Query Properties"
],
"filenamePatterns": [
"jpa-named-queries.properties"
],
"configuration": "./properties-support/language-configuration.json"
}
],
"menus": {
@@ -300,6 +310,11 @@
],
"description": "The path to a shared properties metadata JSON file."
},
"boot-java.jpql": {
"type": "boolean",
"default": true,
"description": "JPA Query language support"
},
"boot-java.change-detection.on": {
"type": "boolean",
"default": false,
@@ -1137,10 +1152,15 @@
"scopeName": "source.spring-boot-properties",
"path": "./properties-support/spring-boot-properties.tmLanguage.json"
},
{
"language": "jpa-query-properties",
"scopeName": "source.jpa-query-properties",
"path": "./properties-support/jpa-query-properties.tmLanguage.json"
},
{
"language": "spring-factories",
"scopeName": "source.spring-factories",
"path": "./properties-support/spring-boot-properties.tmLanguage.json"
"path": "./properties-support/spring-factories.tmLanguage.json"
}
]
},

View File

@@ -0,0 +1,10 @@
{
"name": "JPA Query Properties",
"scopeName": "source.jpa-query-properties",
"patterns": [
{
"comment": "source.java-properties is defined in vscode-java",
"include": "source.java-properties"
}
]
}

View File

@@ -0,0 +1,10 @@
{
"name": "Spring Factories",
"scopeName": "source.spring-factories",
"patterns": [
{
"comment": "source.java-properties is defined in vscode-java",
"include": "source.java-properties"
}
]
}