Xojo: Proper token name for directives (#3263)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
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