purebasic.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Language: PureBASIC
  3. Author: Tristano Ajmone <[email protected]>
  4. Description: Syntax highlighting for PureBASIC (v.5). No inline ASM highlighting. First release (v.1.0), April 2016.
  5. Credits: I've taken inspiration from the PureBasic language file for GeSHi, created by Gustavo Julio Fiorenza (GuShH).
  6. */
  7. // Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;
  8. function(hljs) {
  9. var STRINGS = { // PB IDE color: #0080FF (Azure Radiance)
  10. className: 'string',
  11. begin: '(~)?"', end: '"',
  12. illegal: '\\n'
  13. };
  14. var CONSTANTS = { // PB IDE color: #924B72 (Cannon Pink)
  15. // "#" + a letter or underscore + letters, digits or underscores + (optional) "$"
  16. className: 'symbol',
  17. begin: '#[a-zA-Z_]\\w*\\$?'
  18. };
  19. return {
  20. aliases: ['pb', 'pbi'],
  21. keywords: // PB IDE color: #006666 (Blue Stone) + Bold
  22. // The following keywords list was taken and adapted from GuShH's PureBasic language file for GeSHi...
  23. 'And As Break CallDebugger Case CompilerCase CompilerDefault CompilerElse CompilerEndIf CompilerEndSelect ' +
  24. 'CompilerError CompilerIf CompilerSelect Continue Data DataSection EndDataSection Debug DebugLevel ' +
  25. 'Default Define Dim DisableASM DisableDebugger DisableExplicit Else ElseIf EnableASM ' +
  26. 'EnableDebugger EnableExplicit End EndEnumeration EndIf EndImport EndInterface EndMacro EndProcedure ' +
  27. 'EndSelect EndStructure EndStructureUnion EndWith Enumeration Extends FakeReturn For Next ForEach ' +
  28. 'ForEver Global Gosub Goto If Import ImportC IncludeBinary IncludeFile IncludePath Interface Macro ' +
  29. 'NewList Not Or ProcedureReturn Protected Prototype ' +
  30. 'PrototypeC Read ReDim Repeat Until Restore Return Select Shared Static Step Structure StructureUnion ' +
  31. 'Swap To Wend While With XIncludeFile XOr ' +
  32. 'Procedure ProcedureC ProcedureCDLL ProcedureDLL Declare DeclareC DeclareCDLL DeclareDLL',
  33. contains: [
  34. // COMMENTS | PB IDE color: #00AAAA (Persian Green)
  35. hljs.COMMENT(';', '$', {relevance: 0}),
  36. { // PROCEDURES DEFINITIONS
  37. className: 'function',
  38. begin: '\\b(Procedure|Declare)(C|CDLL|DLL)?\\b',
  39. end: '\\(',
  40. excludeEnd: true,
  41. returnBegin: true,
  42. contains: [
  43. { // PROCEDURE KEYWORDS | PB IDE color: #006666 (Blue Stone) + Bold
  44. className: 'keyword',
  45. begin: '(Procedure|Declare)(C|CDLL|DLL)?',
  46. excludeEnd: true
  47. },
  48. { // PROCEDURE RETURN TYPE SETTING | PB IDE color: #000000 (Black)
  49. className: 'type',
  50. begin: '\\.\\w*'
  51. // end: ' ',
  52. },
  53. hljs.UNDERSCORE_TITLE_MODE // PROCEDURE NAME | PB IDE color: #006666 (Blue Stone)
  54. ]
  55. },
  56. STRINGS,
  57. CONSTANTS
  58. ]
  59. };
  60. }