Blame view

assets/plugins/google-code-prettify/lang-basic.js 1.36 KB
cf76164e6   Ting Chan   20190709
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  // Contributed by peter dot kofler at code minus cop dot org
  
  /**
   * @fileoverview
   * Registers a language handler for Basic.
   *
   * To use, include prettify.js and this file in your HTML page.
   * Then put your code in an HTML tag like
   *      <pre class="prettyprint lang-basic">(my BASIC code)</pre>
   *
   * @author peter dot kofler at code minus cop dot org
   */
  
  PR.registerLangHandler(
      PR.createSimpleLexer(
          [ // shortcutStylePatterns
            // "single-line-string"
            [PR.PR_STRING,        /^(?:"(?:[^\\"\r
  ]|\\.)*(?:"|$))/, null, '"'],
            // Whitespace
            [PR.PR_PLAIN,         /^\s+/, null, ' \r
  \t\xA0']
          ],
          [ // fallthroughStylePatterns
            // A line comment that starts with REM
            [PR.PR_COMMENT,       /^REM[^\r
  ]*/, null],
            [PR.PR_KEYWORD,       /^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/, null],
            [PR.PR_PLAIN,         /^[A-Z][A-Z0-9]?(?:\$|%)?/i, null],
            // Literals .0, 0, 0.0 0E13
            [PR.PR_LITERAL,       /^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?/i,  null, '0123456789'],
            [PR.PR_PUNCTUATION,   /^.[^\s\w\.$%"]*/, null]
            // [PR.PR_PUNCTUATION,   /^[-,:;!<>=\+^\/\*]+/]
          ]),
      ['basic','cbm']);