Skip to content

Commit 1134bdf

Browse files
BBj Langauge Support (#3511)
Co-authored-by: Michael Schmidt <[email protected]>
1 parent 342a003 commit 1134bdf

14 files changed

+287
-2
lines changed

components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

+4
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@
225225
},
226226
"owner": "RunDevelopment"
227227
},
228+
"bbj": {
229+
"title": "BBj",
230+
"owner": "hyyan"
231+
},
228232
"bicep": {
229233
"title": "Bicep",
230234
"owner": "johnnyreilly"

components/prism-bbj.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(function (Prism) {
2+
Prism.languages.bbj = {
3+
'comment': {
4+
pattern: /(^|[^\\:])rem\s+.*/i,
5+
lookbehind: true,
6+
greedy: true
7+
},
8+
'string': {
9+
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,
10+
greedy: true
11+
},
12+
'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
13+
'keyword': /\b(?:abstract|all|argc|begin|bye|callback|case|chn|class|classend|ctl|day|delete|dom|dread|dsz|else|endif|err|exitto|extends|fi|field|for|from|gosub|goto|if|implements|interface|interfaceend|iol|iolist|let|list|load|method|methodend|methodret|on|opts|pfx|private|process_events|protected|psz|public|read_resource|remove_callback|restore|rev|seterr|setesc|sqlchn|sqlunt|ssn|start|static|swend|switch|sys|then|tim|unt|until|use|void|wend|where|while)\b/i,
14+
'function': /\b\w+(?=\()/,
15+
'boolean': /\b(?:BBjAPI\.TRUE|BBjAPI\.FALSE)\b/i,
16+
'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:and|not|or|xor)\b/i,
17+
'punctuation': /[.,;:()]/
18+
};
19+
}(Prism));

components/prism-bbj.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-bbj.html

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<h2>Routines example</h2>
2+
<pre><code>
3+
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
4+
use com.basiscomponents.db.ResultSet
5+
use com.basiscomponents.bc.SqlQueryBC
6+
7+
declare auto BBjTopLevelWindow wnd!
8+
wnd! = BBjAPI().openSysGui("X0").addWindow(10, 10, 800, 600, "My First Grid")
9+
wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye")
10+
11+
gosub main
12+
process_events
13+
14+
rem Retrieve the data from the database and configure the grid
15+
main:
16+
declare SqlQueryBC sbc!
17+
declare ResultSet rs!
18+
declare BBjGridExWidget grid!
19+
20+
sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore"))
21+
rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY")
22+
23+
grid! = new BBjGridExWidget(wnd!, 100, 0, 0, 800, 600)
24+
grid!.setData(rs!)
25+
return
26+
27+
byebye:
28+
bye
29+
</code></pre>
30+
31+
<h2>OOP example</h2>
32+
<pre><code>
33+
use java.util.Arrays
34+
use java.util.ArrayList
35+
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
36+
37+
rem /**
38+
rem * This file is part of the MyPackage.
39+
rem *
40+
rem * For the full copyright and license information, please view the LICENSE
41+
rem * file that was distributed with this source code.
42+
rem */
43+
rem /**
44+
45+
class public Employee
46+
field public BBjNumber ID
47+
field public BBjString Name$
48+
classend
49+
50+
class public Salaried extends Employee implements Payable
51+
field public BBjNumber MonthlySalary
52+
method public BBjNumber pay()
53+
methodret #MonthlySalary
54+
methodend
55+
method public void print()
56+
print "Employee",#getID(),": ",#getName()
57+
print #pay():"($###,###.00)"
58+
methodend
59+
method public BBjNumber account()
60+
methodret 11111
61+
methodend
62+
classend
63+
</code></pre>

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

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"gawk": "GAWK",
5757
"basic": "BASIC",
5858
"bbcode": "BBcode",
59+
"bbj": "BBj",
5960
"bnf": "BNF",
6061
"rbnf": "RBNF",
6162
"bsl": "BSL (1C:Enterprise)",

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

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
BBjAPI.FALSE
2+
BBjAPI.TRUE
3+
4+
----------------------------------------------------
5+
6+
[
7+
["boolean", "BBjAPI.FALSE"],
8+
["boolean", "BBjAPI.TRUE"]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for booleans.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
rem Single line comment
2+
3+
rem /**
4+
rem * This file is part of the X plugin.
5+
rem *
6+
rem * For the full copyright and license information, please view the LICENSE
7+
rem * file that was distributed with this source code.
8+
rem */
9+
10+
----------------------------------------------------
11+
12+
[
13+
["comment", "rem Single line comment"],
14+
15+
["comment", "rem /**"],
16+
["comment", "rem * This file is part of the X plugin."],
17+
["comment", "rem *"],
18+
["comment", "rem * For the full copyright and license information, please view the LICENSE"],
19+
["comment", "rem * file that was distributed with this source code."],
20+
["comment", "rem */"]
21+
]
22+
23+
----------------------------------------------------
24+
25+
Checks for comments.
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
abstract all argc begin bye callback case chn class classend ctl day delete dom dread dsz else
2+
endif err exitto extends fi field field for from gosub goto if implements interface interfaceend
3+
iol iolist let list load method methodend methodret on opts pfx private private process_events
4+
protected protected psz public public read_resource remove_callback restore rev seterr setesc sqlchn
5+
sqlunt ssn start static static swend switch sys then tim unt until void void wend where while use
6+
7+
----------------------------------------------------
8+
9+
[
10+
["keyword", "abstract"],
11+
["keyword", "all"],
12+
["keyword", "argc"],
13+
["keyword", "begin"],
14+
["keyword", "bye"],
15+
["keyword", "callback"],
16+
["keyword", "case"],
17+
["keyword", "chn"],
18+
["keyword", "class"],
19+
["keyword", "classend"],
20+
["keyword", "ctl"],
21+
["keyword", "day"],
22+
["keyword", "delete"],
23+
["keyword", "dom"],
24+
["keyword", "dread"],
25+
["keyword", "dsz"],
26+
["keyword", "else"],
27+
28+
["keyword", "endif"],
29+
["keyword", "err"],
30+
["keyword", "exitto"],
31+
["keyword", "extends"],
32+
["keyword", "fi"],
33+
["keyword", "field"],
34+
["keyword", "field"],
35+
["keyword", "for"],
36+
["keyword", "from"],
37+
["keyword", "gosub"],
38+
["keyword", "goto"],
39+
["keyword", "if"],
40+
["keyword", "implements"],
41+
["keyword", "interface"],
42+
["keyword", "interfaceend"],
43+
44+
["keyword", "iol"],
45+
["keyword", "iolist"],
46+
["keyword", "let"],
47+
["keyword", "list"],
48+
["keyword", "load"],
49+
["keyword", "method"],
50+
["keyword", "methodend"],
51+
["keyword", "methodret"],
52+
["keyword", "on"],
53+
["keyword", "opts"],
54+
["keyword", "pfx"],
55+
["keyword", "private"],
56+
["keyword", "private"],
57+
["keyword", "process_events"],
58+
59+
["keyword", "protected"],
60+
["keyword", "protected"],
61+
["keyword", "psz"],
62+
["keyword", "public"],
63+
["keyword", "public"],
64+
["keyword", "read_resource"],
65+
["keyword", "remove_callback"],
66+
["keyword", "restore"],
67+
["keyword", "rev"],
68+
["keyword", "seterr"],
69+
["keyword", "setesc"],
70+
["keyword", "sqlchn"],
71+
72+
["keyword", "sqlunt"],
73+
["keyword", "ssn"],
74+
["keyword", "start"],
75+
["keyword", "static"],
76+
["keyword", "static"],
77+
["keyword", "swend"],
78+
["keyword", "switch"],
79+
["keyword", "sys"],
80+
["keyword", "then"],
81+
["keyword", "tim"],
82+
["keyword", "unt"],
83+
["keyword", "until"],
84+
["keyword", "void"],
85+
["keyword", "void"],
86+
["keyword", "wend"],
87+
["keyword", "where"],
88+
["keyword", "while"],
89+
["keyword", "use"]
90+
]
91+
92+
----------------------------------------------------
93+
94+
Checks for keywords.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
42
2+
3.14159
3+
2e8
4+
3.4E-9
5+
0.7E+12
6+
7+
----------------------------------------------------
8+
9+
[
10+
["number", "42"],
11+
["number", "3.14159"],
12+
["number", "2e8"],
13+
["number", "3.4E-9"],
14+
["number", "0.7E+12"]
15+
]
16+
17+
----------------------------------------------------
18+
19+
Checks for numbers.
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
or xor not and > >= < <= + =*
2+
3+
----------------------------------------------------
4+
5+
[
6+
["operator", "or"],
7+
["operator", "xor"],
8+
["operator", "not"],
9+
["operator", "and"],
10+
["operator", ">"],
11+
["operator", ">="],
12+
["operator", "<"],
13+
["operator", "<="],
14+
["operator", "+"],
15+
["operator", "="],
16+
["operator", "*"]
17+
]
18+
19+
----------------------------------------------------
20+
21+
Checks for operators.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
, ; : ( ) .
2+
3+
----------------------------------------------------
4+
5+
[
6+
["punctuation", ","],
7+
["punctuation", ";"],
8+
["punctuation", ":"],
9+
["punctuation", "("],
10+
["punctuation", ")"],
11+
["punctuation", "."]
12+
]
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
""
2+
"fo""obar"
3+
4+
----------------------------------------------------
5+
6+
[
7+
["string", "\"\""],
8+
["string", "\"fo\"\"obar\""]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for strings.

0 commit comments

Comments
 (0)