purebasic.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. module.exports = // Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;
  2. function(hljs) {
  3. var STRINGS = { // PB IDE color: #0080FF (Azure Radiance)
  4. className: 'string',
  5. begin: '(~)?"', end: '"',
  6. illegal: '\\n'
  7. };
  8. var CONSTANTS = { // PB IDE color: #924B72 (Cannon Pink)
  9. // "#" + a letter or underscore + letters, digits or underscores + (optional) "$"
  10. className: 'symbol',
  11. begin: '#[a-zA-Z_]\\w*\\$?'
  12. };
  13. return {
  14. aliases: ['pb', 'pbi'],
  15. keywords: // PB IDE color: #006666 (Blue Stone) + Bold
  16. // Keywords from all version of PureBASIC 5.00 upward ...
  17. 'Align And Array As Break CallDebugger Case CompilerCase CompilerDefault ' +
  18. 'CompilerElse CompilerElseIf CompilerEndIf CompilerEndSelect CompilerError ' +
  19. 'CompilerIf CompilerSelect CompilerWarning Continue Data DataSection Debug ' +
  20. 'DebugLevel Declare DeclareC DeclareCDLL DeclareDLL DeclareModule Default ' +
  21. 'Define Dim DisableASM DisableDebugger DisableExplicit Else ElseIf EnableASM ' +
  22. 'EnableDebugger EnableExplicit End EndDataSection EndDeclareModule EndEnumeration ' +
  23. 'EndIf EndImport EndInterface EndMacro EndModule EndProcedure EndSelect ' +
  24. 'EndStructure EndStructureUnion EndWith Enumeration EnumerationBinary Extends ' +
  25. 'FakeReturn For ForEach ForEver Global Gosub Goto If Import ImportC ' +
  26. 'IncludeBinary IncludeFile IncludePath Interface List Macro MacroExpandedCount ' +
  27. 'Map Module NewList NewMap Next Not Or Procedure ProcedureC ' +
  28. 'ProcedureCDLL ProcedureDLL ProcedureReturn Protected Prototype PrototypeC ReDim ' +
  29. 'Read Repeat Restore Return Runtime Select Shared Static Step Structure ' +
  30. 'StructureUnion Swap Threaded To UndefineMacro Until Until UnuseModule ' +
  31. 'UseModule Wend While With XIncludeFile XOr',
  32. contains: [
  33. // COMMENTS | PB IDE color: #00AAAA (Persian Green)
  34. hljs.COMMENT(';', '$', {relevance: 0}),
  35. { // PROCEDURES DEFINITIONS
  36. className: 'function',
  37. begin: '\\b(Procedure|Declare)(C|CDLL|DLL)?\\b',
  38. end: '\\(',
  39. excludeEnd: true,
  40. returnBegin: true,
  41. contains: [
  42. { // PROCEDURE KEYWORDS | PB IDE color: #006666 (Blue Stone) + Bold
  43. className: 'keyword',
  44. begin: '(Procedure|Declare)(C|CDLL|DLL)?',
  45. excludeEnd: true
  46. },
  47. { // PROCEDURE RETURN TYPE SETTING | PB IDE color: #000000 (Black)
  48. className: 'type',
  49. begin: '\\.\\w*'
  50. // end: ' ',
  51. },
  52. hljs.UNDERSCORE_TITLE_MODE // PROCEDURE NAME | PB IDE color: #006666 (Blue Stone)
  53. ]
  54. },
  55. STRINGS,
  56. CONSTANTS
  57. ]
  58. };
  59. }
  60. /* ==============================================================================
  61. CHANGELOG
  62. ==============================================================================
  63. - v.1.2 (2017-05-12)
  64. -- BUG-FIX: Some keywords were accidentally joyned together. Now fixed.
  65. - v.1.1 (2017-04-30)
  66. -- Updated to PureBASIC 5.60.
  67. -- Keywords list now built by extracting them from the PureBASIC SDK's
  68. "SyntaxHilighting.dll" (from each PureBASIC version). Tokens from each
  69. version are added to the list, and renamed or removed tokens are kept
  70. for the sake of covering all versions of the language from PureBASIC
  71. v5.00 upward. (NOTE: currently, there are no renamed or deprecated
  72. tokens in the keywords list). For more info, see:
  73. -- http://www.purebasic.fr/english/viewtopic.php?&p=506269
  74. -- https://github.com/tajmone/purebasic-archives/tree/master/syntax-highlighting/guidelines
  75. - v.1.0 (April 2016)
  76. -- First release
  77. -- Keywords list taken and adapted from GuShH's (Gustavo Julio Fiorenza)
  78. PureBasic language file for GeSHi:
  79. -- https://github.com/easybook/geshi/blob/master/geshi/purebasic.php
  80. */;