From 5e62f023dc1f00573e86deec325a6f325e5120e4 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 4 Jul 2016 20:13:26 +0200 Subject: [PATCH 1/2] Add support for Xojo. Fix #898 --- components.js | 5 + components/prism-xojo.js | 20 +++ components/prism-xojo.min.js | 1 + examples/prism-xojo.html | 66 +++++++++ plugins/autoloader/prism-autoloader.js | 2 +- plugins/autoloader/prism-autoloader.min.js | 2 +- plugins/show-language/prism-show-language.js | 2 +- .../show-language/prism-show-language.min.js | 2 +- tests/languages/xojo/comment_feature.test | 15 +++ tests/languages/xojo/keyword_feature.test | 125 ++++++++++++++++++ tests/languages/xojo/number_feature.test | 27 ++++ tests/languages/xojo/operator_feature.test | 27 ++++ tests/languages/xojo/string_feature.test | 15 +++ tests/languages/xojo/symbol_feature.test | 19 +++ 14 files changed, 324 insertions(+), 4 deletions(-) create mode 100644 components/prism-xojo.js create mode 100644 components/prism-xojo.min.js create mode 100644 examples/prism-xojo.html create mode 100644 tests/languages/xojo/comment_feature.test create mode 100644 tests/languages/xojo/keyword_feature.test create mode 100644 tests/languages/xojo/number_feature.test create mode 100644 tests/languages/xojo/operator_feature.test create mode 100644 tests/languages/xojo/string_feature.test create mode 100644 tests/languages/xojo/symbol_feature.test diff --git a/components.js b/components.js index db90cc284f..d5b3b70f86 100644 --- a/components.js +++ b/components.js @@ -550,6 +550,11 @@ var components = { "require": "markup", "owner": "Golmote" }, + "xojo": { + "title": "Xojo (REALbasic)", + "require": "basic", + "owner": "Golmote" + }, "yaml": { "title": "YAML", "owner": "hason" diff --git a/components/prism-xojo.js b/components/prism-xojo.js new file mode 100644 index 0000000000..ede0cd0c8f --- /dev/null +++ b/components/prism-xojo.js @@ -0,0 +1,20 @@ +Prism.languages.xojo = { + 'comment': { + pattern: /(?:'|\/\/|Rem\b).+/i, + inside: { + 'keyword': /^Rem/i + } + }, + 'string': { + pattern: /"(?:""|[^"])*"/, + greedy: true + }, + 'number': [ + /(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i, + /&[bchou][a-z\d]+/i + ], + 'symbol': /#(?:If|Else|ElseIf|Endif|Pragma)\b/i, + 'keyword': /\b(?:AddHandler|App|Array|As(?:signs)?|By(?:Ref|Val)|Break|Call|Case|Catch|Const|Continue|CurrentMethodName|Declare|Dim|Do(?:wnTo)?|Each|Else(?:If)?|End|Exit|Extends|False|Finally|For|Global|If|In|Lib|Loop|Me|Next|Nil|Optional|ParamArray|Raise(?:Event)?|ReDim|Rem|RemoveHandler|Return|Select|Self|Soft|Static|Step|Super|Then|To|True|Try|Ubound|Until|Using|Wend|While)\b/i, + 'operator': /<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|Xor|WeakAddressOf)\b/i, + 'punctuation': /[.,;:()]/ +}; \ No newline at end of file diff --git a/components/prism-xojo.min.js b/components/prism-xojo.min.js new file mode 100644 index 0000000000..848789084c --- /dev/null +++ b/components/prism-xojo.min.js @@ -0,0 +1 @@ +Prism.languages.xojo={comment:{pattern:/(?:'|\/\/|Rem\b).+/i,inside:{keyword:/^Rem/i}},string:{pattern:/"(?:""|[^"])*"/,greedy:!0},number:[/(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i,/&[bchou][a-z\d]+/i],symbol:/#(?:If|Else|ElseIf|Endif|Pragma)\b/i,keyword:/\b(?:AddHandler|App|Array|As(?:signs)?|By(?:Ref|Val)|Break|Call|Case|Catch|Const|Continue|CurrentMethodName|Declare|Dim|Do(?:wnTo)?|Each|Else(?:If)?|End|Exit|Extends|False|Finally|For|Global|If|In|Lib|Loop|Me|Next|Nil|Optional|ParamArray|Raise(?:Event)?|ReDim|Rem|RemoveHandler|Return|Select|Self|Soft|Static|Step|Super|Then|To|True|Try|Ubound|Until|Using|Wend|While)\b/i,operator:/<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|Xor|WeakAddressOf)\b/i,punctuation:/[.,;:()]/}; \ No newline at end of file diff --git a/examples/prism-xojo.html b/examples/prism-xojo.html new file mode 100644 index 0000000000..2f5b8b8dc5 --- /dev/null +++ b/examples/prism-xojo.html @@ -0,0 +1,66 @@ +

