BBj Langauge Support (#3511)
Co-authored-by: Michael Schmidt <msrd0000@gmail.com>
This commit is contained in:
parent
342a00397c
commit
1134bdfcd2
File diff suppressed because one or more lines are too long
|
@ -225,6 +225,10 @@
|
|||
},
|
||||
"owner": "RunDevelopment"
|
||||
},
|
||||
"bbj": {
|
||||
"title": "BBj",
|
||||
"owner": "hyyan"
|
||||
},
|
||||
"bicep": {
|
||||
"title": "Bicep",
|
||||
"owner": "johnnyreilly"
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
(function (Prism) {
|
||||
Prism.languages.bbj = {
|
||||
'comment': {
|
||||
pattern: /(^|[^\\:])rem\s+.*/i,
|
||||
lookbehind: true,
|
||||
greedy: true
|
||||
},
|
||||
'string': {
|
||||
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,
|
||||
greedy: true
|
||||
},
|
||||
'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
|
||||
'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,
|
||||
'function': /\b\w+(?=\()/,
|
||||
'boolean': /\b(?:BBjAPI\.TRUE|BBjAPI\.FALSE)\b/i,
|
||||
'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:and|not|or|xor)\b/i,
|
||||
'punctuation': /[.,;:()]/
|
||||
};
|
||||
}(Prism));
|
|
@ -0,0 +1 @@
|
|||
!function(e){e.languages.bbj={comment:{pattern:/(^|[^\\:])rem\s+.*/i,lookbehind:!0,greedy:!0},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,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,function:/\b\w+(?=\()/,boolean:/\b(?:BBjAPI\.TRUE|BBjAPI\.FALSE)\b/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:and|not|or|xor)\b/i,punctuation:/[.,;:()]/}}(Prism);
|
|
@ -0,0 +1,63 @@
|
|||
<h2>Routines example</h2>
|
||||
<pre><code>
|
||||
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
|
||||
use com.basiscomponents.db.ResultSet
|
||||
use com.basiscomponents.bc.SqlQueryBC
|
||||
|
||||
declare auto BBjTopLevelWindow wnd!
|
||||
wnd! = BBjAPI().openSysGui("X0").addWindow(10, 10, 800, 600, "My First Grid")
|
||||
wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye")
|
||||
|
||||
gosub main
|
||||
process_events
|
||||
|
||||
rem Retrieve the data from the database and configure the grid
|
||||
main:
|
||||
declare SqlQueryBC sbc!
|
||||
declare ResultSet rs!
|
||||
declare BBjGridExWidget grid!
|
||||
|
||||
sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore"))
|
||||
rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY")
|
||||
|
||||
grid! = new BBjGridExWidget(wnd!, 100, 0, 0, 800, 600)
|
||||
grid!.setData(rs!)
|
||||
return
|
||||
|
||||
byebye:
|
||||
bye
|
||||
</code></pre>
|
||||
|
||||
<h2>OOP example</h2>
|
||||
<pre><code>
|
||||
use java.util.Arrays
|
||||
use java.util.ArrayList
|
||||
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
|
||||
|
||||
rem /**
|
||||
rem * This file is part of the MyPackage.
|
||||
rem *
|
||||
rem * For the full copyright and license information, please view the LICENSE
|
||||
rem * file that was distributed with this source code.
|
||||
rem */
|
||||
rem /**
|
||||
|
||||
class public Employee
|
||||
field public BBjNumber ID
|
||||
field public BBjString Name$
|
||||
classend
|
||||
|
||||
class public Salaried extends Employee implements Payable
|
||||
field public BBjNumber MonthlySalary
|
||||
method public BBjNumber pay()
|
||||
methodret #MonthlySalary
|
||||
methodend
|
||||
method public void print()
|
||||
print "Employee",#getID(),": ",#getName()
|
||||
print #pay():"($###,###.00)"
|
||||
methodend
|
||||
method public BBjNumber account()
|
||||
methodret 11111
|
||||
methodend
|
||||
classend
|
||||
</code></pre>
|
|
@ -56,6 +56,7 @@
|
|||
"gawk": "GAWK",
|
||||
"basic": "BASIC",
|
||||
"bbcode": "BBcode",
|
||||
"bbj": "BBj",
|
||||
"bnf": "BNF",
|
||||
"rbnf": "RBNF",
|
||||
"bsl": "BSL (1C:Enterprise)",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,13 @@
|
|||
BBjAPI.FALSE
|
||||
BBjAPI.TRUE
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["boolean", "BBjAPI.FALSE"],
|
||||
["boolean", "BBjAPI.TRUE"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for booleans.
|
|
@ -0,0 +1,25 @@
|
|||
rem Single line comment
|
||||
|
||||
rem /**
|
||||
rem * This file is part of the X plugin.
|
||||
rem *
|
||||
rem * For the full copyright and license information, please view the LICENSE
|
||||
rem * file that was distributed with this source code.
|
||||
rem */
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "rem Single line comment"],
|
||||
|
||||
["comment", "rem /**"],
|
||||
["comment", "rem * This file is part of the X plugin."],
|
||||
["comment", "rem *"],
|
||||
["comment", "rem * For the full copyright and license information, please view the LICENSE"],
|
||||
["comment", "rem * file that was distributed with this source code."],
|
||||
["comment", "rem */"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for comments.
|
|
@ -0,0 +1,94 @@
|
|||
abstract all argc begin bye callback case chn class classend ctl day delete dom dread dsz else
|
||||
endif err exitto extends fi field field for from gosub goto if implements interface interfaceend
|
||||
iol iolist let list load method methodend methodret on opts pfx private private process_events
|
||||
protected protected psz public public read_resource remove_callback restore rev seterr setesc sqlchn
|
||||
sqlunt ssn start static static swend switch sys then tim unt until void void wend where while use
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "abstract"],
|
||||
["keyword", "all"],
|
||||
["keyword", "argc"],
|
||||
["keyword", "begin"],
|
||||
["keyword", "bye"],
|
||||
["keyword", "callback"],
|
||||
["keyword", "case"],
|
||||
["keyword", "chn"],
|
||||
["keyword", "class"],
|
||||
["keyword", "classend"],
|
||||
["keyword", "ctl"],
|
||||
["keyword", "day"],
|
||||
["keyword", "delete"],
|
||||
["keyword", "dom"],
|
||||
["keyword", "dread"],
|
||||
["keyword", "dsz"],
|
||||
["keyword", "else"],
|
||||
|
||||
["keyword", "endif"],
|
||||
["keyword", "err"],
|
||||
["keyword", "exitto"],
|
||||
["keyword", "extends"],
|
||||
["keyword", "fi"],
|
||||
["keyword", "field"],
|
||||
["keyword", "field"],
|
||||
["keyword", "for"],
|
||||
["keyword", "from"],
|
||||
["keyword", "gosub"],
|
||||
["keyword", "goto"],
|
||||
["keyword", "if"],
|
||||
["keyword", "implements"],
|
||||
["keyword", "interface"],
|
||||
["keyword", "interfaceend"],
|
||||
|
||||
["keyword", "iol"],
|
||||
["keyword", "iolist"],
|
||||
["keyword", "let"],
|
||||
["keyword", "list"],
|
||||
["keyword", "load"],
|
||||
["keyword", "method"],
|
||||
["keyword", "methodend"],
|
||||
["keyword", "methodret"],
|
||||
["keyword", "on"],
|
||||
["keyword", "opts"],
|
||||
["keyword", "pfx"],
|
||||
["keyword", "private"],
|
||||
["keyword", "private"],
|
||||
["keyword", "process_events"],
|
||||
|
||||
["keyword", "protected"],
|
||||
["keyword", "protected"],
|
||||
["keyword", "psz"],
|
||||
["keyword", "public"],
|
||||
["keyword", "public"],
|
||||
["keyword", "read_resource"],
|
||||
["keyword", "remove_callback"],
|
||||
["keyword", "restore"],
|
||||
["keyword", "rev"],
|
||||
["keyword", "seterr"],
|
||||
["keyword", "setesc"],
|
||||
["keyword", "sqlchn"],
|
||||
|
||||
["keyword", "sqlunt"],
|
||||
["keyword", "ssn"],
|
||||
["keyword", "start"],
|
||||
["keyword", "static"],
|
||||
["keyword", "static"],
|
||||
["keyword", "swend"],
|
||||
["keyword", "switch"],
|
||||
["keyword", "sys"],
|
||||
["keyword", "then"],
|
||||
["keyword", "tim"],
|
||||
["keyword", "unt"],
|
||||
["keyword", "until"],
|
||||
["keyword", "void"],
|
||||
["keyword", "void"],
|
||||
["keyword", "wend"],
|
||||
["keyword", "where"],
|
||||
["keyword", "while"],
|
||||
["keyword", "use"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for keywords.
|
|
@ -0,0 +1,19 @@
|
|||
42
|
||||
3.14159
|
||||
2e8
|
||||
3.4E-9
|
||||
0.7E+12
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["number", "42"],
|
||||
["number", "3.14159"],
|
||||
["number", "2e8"],
|
||||
["number", "3.4E-9"],
|
||||
["number", "0.7E+12"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for numbers.
|
|
@ -0,0 +1,21 @@
|
|||
or xor not and > >= < <= + =*
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["operator", "or"],
|
||||
["operator", "xor"],
|
||||
["operator", "not"],
|
||||
["operator", "and"],
|
||||
["operator", ">"],
|
||||
["operator", ">="],
|
||||
["operator", "<"],
|
||||
["operator", "<="],
|
||||
["operator", "+"],
|
||||
["operator", "="],
|
||||
["operator", "*"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for operators.
|
|
@ -0,0 +1,12 @@
|
|||
, ; : ( ) .
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["punctuation", ","],
|
||||
["punctuation", ";"],
|
||||
["punctuation", ":"],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "."]
|
||||
]
|
|
@ -0,0 +1,13 @@
|
|||
""
|
||||
"fo""obar"
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["string", "\"\""],
|
||||
["string", "\"fo\"\"obar\""]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for strings.
|
Loading…
Reference in New Issue