Studio with hint decorators

This commit is contained in:
2026-04-03 11:20:08 +01:00
parent f368ed94d2
commit e8ec9973cd
4 changed files with 306 additions and 1 deletions
@@ -0,0 +1,32 @@
package p.studio.workspaces.editor.syntaxhighlight;
import java.util.List;
import java.util.regex.Pattern;
public final class EditorDocumentSyntaxHighlightingPbs {
public static final EditorDocumentSyntaxHighlighting PBS = new EditorDocumentSyntaxHighlighting(
Pattern.compile(
"(?<COMMENT>//[^\\n\\r]*)"
+ "|(?<STRING>\"(?:\\\\.|[^\"\\\\])*\")"
+ "|(?<NUMBER>\\b\\d+(?:\\.\\d+)?b?\\b)"
+ "|(?<LITERAL>\\b(?:true|false|none)\\b)"
+ "|(?<KEYWORD>\\b(?:import|from|as|service|host|fn|apply|bind|new|implements|using|ctor"
+ "|declare|let|const|global|struct|contract|error|enum|callback|builtin|self|this|pub|mut|mod|type"
+ "|if|else|switch|default|for|until|step|while|break|continue|return|void|optional|result"
+ "|some|ok|err|handle|and|or|not|spawn|yield|sleep|match)\\b)"
+ "|(?<FUNCTION>\\b[A-Za-z_][A-Za-z0-9_]*\\b(?=\\s*\\())"
+ "|(?<OPERATOR>\\+\\=|\\-\\=|\\*\\=|/\\=|%\\=|\\=\\=|!\\=|<\\=|>\\=|&&|\\|\\||\\->|[+\\-*/%!=<>?])"
+ "|(?<PUNCTUATION>\\.|\\.\\.|[(){}\\[\\],:;@])"),
List.of(
new EditorDocumentHighlightToken("COMMENT", "editor-semantic-pbs-comment"),
new EditorDocumentHighlightToken("STRING", "editor-semantic-pbs-string"),
new EditorDocumentHighlightToken("NUMBER", "editor-semantic-pbs-number"),
new EditorDocumentHighlightToken("LITERAL", "editor-semantic-pbs-literal"),
new EditorDocumentHighlightToken("KEYWORD", "editor-semantic-pbs-keyword"),
new EditorDocumentHighlightToken("FUNCTION", "editor-semantic-pbs-function"),
new EditorDocumentHighlightToken("OPERATOR", "editor-semantic-pbs-operator"),
new EditorDocumentHighlightToken("PUNCTUATION", "editor-semantic-pbs-punctuation")));
private EditorDocumentSyntaxHighlightingPbs() {
}
}