Xojo (REALbasic)

+

To use this language, use the class "language-xojo".

+ +

Comments

+
' This is a comment
+// This is a comment too
+Rem This is a remark
+ +

Strings

+
""
+"foo ""bar"" baz"
+ +

Numbers and colors

+
42
+3.14159
+3E4
+&b0110
+&cAABBCCDD
+&hBadFace
+&o777
+&u9
+ +

Example

+
Dim g As Graphics
+Dim yOffSet As Integer
+g = OpenPrinterDialog()
+If g <> Nil Then
+  If MainDishMenu.ListIndex <> -1 Then
+    g.Bold = True
+    g.DrawString("Main Dish:",20,20)
+    g.Bold = False
+    g.DrawString(MainDishMenu.Text,100,20)
+    g.Bold = True
+    g.DrawString("Side Order:",20,40)
+    g.Bold = False
+    If FriesRadio.Value Then
+      g.DrawString(FriesRadio.Caption,100,40)
+    End If
+    If PotatoRadio.Value Then
+      g.DrawString(PotatoRadio.Caption,100,40)
+    End If
+    If OnionRingRadio.Value Then
+      g.DrawString(OnionRingRadio.Caption,100,40)
+    End If
+    yOffSet = 60
+    If CheeseCheckBox.Value Then
+      g.Bold = True
+      g.DrawString("Extra:",20,yOffSet)
+      g.Bold = False
+      g.DrawString(CheeseCheckBox.Caption,100,yOffSet)
+      yOffSet = yOffSet + 20
+    End If
+    If BaconCheckBox.Value Then
+      g.Bold = True
+      g.DrawString("Extra:",20,yOffSet)
+      g.Bold = False
+      g.DrawString(BaconCheckBox.Caption,100,yOffSet)
+      yOffSet = yOffSet + 20
+    End If
+    g.Bold = True
+    g.DrawString("Notes:",20,yOffSet)
+    g.Bold = False
+    g.DrawString(NotesField.Text,100,yOffSet,(g.Width-40))
+  End If
+End If
+
diff --git a/plugins/autoloader/prism-autoloader.js b/plugins/autoloader/prism-autoloader.js index 849f281274..a2fc2abf2f 100644 --- a/plugins/autoloader/prism-autoloader.js +++ b/plugins/autoloader/prism-autoloader.js @@ -4,7 +4,7 @@ } // The dependencies map is built automatically with gulp - var lang_dependencies = /*languages_placeholder[*/{"javascript":"clike","actionscript":"javascript","aspnet":"markup","bison":"c","c":"clike","csharp":"clike","cpp":"c","coffeescript":"javascript","crystal":"ruby","css-extras":"css","d":"clike","dart":"clike","fsharp":"clike","glsl":"clike","go":"clike","groovy":"clike","haml":"ruby","handlebars":"markup","haxe":"clike","jade":"javascript","java":"clike","kotlin":"clike","less":"css","markdown":"markup","nginx":"clike","objectivec":"c","parser":"markup","php":"clike","php-extras":"php","processing":"clike","protobuf":"clike","qore":"clike","jsx":["markup","javascript"],"ruby":"clike","sass":"css","scss":"css","scala":"java","smarty":"markup","swift":"clike","textile":"markup","twig":"markup","typescript":"javascript","wiki":"markup"}/*]*/; + var lang_dependencies = /*languages_placeholder[*/{"javascript":"clike","actionscript":"javascript","aspnet":"markup","bison":"c","c":"clike","csharp":"clike","cpp":"c","coffeescript":"javascript","crystal":"ruby","css-extras":"css","d":"clike","dart":"clike","fsharp":"clike","glsl":"clike","go":"clike","groovy":"clike","haml":"ruby","handlebars":"markup","haxe":"clike","jade":"javascript","java":"clike","kotlin":"clike","less":"css","markdown":"markup","nginx":"clike","objectivec":"c","parser":"markup","php":"clike","php-extras":"php","processing":"clike","protobuf":"clike","qore":"clike","jsx":["markup","javascript"],"ruby":"clike","sass":"css","scss":"css","scala":"java","smarty":"markup","swift":"clike","textile":"markup","twig":"markup","typescript":"javascript","wiki":"markup","xojo":"basic"}/*]*/; var lang_data = {}; diff --git a/plugins/autoloader/prism-autoloader.min.js b/plugins/autoloader/prism-autoloader.min.js index eade07497a..76f69be84e 100644 --- a/plugins/autoloader/prism-autoloader.min.js +++ b/plugins/autoloader/prism-autoloader.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var e={javascript:"clike",actionscript:"javascript",aspnet:"markup",bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",fsharp:"clike",glsl:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup",haxe:"clike",jade:"javascript",java:"clike",kotlin:"clike",less:"css",markdown:"markup",nginx:"clike",objectivec:"c",parser:"markup",php:"clike","php-extras":"php",processing:"clike",protobuf:"clike",qore:"clike",jsx:["markup","javascript"],ruby:"clike",sass:"css",scss:"css",scala:"java",smarty:"markup",swift:"clike",textile:"markup",twig:"markup",typescript:"javascript",wiki:"markup"},c={},a=Prism.plugins.autoloader={languages_path:"components/",use_minified:!0},s=function(e,c,a){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),c&&c()},s.onerror=function(){document.body.removeChild(s),a&&a()},document.body.appendChild(s)},r=function(e){return a.languages_path+"prism-"+e+(a.use_minified?".min":"")+".js"},n=function(e,a){var s=c[e];s||(s=c[e]={});var r=a.getAttribute("data-dependencies");!r&&a.parentNode&&"pre"===a.parentNode.tagName.toLowerCase()&&(r=a.parentNode.getAttribute("data-dependencies")),r=r?r.split(/\s*,\s*/g):[],i(r,function(){t(e,function(){Prism.highlightElement(a)})})},i=function(e,c,a){"string"==typeof e&&(e=[e]);var s=0,r=e.length,n=function(){r>s?t(e[s],function(){s++,n()},function(){a&&a(e[s])}):s===r&&c&&c(e)};n()},t=function(a,n,t){var u=function(){var e=!1;a.indexOf("!")>=0&&(e=!0,a=a.replace("!",""));var i=c[a];if(i||(i=c[a]={}),n&&(i.success_callbacks||(i.success_callbacks=[]),i.success_callbacks.push(n)),t&&(i.error_callbacks||(i.error_callbacks=[]),i.error_callbacks.push(t)),!e&&Prism.languages[a])l(a);else if(!e&&i.error)o(a);else if(e||!i.loading){i.loading=!0;var u=r(a);s(u,function(){i.loading=!1,l(a)},function(){i.loading=!1,i.error=!0,o(a)})}},p=e[a];p&&p.length?i(p,u):u()},l=function(e){c[e]&&c[e].success_callbacks&&c[e].success_callbacks.length&&c[e].success_callbacks.forEach(function(c){c(e)})},o=function(e){c[e]&&c[e].error_callbacks&&c[e].error_callbacks.length&&c[e].error_callbacks.forEach(function(c){c(e)})};Prism.hooks.add("complete",function(e){e.element&&e.language&&!e.grammar&&n(e.language,e.element)})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var e={javascript:"clike",actionscript:"javascript",aspnet:"markup",bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",fsharp:"clike",glsl:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup",haxe:"clike",jade:"javascript",java:"clike",kotlin:"clike",less:"css",markdown:"markup",nginx:"clike",objectivec:"c",parser:"markup",php:"clike","php-extras":"php",processing:"clike",protobuf:"clike",qore:"clike",jsx:["markup","javascript"],ruby:"clike",sass:"css",scss:"css",scala:"java",smarty:"markup",swift:"clike",textile:"markup",twig:"markup",typescript:"javascript",wiki:"markup",xojo:"basic"},c={},a=Prism.plugins.autoloader={languages_path:"components/",use_minified:!0},s=function(e,c,a){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),c&&c()},s.onerror=function(){document.body.removeChild(s),a&&a()},document.body.appendChild(s)},r=function(e){return a.languages_path+"prism-"+e+(a.use_minified?".min":"")+".js"},i=function(e,a){var s=c[e];s||(s=c[e]={});var r=a.getAttribute("data-dependencies");!r&&a.parentNode&&"pre"===a.parentNode.tagName.toLowerCase()&&(r=a.parentNode.getAttribute("data-dependencies")),r=r?r.split(/\s*,\s*/g):[],n(r,function(){t(e,function(){Prism.highlightElement(a)})})},n=function(e,c,a){"string"==typeof e&&(e=[e]);var s=0,r=e.length,i=function(){r>s?t(e[s],function(){s++,i()},function(){a&&a(e[s])}):s===r&&c&&c(e)};i()},t=function(a,i,t){var u=function(){var e=!1;a.indexOf("!")>=0&&(e=!0,a=a.replace("!",""));var n=c[a];if(n||(n=c[a]={}),i&&(n.success_callbacks||(n.success_callbacks=[]),n.success_callbacks.push(i)),t&&(n.error_callbacks||(n.error_callbacks=[]),n.error_callbacks.push(t)),!e&&Prism.languages[a])l(a);else if(!e&&n.error)o(a);else if(e||!n.loading){n.loading=!0;var u=r(a);s(u,function(){n.loading=!1,l(a)},function(){n.loading=!1,n.error=!0,o(a)})}},p=e[a];p&&p.length?n(p,u):u()},l=function(e){c[e]&&c[e].success_callbacks&&c[e].success_callbacks.length&&c[e].success_callbacks.forEach(function(c){c(e)})},o=function(e){c[e]&&c[e].error_callbacks&&c[e].error_callbacks.length&&c[e].error_callbacks.forEach(function(c){c(e)})};Prism.hooks.add("complete",function(e){e.element&&e.language&&!e.grammar&&i(e.language,e.element)})}}(); \ No newline at end of file diff --git a/plugins/show-language/prism-show-language.js b/plugins/show-language/prism-show-language.js index 5ca2ade724..10bdff15e2 100644 --- a/plugins/show-language/prism-show-language.js +++ b/plugins/show-language/prism-show-language.js @@ -5,7 +5,7 @@ if (typeof self === 'undefined' || !self.Prism || !self.document) { } // The languages map is built automatically with gulp -var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","asciidoc":"AsciiDoc","aspnet":"ASP.NET (C#)","autoit":"AutoIt","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","graphql":"GraphQL","http":"HTTP","inform7":"Inform 7","json":"JSON","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","parigp":"PARI/GP","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","vim":"vim","wiki":"Wiki markup","yaml":"YAML"}/*]*/; +var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","asciidoc":"AsciiDoc","aspnet":"ASP.NET (C#)","autoit":"AutoIt","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","graphql":"GraphQL","http":"HTTP","inform7":"Inform 7","json":"JSON","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","parigp":"PARI/GP","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","vim":"vim","wiki":"Wiki markup","xojo":"Xojo (REALbasic)","yaml":"YAML"}/*]*/; Prism.hooks.add('before-highlight', function(env) { var pre = env.element.parentNode; if (!pre || !/pre/i.test(pre.nodeName)) { diff --git a/plugins/show-language/prism-show-language.min.js b/plugins/show-language/prism-show-language.min.js index a990adbaa8..afa963ce48 100644 --- a/plugins/show-language/prism-show-language.min.js +++ b/plugins/show-language/prism-show-language.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",graphql:"GraphQL",http:"HTTP",inform7:"Inform 7",json:"JSON",latex:"LaTeX",livescript:"LiveScript",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",parigp:"PARI/GP",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(s){var a=s.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,i,r=a.getAttribute("data-language")||e[s.language]||s.language.substring(0,1).toUpperCase()+s.language.substring(1),p=a.previousSibling;p&&/\s*\bprism-show-language\b\s*/.test(p.className)&&p.firstChild&&/\s*\bprism-show-language-label\b\s*/.test(p.firstChild.className)?i=p.firstChild:(t=document.createElement("div"),i=document.createElement("div"),i.className="prism-show-language-label",t.className="prism-show-language",t.appendChild(i),a.parentNode.insertBefore(t,a)),i.innerHTML=r}})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",graphql:"GraphQL",http:"HTTP",inform7:"Inform 7",json:"JSON",latex:"LaTeX",livescript:"LiveScript",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",parigp:"PARI/GP",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",xojo:"Xojo (REALbasic)",yaml:"YAML"};Prism.hooks.add("before-highlight",function(s){var a=s.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,i,r=a.getAttribute("data-language")||e[s.language]||s.language.substring(0,1).toUpperCase()+s.language.substring(1),p=a.previousSibling;p&&/\s*\bprism-show-language\b\s*/.test(p.className)&&p.firstChild&&/\s*\bprism-show-language-label\b\s*/.test(p.firstChild.className)?i=p.firstChild:(t=document.createElement("div"),i=document.createElement("div"),i.className="prism-show-language-label",t.className="prism-show-language",t.appendChild(i),a.parentNode.insertBefore(t,a)),i.innerHTML=r}})}}(); \ No newline at end of file diff --git a/tests/languages/xojo/comment_feature.test b/tests/languages/xojo/comment_feature.test new file mode 100644 index 0000000000..c980136164 --- /dev/null +++ b/tests/languages/xojo/comment_feature.test @@ -0,0 +1,15 @@ +' Foobar +// Foobar +Rem Foobar + +---------------------------------------------------- + +[ + ["comment", ["' Foobar"]], + ["comment", ["// Foobar"]], + ["comment", [["keyword", "Rem"], " Foobar"]] +] + +---------------------------------------------------- + +Checks for comments and remarks. \ No newline at end of file diff --git a/tests/languages/xojo/keyword_feature.test b/tests/languages/xojo/keyword_feature.test new file mode 100644 index 0000000000..52a419b245 --- /dev/null +++ b/tests/languages/xojo/keyword_feature.test @@ -0,0 +1,125 @@ +AddHandler +App +Array +As +Assigns +ByRef +ByVal +Break +Call +Case +Catch +Const +Continue +CurrentMethodName +Declare +Dim +Do +DownTo +Each +Else +ElseIf +End +Exit +Extends +False +Finally +For +Global +If +In +Lib +Loop +Me +Next +Nil +Optional +ParamArray +Raise +RaiseEvent +ReDim +Rem +RemoveHandler +Return +Select +Self +Soft +Static +Step +Super +Then +To +True +Try +Ubound +Until +Using +Wend +While + +---------------------------------------------------- + +[ + ["keyword", "AddHandler"], + ["keyword", "App"], + ["keyword", "Array"], + ["keyword", "As"], + ["keyword", "Assigns"], + ["keyword", "ByRef"], + ["keyword", "ByVal"], + ["keyword", "Break"], + ["keyword", "Call"], + ["keyword", "Case"], + ["keyword", "Catch"], + ["keyword", "Const"], + ["keyword", "Continue"], + ["keyword", "CurrentMethodName"], + ["keyword", "Declare"], + ["keyword", "Dim"], + ["keyword", "Do"], + ["keyword", "DownTo"], + ["keyword", "Each"], + ["keyword", "Else"], + ["keyword", "ElseIf"], + ["keyword", "End"], + ["keyword", "Exit"], + ["keyword", "Extends"], + ["keyword", "False"], + ["keyword", "Finally"], + ["keyword", "For"], + ["keyword", "Global"], + ["keyword", "If"], + ["keyword", "In"], + ["keyword", "Lib"], + ["keyword", "Loop"], + ["keyword", "Me"], + ["keyword", "Next"], + ["keyword", "Nil"], + ["keyword", "Optional"], + ["keyword", "ParamArray"], + ["keyword", "Raise"], + ["keyword", "RaiseEvent"], + ["keyword", "ReDim"], + ["keyword", "Rem"], + ["keyword", "RemoveHandler"], + ["keyword", "Return"], + ["keyword", "Select"], + ["keyword", "Self"], + ["keyword", "Soft"], + ["keyword", "Static"], + ["keyword", "Step"], + ["keyword", "Super"], + ["keyword", "Then"], + ["keyword", "To"], + ["keyword", "True"], + ["keyword", "Try"], + ["keyword", "Ubound"], + ["keyword", "Until"], + ["keyword", "Using"], + ["keyword", "Wend"], + ["keyword", "While"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/tests/languages/xojo/number_feature.test b/tests/languages/xojo/number_feature.test new file mode 100644 index 0000000000..209a7bce07 --- /dev/null +++ b/tests/languages/xojo/number_feature.test @@ -0,0 +1,27 @@ +42 +3.14159 +0.5e8 +5.7e-74 +&b0110 +&cBadFace0 +&hBadFace +&o742 +&u9 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "0.5e8"], + ["number", "5.7e-74"], + ["number", "&b0110"], + ["number", "&cBadFace0"], + ["number", "&hBadFace"], + ["number", "&o742"], + ["number", "&u9"] +] + +---------------------------------------------------- + +Checks for numbers and colors. \ No newline at end of file diff --git a/tests/languages/xojo/operator_feature.test b/tests/languages/xojo/operator_feature.test new file mode 100644 index 0000000000..8f95b0ed65 --- /dev/null +++ b/tests/languages/xojo/operator_feature.test @@ -0,0 +1,27 @@ +< <= <> +> >= ++ - * +/ \ ^ += +AddressOf And +Ctype Is IsA +Mod New Not +Or Xor WeakAddressOf + +---------------------------------------------------- + +[ + ["operator", "<"], ["operator", "<="], ["operator", "<>"], + ["operator", ">"], ["operator", ">="], + ["operator", "+"], ["operator", "-"], ["operator", "*"], + ["operator", "/"], ["operator", "\\"], ["operator", "^"], + ["operator", "="], + ["operator", "AddressOf"], ["operator", "And"], + ["operator", "Ctype"], ["operator", "Is"], ["operator", "IsA"], + ["operator", "Mod"], ["operator", "New"], ["operator", "Not"], + ["operator", "Or"], ["operator", "Xor"], ["operator", "WeakAddressOf"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/tests/languages/xojo/string_feature.test b/tests/languages/xojo/string_feature.test new file mode 100644 index 0000000000..4da4f55216 --- /dev/null +++ b/tests/languages/xojo/string_feature.test @@ -0,0 +1,15 @@ +"" +"""" +"Foo ""bar""" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"\"\"\""], + ["string", "\"Foo \"\"bar\"\"\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/tests/languages/xojo/symbol_feature.test b/tests/languages/xojo/symbol_feature.test new file mode 100644 index 0000000000..980c0f13ed --- /dev/null +++ b/tests/languages/xojo/symbol_feature.test @@ -0,0 +1,19 @@ +#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 From 2b0cc8ab0442e1e0d5c27d1a77dfbc8799ade1e7 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 4 Jul 2016 21:06:44 +0200 Subject: [PATCH 2/2] Xojo does not need to require Basic --- components.js | 1 - plugins/autoloader/prism-autoloader.js | 2 +- plugins/autoloader/prism-autoloader.min.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components.js b/components.js index d5b3b70f86..0674d04acb 100644 --- a/components.js +++ b/components.js @@ -552,7 +552,6 @@ var components = { }, "xojo": { "title": "Xojo (REALbasic)", - "require": "basic", "owner": "Golmote" }, "yaml": { diff --git a/plugins/autoloader/prism-autoloader.js b/plugins/autoloader/prism-autoloader.js index a2fc2abf2f..849f281274 100644 --- a/plugins/autoloader/prism-autoloader.js +++ b/plugins/autoloader/prism-autoloader.js @@ -4,7 +4,7 @@ } // The dependencies map is built automatically with gulp - var lang_dependencies = /*languages_placeholder[*/{"javascript":"clike","actionscript":"javascript","aspnet":"markup","bison":"c","c":"clike","csharp":"clike","cpp":"c","coffeescript":"javascript","crystal":"ruby","css-extras":"css","d":"clike","dart":"clike","fsharp":"clike","glsl":"clike","go":"clike","groovy":"clike","haml":"ruby","handlebars":"markup","haxe":"clike","jade":"javascript","java":"clike","kotlin":"clike","less":"css","markdown":"markup","nginx":"clike","objectivec":"c","parser":"markup","php":"clike","php-extras":"php","processing":"clike","protobuf":"clike","qore":"clike","jsx":["markup","javascript"],"ruby":"clike","sass":"css","scss":"css","scala":"java","smarty":"markup","swift":"clike","textile":"markup","twig":"markup","typescript":"javascript","wiki":"markup","xojo":"basic"}/*]*/; + var lang_dependencies = /*languages_placeholder[*/{"javascript":"clike","actionscript":"javascript","aspnet":"markup","bison":"c","c":"clike","csharp":"clike","cpp":"c","coffeescript":"javascript","crystal":"ruby","css-extras":"css","d":"clike","dart":"clike","fsharp":"clike","glsl":"clike","go":"clike","groovy":"clike","haml":"ruby","handlebars":"markup","haxe":"clike","jade":"javascript","java":"clike","kotlin":"clike","less":"css","markdown":"markup","nginx":"clike","objectivec":"c","parser":"markup","php":"clike","php-extras":"php","processing":"clike","protobuf":"clike","qore":"clike","jsx":["markup","javascript"],"ruby":"clike","sass":"css","scss":"css","scala":"java","smarty":"markup","swift":"clike","textile":"markup","twig":"markup","typescript":"javascript","wiki":"markup"}/*]*/; var lang_data = {}; diff --git a/plugins/autoloader/prism-autoloader.min.js b/plugins/autoloader/prism-autoloader.min.js index 76f69be84e..eade07497a 100644 --- a/plugins/autoloader/prism-autoloader.min.js +++ b/plugins/autoloader/prism-autoloader.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var e={javascript:"clike",actionscript:"javascript",aspnet:"markup",bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",fsharp:"clike",glsl:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup",haxe:"clike",jade:"javascript",java:"clike",kotlin:"clike",less:"css",markdown:"markup",nginx:"clike",objectivec:"c",parser:"markup",php:"clike","php-extras":"php",processing:"clike",protobuf:"clike",qore:"clike",jsx:["markup","javascript"],ruby:"clike",sass:"css",scss:"css",scala:"java",smarty:"markup",swift:"clike",textile:"markup",twig:"markup",typescript:"javascript",wiki:"markup",xojo:"basic"},c={},a=Prism.plugins.autoloader={languages_path:"components/",use_minified:!0},s=function(e,c,a){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),c&&c()},s.onerror=function(){document.body.removeChild(s),a&&a()},document.body.appendChild(s)},r=function(e){return a.languages_path+"prism-"+e+(a.use_minified?".min":"")+".js"},i=function(e,a){var s=c[e];s||(s=c[e]={});var r=a.getAttribute("data-dependencies");!r&&a.parentNode&&"pre"===a.parentNode.tagName.toLowerCase()&&(r=a.parentNode.getAttribute("data-dependencies")),r=r?r.split(/\s*,\s*/g):[],n(r,function(){t(e,function(){Prism.highlightElement(a)})})},n=function(e,c,a){"string"==typeof e&&(e=[e]);var s=0,r=e.length,i=function(){r>s?t(e[s],function(){s++,i()},function(){a&&a(e[s])}):s===r&&c&&c(e)};i()},t=function(a,i,t){var u=function(){var e=!1;a.indexOf("!")>=0&&(e=!0,a=a.replace("!",""));var n=c[a];if(n||(n=c[a]={}),i&&(n.success_callbacks||(n.success_callbacks=[]),n.success_callbacks.push(i)),t&&(n.error_callbacks||(n.error_callbacks=[]),n.error_callbacks.push(t)),!e&&Prism.languages[a])l(a);else if(!e&&n.error)o(a);else if(e||!n.loading){n.loading=!0;var u=r(a);s(u,function(){n.loading=!1,l(a)},function(){n.loading=!1,n.error=!0,o(a)})}},p=e[a];p&&p.length?n(p,u):u()},l=function(e){c[e]&&c[e].success_callbacks&&c[e].success_callbacks.length&&c[e].success_callbacks.forEach(function(c){c(e)})},o=function(e){c[e]&&c[e].error_callbacks&&c[e].error_callbacks.length&&c[e].error_callbacks.forEach(function(c){c(e)})};Prism.hooks.add("complete",function(e){e.element&&e.language&&!e.grammar&&i(e.language,e.element)})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var e={javascript:"clike",actionscript:"javascript",aspnet:"markup",bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",fsharp:"clike",glsl:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup",haxe:"clike",jade:"javascript",java:"clike",kotlin:"clike",less:"css",markdown:"markup",nginx:"clike",objectivec:"c",parser:"markup",php:"clike","php-extras":"php",processing:"clike",protobuf:"clike",qore:"clike",jsx:["markup","javascript"],ruby:"clike",sass:"css",scss:"css",scala:"java",smarty:"markup",swift:"clike",textile:"markup",twig:"markup",typescript:"javascript",wiki:"markup"},c={},a=Prism.plugins.autoloader={languages_path:"components/",use_minified:!0},s=function(e,c,a){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),c&&c()},s.onerror=function(){document.body.removeChild(s),a&&a()},document.body.appendChild(s)},r=function(e){return a.languages_path+"prism-"+e+(a.use_minified?".min":"")+".js"},n=function(e,a){var s=c[e];s||(s=c[e]={});var r=a.getAttribute("data-dependencies");!r&&a.parentNode&&"pre"===a.parentNode.tagName.toLowerCase()&&(r=a.parentNode.getAttribute("data-dependencies")),r=r?r.split(/\s*,\s*/g):[],i(r,function(){t(e,function(){Prism.highlightElement(a)})})},i=function(e,c,a){"string"==typeof e&&(e=[e]);var s=0,r=e.length,n=function(){r>s?t(e[s],function(){s++,n()},function(){a&&a(e[s])}):s===r&&c&&c(e)};n()},t=function(a,n,t){var u=function(){var e=!1;a.indexOf("!")>=0&&(e=!0,a=a.replace("!",""));var i=c[a];if(i||(i=c[a]={}),n&&(i.success_callbacks||(i.success_callbacks=[]),i.success_callbacks.push(n)),t&&(i.error_callbacks||(i.error_callbacks=[]),i.error_callbacks.push(t)),!e&&Prism.languages[a])l(a);else if(!e&&i.error)o(a);else if(e||!i.loading){i.loading=!0;var u=r(a);s(u,function(){i.loading=!1,l(a)},function(){i.loading=!1,i.error=!0,o(a)})}},p=e[a];p&&p.length?i(p,u):u()},l=function(e){c[e]&&c[e].success_callbacks&&c[e].success_callbacks.length&&c[e].success_callbacks.forEach(function(c){c(e)})},o=function(e){c[e]&&c[e].error_callbacks&&c[e].error_callbacks.length&&c[e].error_callbacks.forEach(function(c){c(e)})};Prism.hooks.add("complete",function(e){e.element&&e.language&&!e.grammar&&n(e.language,e.element)})}}(); \ No newline at end of file