Skip to content

Commit 0224b7c

Browse files
authored
Merge pull request #994 from Golmote/prism-xojo
Add support for Xojo. Fix #898
2 parents 8f5f1fa + 2b0cc8a commit 0224b7c

File tree

12 files changed

+321
-2
lines changed

12 files changed

+321
-2
lines changed

components.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ var components = {
550550
"require": "markup",
551551
"owner": "Golmote"
552552
},
553+
"xojo": {
554+
"title": "Xojo (REALbasic)",
555+
"owner": "Golmote"
556+
},
553557
"yaml": {
554558
"title": "YAML",
555559
"owner": "hason"

components/prism-xojo.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Prism.languages.xojo = {
2+
'comment': {
3+
pattern: /(?:'|\/\/|Rem\b).+/i,
4+
inside: {
5+
'keyword': /^Rem/i
6+
}
7+
},
8+
'string': {
9+
pattern: /"(?:""|[^"])*"/,
10+
greedy: true
11+
},
12+
'number': [
13+
/(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i,
14+
/&[bchou][a-z\d]+/i
15+
],
16+
'symbol': /#(?:If|Else|ElseIf|Endif|Pragma)\b/i,
17+
'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,
18+
'operator': /<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|Xor|WeakAddressOf)\b/i,
19+
'punctuation': /[.,;:()]/
20+
};

components/prism-xojo.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-xojo.html

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<h1>Xojo (REALbasic)</h1>
2+
<p>To use this language, use the class "language-xojo".</p>
3+
4+
<h2>Comments</h2>
5+
<pre><code>' This is a comment
6+
// This is a comment too
7+
Rem This is a remark</code></pre>
8+
9+
<h2>Strings</h2>
10+
<pre><code>""
11+
"foo ""bar"" baz"</code></pre>
12+
13+
<h2>Numbers and colors</h2>
14+
<pre><code>42
15+
3.14159
16+
3E4
17+
&b0110
18+
&cAABBCCDD
19+
&hBadFace
20+
&o777
21+
&u9</code></pre>
22+
23+
<h2>Example</h2>
24+
<pre><code>Dim g As Graphics
25+
Dim yOffSet As Integer
26+
g = OpenPrinterDialog()
27+
If g <> Nil Then
28+
If MainDishMenu.ListIndex <> -1 Then
29+
g.Bold = True
30+
g.DrawString("Main Dish:",20,20)
31+
g.Bold = False
32+
g.DrawString(MainDishMenu.Text,100,20)
33+
g.Bold = True
34+
g.DrawString("Side Order:",20,40)
35+
g.Bold = False
36+
If FriesRadio.Value Then
37+
g.DrawString(FriesRadio.Caption,100,40)
38+
End If
39+
If PotatoRadio.Value Then
40+
g.DrawString(PotatoRadio.Caption,100,40)
41+
End If
42+
If OnionRingRadio.Value Then
43+
g.DrawString(OnionRingRadio.Caption,100,40)
44+
End If
45+
yOffSet = 60
46+
If CheeseCheckBox.Value Then
47+
g.Bold = True
48+
g.DrawString("Extra:",20,yOffSet)
49+
g.Bold = False
50+
g.DrawString(CheeseCheckBox.Caption,100,yOffSet)
51+
yOffSet = yOffSet + 20
52+
End If
53+
If BaconCheckBox.Value Then
54+
g.Bold = True
55+
g.DrawString("Extra:",20,yOffSet)
56+
g.Bold = False
57+
g.DrawString(BaconCheckBox.Caption,100,yOffSet)
58+
yOffSet = yOffSet + 20
59+
End If
60+
g.Bold = True
61+
g.DrawString("Notes:",20,yOffSet)
62+
g.Bold = False
63+
g.DrawString(NotesField.Text,100,yOffSet,(g.Width-40))
64+
End If
65+
End If
66+
</code></pre>

plugins/show-language/prism-show-language.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if (typeof self === 'undefined' || !self.Prism || !self.document) {
55
}
66

