From 06cfb6b7e73f8b330dc06c1c0e2096f4663447f3 Mon Sep 17 00:00:00 2001
From: BellCube Dev <33764825+BellCubeDev@users.noreply.github.com>
Date: Sun, 19 Feb 2023 20:17:19 -0500
Subject: [PATCH 1/2] Add Backslash Escape Syntax Highlighting
Still working on keeping function parameters from turning red...
---
.../syntaxes/papyrus/papyrus.tmLanguage | 35 +++++++++++++++++--
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage b/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage
index ca06b532..e6855713 100644
--- a/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage
+++ b/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage
@@ -84,7 +84,7 @@
match
- (?i)(conditional|default|hidden|native|const)
+ (?i)(?:\s+|(?<=/;))(conditional|default|hidden|native|const)(?=\s|;|$)
name
keyword.language.script-flag.papyrus
@@ -335,6 +335,10 @@
include
#builtin-funcs
+
+ include
+ #newline-escape
+
repository
@@ -371,12 +375,33 @@
quoted-string
+ name
+ string.quoted.double.papyrus
begin
"
end
- "
+ ["\n]
+ patterns
+
+
+ include
+ #string-character-escape
+
+
+
+ string-character-escape
+
name
- string.quoted.double.papyrus
+ constant.character.escape.papyrus
+ match
+ \\[nt\\"]?
+
+ newline-escape
+
+ match
+ \\(?=\s*\n)
+ name
+ constant.character.escape.papyrus
params
@@ -414,6 +439,10 @@
name
meta.parameter.papyrus
+
+ include
+ #newline-escape
+
match
[^\s\)]+?
From b6c7195617f62592a9a456880828988ec56970de Mon Sep 17 00:00:00 2001
From: BellCube Dev <33764825+BellCubeDev@users.noreply.github.com>
Date: Mon, 20 Feb 2023 10:17:25 -0500
Subject: [PATCH 2/2] Multi-Line Function Parameter Support
---
.../syntaxes/papyrus/papyrus.tmLanguage | 181 +++++++++++++++---
1 file changed, 157 insertions(+), 24 deletions(-)
diff --git a/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage b/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage
index e6855713..1cfb8e14 100644
--- a/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage
+++ b/src/papyrus-lang-vscode/syntaxes/papyrus/papyrus.tmLanguage
@@ -403,10 +403,85 @@
name
constant.character.escape.papyrus
- params
+ parameter-start-comma
+
+ match
+ ,\s*([\w\[\]:]+)\s+(\w+)\b(?:\s*(=))?
+ captures
+
+ 1
+
+ name
+ storage.type.variable.papyrus
+
+ 2
+
+ name
+ variable.parameter.papyrus
+
+ 3
+
+ name
+ keyword.operator.assignment.papyrus
+
+
+ name
+ meta.parameter.papyrus
+
+ parameter-start-pattern
+
+ match
+ \G\s*([\w\[\]:]+)\s+(\w+)\b(?:\s*(=))?
+ captures
+
+ 1
+
+ name
+ storage.type.variable.papyrus
+
+ 2
+
+ name
+ variable.parameter.papyrus
+
+ 3
+
+ name
+ keyword.operator.assignment.papyrus
+
+
+ name
+ meta.parameter.papyrus
+
+ parameter-comma-at-start
+
+ match
+ \G\s*,
+ name
+ invalid.illegal.function.papyrus
+
+ parameter-newline-escape-with-comma
+ begin
+ ,\s*(\\)\s*\n
+ beginCaptures
+
+ 1
+
+ name
+ constant.character.escape.papyrus
+
+
+ end
+ \n|(?=,\s*\\|\\|\))
+ name
+ meta.function.escapedline.comma.papyrus
patterns
+
+ include
+ #parameter-comma-at-start
+
include
#constants
@@ -415,37 +490,95 @@
include
#quoted-string
+
+ include
+ #parameter-start-comma
+
+
+ include
+ #parameter-start-pattern
+
match
- (?:\G\s*|,\s*)([\w\[\]:]+)\s+(\w+)\b(?:\s*(=))?
- captures
-
- 1
-
- name
- storage.type.variable.papyrus
-
- 2
-
- name
- variable.parameter.papyrus
-
- 3
-
- name
- keyword.operator.assignment.papyrus
-
-
- name
- meta.parameter.papyrus
+ [^\s\)]+
+ name
+ invalid.illegal.function.papyrus
+
+
+
+ parameter-newline-escape-without-comma
+
+ begin
+ (\\)\s*\n
+ beginCaptures
+
+ 1
+
+ name
+ constant.character.escape.papyrus
+
+
+ end
+ \n|(?=,\s*\\|\\|\))
+ name
+ meta.function.escapedline.nocomma.papyrus
+ patterns
+
+
+ include
+ #constants
+
+
+ include
+ #quoted-string
+
+
+ include
+ #parameter-start-comma
+
+
+ match
+ [^\s\)]+
+ name
+ invalid.illegal.function.papyrus
+
+
+
+ params
+
+ patterns
+
+
+ include
+ #parameter-comma-at-start
+
+
+ include
+ #constants
+
+
+ include
+ #quoted-string
+
+
+ include
+ #parameter-start-comma
+
+
+ include
+ #parameter-start-pattern
+
+
+ include
+ #parameter-newline-escape-with-comma
include
- #newline-escape
+ #parameter-newline-escape-without-comma
match
- [^\s\)]+?
+ ^.+|[^\s\)]+?
name
invalid.illegal.function.papyrus