drupal-civicrm/sites/all/modules/civicrm/bower_components/google-code-prettify/src/lang-basic.js
2018-01-14 13:10:16 +00:00

33 lines
1.4 KiB
JavaScript

// 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\n]|\\.)*(?:"|$))/, null, '"'],
// Whitespace
[PR.PR_PLAIN, /^\s+/, null, ' \r\n\t\xA0']
],
[ // fallthroughStylePatterns
// A line comment that starts with REM
[PR.PR_COMMENT, /^REM[^\r\n]*/, 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']);