77
// The languages map is built automatically with gulp
8-
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"}/*]*/;
8+
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"}/*]*/;
99
Prism.hooks.add('before-highlight', function(env) {
1010
var pre = env.element.parentNode;
1111
if (!pre || !/pre/i.test(pre.nodeName)) {

plugins/show-language/prism-show-language.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
' Foobar
2+
// Foobar
3+
Rem Foobar
4+
5+
----------------------------------------------------
6+
7+
[
8+
["comment", ["' Foobar"]],
9+
["comment", ["// Foobar"]],
10+
["comment", [["keyword", "Rem"], " Foobar"]]
11+
]
12+
13+
----------------------------------------------------
14+
15+
Checks for comments and remarks.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
AddHandler
2+
App
3+
Array
4+
As
5+
Assigns
6+
ByRef
7+
ByVal
8+
Break
9+
Call
10+
Case
11+
Catch
12+
Const
13+
Continue
14+
CurrentMethodName
15+
Declare
16+
Dim
17+
Do
18+
DownTo
19+
Each
20+
Else
21+
ElseIf
22+
End
23+
Exit
24+
Extends
25+
False
26+
Finally
27+
For
28+
Global
29+
If
30+
In
31+
Lib
32+
Loop
33+
Me
34+
Next
35+
Nil
36+
Optional
37+
ParamArray
38+
Raise
39+
RaiseEvent
40+
ReDim
41+
Rem
42+
RemoveHandler
43+
Return
44+
Select
45+
Self
46+
Soft
47+
Static
48+
Step
49+
Super
50+
Then
51+
To
52+
True
53+
Try
54+
Ubound
55+
Until
56+
Using
57+
Wend
58+
While
59+
60+
----------------------------------------------------
61+
62+
[
63+
["keyword", "AddHandler"],
64+
["keyword", "App"],
65+
["keyword", "Array"],
66+
["keyword", "As"],
67+
["keyword", "Assigns"],
68+
["keyword", "ByRef"],
69+
["keyword", "ByVal"],
70+
["keyword", "Break"],
71+
["keyword", "Call"],
72+
["keyword", "Case"],
73+
["keyword", "Catch"],
74+
["keyword", "Const"],
75+
["keyword", "Continue"],
76+
["keyword", "CurrentMethodName"],
77+
["keyword", "Declare"],
78+
["keyword", "Dim"],
79+
["keyword", "Do"],
80+
["keyword", "DownTo"],
81+
["keyword", "Each"],
82+
["keyword", "Else"],
83+
["keyword", "ElseIf"],
84+
["keyword", "End"],
85+
["keyword", "Exit"],
86+
["keyword", "Extends"],
87+
["keyword", "False"],
88+
["keyword", "Finally"],
89+
["keyword", "For"],
90+
["keyword", "Global"],
91+
["keyword", "If"],
92+
["keyword", "In"],
93+
["keyword", "Lib"],
94+
["keyword", "Loop"],
95+
["keyword", "Me"],
96+
["keyword", "Next"],
97+
["keyword", "Nil"],
98+
["keyword", "Optional"],
99+
["keyword", "ParamArray"],
100+
["keyword", "Raise"],
101+
["keyword", "RaiseEvent"],
102+
["keyword", "ReDim"],
103+
["keyword", "Rem"],
104+
["keyword", "RemoveHandler"],
105+
["keyword", "Return"],
106+
["keyword", "Select"],
107+
["keyword", "Self"],
108+
["keyword", "Soft"],
109+
["keyword", "Static"],
110+
["keyword", "Step"],
111+
["keyword", "Super"],
112+
["keyword", "Then"],
113+
["keyword", "To"],
114+
["keyword", "True"],
115+
["keyword", "Try"],
116+
["keyword", "Ubound"],
117+
["keyword", "Until"],
118+
["keyword", "Using"],
119+
["keyword", "Wend"],
120+
["keyword", "While"]
121+
]
122+
123+
----------------------------------------------------
124+
125+
Checks for keywords.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
42
2+
3.14159
3+
0.5e8
4+
5.7e-74
5+
&b0110
6+
&cBadFace0
7+
&hBadFace
8+
&o742
9+
&u9
10+
11+
----------------------------------------------------
12+
13+
[
14+
["number", "42"],
15+
["number", "3.14159"],
16+
["number", "0.5e8"],
17+
["number", "5.7e-74"],
18+
["number", "&b0110"],
19+
["number", "&cBadFace0"],
20+
["number", "&hBadFace"],
21+
["number", "&o742"],
22+
["number", "&u9"]
23+
]
24+
25+
----------------------------------------------------
26+
27+
Checks for numbers and colors.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
< <= <>
2+
> >=
3+
+ - *
4+
/ \ ^
5+
=
6+
AddressOf And
7+
Ctype Is IsA
8+
Mod New Not
9+
Or Xor WeakAddressOf
10+
11+
----------------------------------------------------
12+
13+
[
14+
["operator", "<"], ["operator", "<="], ["operator", "<>"],
15+
["operator", ">"], ["operator", ">="],
16+
["operator", "+"], ["operator", "-"], ["operator", "*"],
17+
["operator", "/"], ["operator", "\\"], ["operator", "^"],
18+
["operator", "="],
19+
["operator", "AddressOf"], ["operator", "And"],
20+
["operator", "Ctype"], ["operator", "Is"], ["operator", "IsA"],
21+
["operator", "Mod"], ["operator", "New"], ["operator", "Not"],
22+
["operator", "Or"], ["operator", "Xor"], ["operator", "WeakAddressOf"]
23+
]
24+
25+
----------------------------------------------------
26+
27+
Checks for operators.

0 commit comments

Comments
 (0)