-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feat: BBj Langauge Support #3511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cc3c411
feat: add support for BBj Language
hyyan 85c730a
Merge branch 'PrismJS:master' into master
hyyan 0ef0bd9
fix: fix BBj language owner name
hyyan a00f664
Merge branch 'master' of github.com:hyyan/prism
hyyan 195390f
test: improve BBj test coverage
hyyan ea8a46f
fix: remove duplications in BBj keywords
hyyan b676365
Update components.json
hyyan 5474f70
Update components/prism-bbj.js
hyyan 7564e95
Update components/prism-bbj.js
hyyan 28924c0
update BBj keywords list
hyyan 2b04b0c
simplify bbj examples
hyyan bc1a2c7
test: udpate bbj punctuation test
hyyan 12c35d1
Update components/prism-bbj.js
hyyan a44a9e1
rebuild prism
hyyan 59cc766
test: update operators test
hyyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| BBjAPI.FALSE | ||
| BBjAPI.TRUE | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["boolean", "BBjAPI.FALSE"], | ||
| ["boolean", "BBjAPI.TRUE"] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for booleans. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| or | ||
| xor | ||
| not | ||
| and | ||
| > >= | ||
| < <= | ||
| ! | ||
| + | ||
| = | ||
| * | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["operator", "or"], | ||
| ["operator", "xor"], | ||
| ["operator", "not"], | ||
| ["operator", "and"], | ||
| ["operator", ">"], ["operator", ">="], | ||
| ["operator", "<"], ["operator", "<="], | ||
| "\r\n!\r\n", | ||
| ["operator", "+"], | ||
| ["operator", "="], | ||
| ["operator", "*"] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for operators. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| , ; : ( ) . | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["punctuation", ","], | ||
| ["punctuation", ";"], | ||
| ["punctuation", ":"], | ||
| ["punctuation", "("], | ||
| ["punctuation", ")"], | ||
| ["punctuation", "."] | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| "" | ||
| "fo""obar" | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| [ | ||
| ["string", "\"\""], | ||
| ["string", "\"fo\"\"obar\""] | ||
| ] | ||
|
|
||
| ---------------------------------------------------- | ||
|
|
||
| Checks for strings. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.