Commit ffd8343f330f98df6406d84d71b1365767ec2f2a

Michael Schmidt 2021-12-18T12:51:17

Xojo: Proper token name for directives (#3263)

diff --git a/components/prism-xojo.js b/components/prism-xojo.js
index a99fc94..c048b24 100644
--- a/components/prism-xojo.js
+++ b/components/prism-xojo.js
@@ -1,6 +1,7 @@
 Prism.languages.xojo = {
 	'comment': {
-		pattern: /(?:'|\/\/|Rem\b).+/i
+		pattern: /(?:'|\/\/|Rem\b).+/i,
+		greedy: true
 	},
 	'string': {
 		pattern: /"(?:""|[^"])*"/,
@@ -10,7 +11,10 @@ Prism.languages.xojo = {
 		/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
 		/&[bchou][a-z\d]+/i
 	],
-	'symbol': /#(?:Else|ElseIf|Endif|If|Pragma)\b/i,
+	'directive': {
+		pattern: /#(?:Else|ElseIf|Endif|If|Pragma)\b/i,
+		alias: 'property'
+	},
 	'keyword': /\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,
 	'operator': /<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,
 	'punctuation': /[.,;:()]/
diff --git a/components/prism-xojo.min.js b/components/prism-xojo.min.js
index 8abacf9..015aed5 100644
--- a/components/prism-xojo.min.js
+++ b/components/prism-xojo.min.js
@@ -1 +1 @@
-Prism.languages.xojo={comment:{pattern:/(?:'|\/\/|Rem\b).+/i},string:{pattern:/"(?:""|[^"])*"/,greedy:!0},number:[/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,/&[bchou][a-z\d]+/i],symbol:/#(?:Else|ElseIf|Endif|If|Pragma)\b/i,keyword:/\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,operator:/<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,punctuation:/[.,;:()]/};
\ No newline at end of file
+Prism.languages.xojo={comment:{pattern:/(?:'|\/\/|Rem\b).+/i,greedy:!0},string:{pattern:/"(?:""|[^"])*"/,greedy:!0},number:[/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,/&[bchou][a-z\d]+/i],directive:{pattern:/#(?:Else|ElseIf|Endif|If|Pragma)\b/i,alias:"property"},keyword:/\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,operator:/<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,punctuation:/[.,;:()]/};
\ No newline at end of file
diff --git a/tests/languages/xojo/directive_feature.test b/tests/languages/xojo/directive_feature.test
new file mode 100644
index 0000000..f5aef81
--- /dev/null
+++ b/tests/languages/xojo/directive_feature.test
@@ -0,0 +1,19 @@
+#If
+#Else
+#ElseIf
+#Endif
+#Pragma
+
+----------------------------------------------------
+
+[
+	["directive", "#If"],
+	["directive", "#Else"],
+	["directive", "#ElseIf"],
+	["directive", "#Endif"],
+	["directive", "#Pragma"]
+]
+
+----------------------------------------------------
+
+Checks for conditional compilation and pragma.
diff --git a/tests/languages/xojo/symbol_feature.test b/tests/languages/xojo/symbol_feature.test
deleted file mode 100644
index 980c0f1..0000000
--- a/tests/languages/xojo/symbol_feature.test
+++ /dev/null
@@ -1,19 +0,0 @@
-#If
-#Else
-#ElseIf
-#Endif
-#Pragma
-
-----------------------------------------------------
-
-[
-	["symbol", "#If"],
-	["symbol", "#Else"],
-	["symbol", "#ElseIf"],
-	["symbol", "#Endif"],
-	["symbol", "#Pragma"]
-]
-
-----------------------------------------------------
-
-Checks for conditional compilation and pragma.
\ No newline at end of file