basic.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. module.exports = function(hljs) {
  2. return {
  3. case_insensitive: true,
  4. illegal: '^\.',
  5. // Support explicitely typed variables that end with $%! or #.
  6. lexemes: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
  7. keywords: {
  8. keyword:
  9. 'ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE ' +
  10. 'CLEAR CLOSE CLS COLOR COM COMMON CONT COS CSNG CSRLIN CVD CVI CVS DATA DATE$ ' +
  11. 'DEFDBL DEFINT DEFSNG DEFSTR DEF|0 SEG USR DELETE DIM DRAW EDIT END ENVIRON ENVIRON$ ' +
  12. 'EOF EQV ERASE ERDEV ERDEV$ ERL ERR ERROR EXP FIELD FILES FIX FOR|0 FRE GET GOSUB|10 GOTO ' +
  13. 'HEX$ IF THEN ELSE|0 INKEY$ INP INPUT INPUT# INPUT$ INSTR IMP INT IOCTL IOCTL$ KEY ON ' +
  14. 'OFF LIST KILL LEFT$ LEN LET LINE LLIST LOAD LOC LOCATE LOF LOG LPRINT USING LSET ' +
  15. 'MERGE MID$ MKDIR MKD$ MKI$ MKS$ MOD NAME NEW NEXT NOISE NOT OCT$ ON OR PEN PLAY STRIG OPEN OPTION ' +
  16. 'BASE OUT PAINT PALETTE PCOPY PEEK PMAP POINT POKE POS PRINT PRINT] PSET PRESET ' +
  17. 'PUT RANDOMIZE READ REM RENUM RESET|0 RESTORE RESUME RETURN|0 RIGHT$ RMDIR RND RSET ' +
  18. 'RUN SAVE SCREEN SGN SHELL SIN SOUND SPACE$ SPC SQR STEP STICK STOP STR$ STRING$ SWAP ' +
  19. 'SYSTEM TAB TAN TIME$ TIMER TROFF TRON TO USR VAL VARPTR VARPTR$ VIEW WAIT WHILE ' +
  20. 'WEND WIDTH WINDOW WRITE XOR'
  21. },
  22. contains: [
  23. hljs.QUOTE_STRING_MODE,
  24. hljs.COMMENT('REM', '$', {relevance: 10}),
  25. hljs.COMMENT('\'', '$', {relevance: 0}),
  26. {
  27. // Match line numbers
  28. className: 'symbol',
  29. begin: '^[0-9]+\ ',
  30. relevance: 10
  31. },
  32. {
  33. // Match typed numeric constants (1000, 12.34!, 1.2e5, 1.5#, 1.2D2)
  34. className: 'number',
  35. begin: '\\b([0-9]+[0-9edED\.]*[#\!]?)',
  36. relevance: 0
  37. },
  38. {
  39. // Match hexadecimal numbers (&Hxxxx)
  40. className: 'number',
  41. begin: '(\&[hH][0-9a-fA-F]{1,4})'
  42. },
  43. {
  44. // Match octal numbers (&Oxxxxxx)
  45. className: 'number',
  46. begin: '(\&[oO][0-7]{1,6})'
  47. }
  48. ]
  49. };
  50. };