-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A language based on Basic (BlitzBasic to be precise) with inline assembler also and direct API calls. Can compile on Windows, Linux, and macOS
- Loading branch information
Showing
14 changed files
with
392 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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,70 @@ | ||
/* | ||
Original Code by Bas Groothedde | ||
!!MANY THANKS!! I never would have made this, regex and me will never be best friends ;) | ||
==> https://codepen.io/ImagineProgramming/details/JYydBy/ | ||
slightly changed to pass all tests | ||
*/ | ||
|
||
|
||
// PureBasic support, steal stuff from ansi-c | ||
Prism.languages.purebasic = Prism.languages.extend('clike', { | ||
'comment': /;.*/, | ||
'keyword': /\b(?:declarecdll|declaredll|compilerselect|compilercase|compilerdefault|compilerendselect|compilererror|enableexplicit|disableexplicit|not|and|or|xor|calldebugger|debuglevel|enabledebugger|disabledebugger|restore|read|includepath|includebinary|threaded|runtime|with|endwith|structureunion|endstructureunion|align|newlist|newmap|interface|endinterface|extends|enumeration|endenumeration|swap|foreach|continue|fakereturn|goto|gosub|return|break|module|endmodule|declaremodule|enddeclaremodule|declare|declarec|prototype|prototypec|enableasm|disableasm|dim|redim|data|datasection|enddatasection|to|procedurereturn|debug|default|case|select|endselect|as|import|endimport|importc|compilerif|compilerelse|compilerendif|compilerelseif|end|structure|endstructure|while|wend|for|next|step|if|else|elseif|endif|repeat|until|procedure|proceduredll|procedurec|procedurecdll|endprocedure|protected|shared|static|global|define|includefile|xincludefile|macro|endmacro)\b/i, | ||
'function': /\b\w+(?:\.\w+)?\s*(?=\()/, | ||
'number': /(?:\$[\da-f]+|\b-?\d*\.?\d+(?:e[+-]?\d+)?)\b/i, | ||
'operator': /(?:@\*?|\?|\*)\w+|-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/ | ||
}); | ||
|
||
Prism.languages.insertBefore('purebasic', 'keyword', { | ||
'tag': /#\w+/, | ||
'asm': { | ||
pattern: /(^\s*)!.*/m, | ||
lookbehind: true, | ||
alias: 'tag', | ||
inside: { | ||
'comment': /;.*/, | ||
'string': { | ||
pattern: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, | ||
greedy: true | ||
}, | ||
// Anonymous label references, i.e.: jmp @b | ||
'label-reference-anonymous': { | ||
pattern: /(\s*!\s*j[a-z]+\s+)@[fb]/i, | ||
lookbehind: true, | ||
alias: 'fasm-label' | ||
}, | ||
// Named label reference, i.e.: jne label1 | ||
'label-reference-addressed': { | ||
pattern: /(\s*!\s*j[a-z]+\s+)[A-Z._?$@][\w.?$@~#]*/i, | ||
lookbehind: true, | ||
alias: 'fasm-label' | ||
}, | ||
'function': { | ||
pattern: /^(\s*!\s*)[\da-z]+(?=\s|$)/im, | ||
lookbehind: true | ||
}, | ||
'function-inline': { | ||
pattern: /(\s*:\s*)[\da-z]+(?=\s)/i, | ||
lookbehind: true, | ||
alias: 'function' | ||
}, | ||
'label': { | ||
pattern: /^(\s*!\s*)[A-Za-z._?$@][\w.?$@~#]*(?=:)/m, | ||
lookbehind: true, | ||
alias: 'fasm-label' | ||
}, | ||
'keyword': [ | ||
/(?:extern|extern|global)[^;\r\n]*/i, | ||
/(?:CPU|FLOAT|DEFAULT).*/ | ||
], | ||
'register': /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(?:bp|sp|si|di)|[cdefgs]s|mm\d+)\b/i, | ||
'number': /(?:\b|-|(?=\$))(?:0[hx][\da-f]*\.?[\da-f]+(?:p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(?:\.?e[+-]?\d+)?[dt]?)\b/i, | ||
'operator': /[\[\]*+\-/%<>=&|$!,.:]/ | ||
} | ||
} | ||
}); | ||
|
||
delete Prism.languages.purebasic['class-name']; | ||
delete Prism.languages.purebasic['boolean']; | ||
|
||
Prism.languages.pbfasm = Prism.languages['purebasic']; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,30 @@ | ||
<p>Note: PureBasic Examples.</p> | ||
|
||
<h2>Comments</h2> | ||
<pre><code>; This is a comment</code></pre> | ||
|
||
<h2>Strings</h2> | ||
<pre><code>"This a string."</code></pre> | ||
|
||
<h2>Numbers</h2> | ||
<pre><code>42 | ||
3.14159 | ||
-42 | ||
-3.14159 | ||
.5 | ||
10. | ||
2E10 | ||
4.2E-14 | ||
-3E+2</code></pre> | ||
|
||
<h2>PureBasic example</h2> | ||
<pre><code>Procedure.s Test(s.s) | ||
Protected a$, b$, Result.s | ||
|
||
Result = Mid(s, 1, 3) | ||
|
||
ProcedureReturn Result | ||
EndProcedure | ||
|
||
Test() | ||
End</code></pre> |
This file contains 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 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
Oops, something went wrong.