Skip to content

Commit

Permalink
PureBasic: Added missing keyword and fixed constants ending with $ (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
HeX0R101 authored Feb 3, 2022
1 parent 82d0ca1 commit d6c5372
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/prism-purebasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 9,14 @@ slightly changed to pass all tests
// PureBasic support, steal stuff from ansi-c
Prism.languages.purebasic = Prism.languages.extend('clike', {
'comment': /;.*/,
'keyword': /\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
'keyword': /\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|forever|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
'function': /\b\w (?:\.\w )?\s*(?=\()/,
'number': /(?:\$[\da-f] |\b-?(?:\d (?:\.\d )?|\.\d )(?:e[ -]?\d )?)\b/i,
'operator': /(?:@\*?|\?|\*)\w |-[>-]?|\ \ ?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/
});

Prism.languages.insertBefore('purebasic', 'keyword', {
'tag': /#\w /,
'tag': /#\w \$?/,
'asm': {
pattern: /(^[\t ]*)!.*/m,
lookbehind: true,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-purebasic.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/languages/purebasic/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 99,7 @@ INCLUDEFILE
XINCLUDEFILE
MACRO
ENDMACRO
FOREVER

----------------------------------------------------

Expand Down Expand Up @@ -203,7 204,8 @@ ENDMACRO
["keyword", "INCLUDEFILE"],
["keyword", "XINCLUDEFILE"],
["keyword", "MACRO"],
["keyword", "ENDMACRO"]
["keyword", "ENDMACRO"],
["keyword", "FOREVER"]
]

----------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion tests/languages/purebasic/tag_feature.test
Original file line number Diff line number Diff line change
@@ -1,7 1,9 @@
#foo
#NULL$

----------------------------------------------------

[
["tag", "#foo"]
["tag", "#foo"],
["tag", "#NULL$"]
]

0 comments on commit d6c5372

Please sign in to comment.