Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / lang-sc.js
blobda42d9aa81c9abf61c4cdfa88aa533f4bfaa74fc
1 PR.registerLangHandler(
2     PR.createSimpleLexer(
3     [
4         /* whitespace */
5         [PR.PR_PLAIN,       /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
6         /* strings */
7         [PR.PR_STRING,      /^"(?:[^\\"]|\\.)*(?:"|$)/, null, '"'],
8     ],
9     [
10         /* char literal */
11         [PR.PR_LITERAL,     /^\$(\\)?./],
12         /* symbols */
13         [PR.PR_ATTRIB_NAME, /^\\\w+/],
14         [PR.PR_ATTRIB_NAME, /^'[^']+'/],
15         [PR.PR_ATTRIB_VALUE, /^~\w+/],
16         /* special variables */
17         [PR.PR_TAG,         /^(?:super|thisFunctionDef|thisFunction|thisMethod|thisProcess|thisThread|this)\b/],
18         /* special values */
19         [PR.PR_KEYWORD,     /^(?:true|false|nil|inf)\b/],
20         /* variable declarations */
21         [PR.PR_DECLARATION, /^(?:var|classvar|const|arg)\b/],
22 //        [PR.PR_DECLARATION, /^\|/],
23         /* class names */
24         [PR.PR_TYPE,        /^\b([A-Z][A-Za-z_0-9]+)\b/],
25         [PR.PR_COMMENT,     /^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/], //fixme: nested comments
26         /* numbers */
27         [PR.PR_LITERAL,     /^-?\d+r[\da-zA-Z]+(\.[\da-zA-Z]+)?/],
28 //        [PR.PR_LITERAL,     /^-?(?:(?:\d+(?:\.\d*)?)(?:e[+\-]?\d+)?)(pi)?|pi/],
29         [PR.PR_LITERAL,     /^-?(?:(?:\d+(\.\d+)?)(?:e[+\-]?\d+)?(pi)?)|(?:pi\b)/],
30         /* other stuff */
31         [PR.PR_PLAIN, /^[a-z_]\w*/i],
32 //        [PR.PR_PUNCTUATION, /^[-.,;!?#$%&\|/+*<>=@()\[\]{}]/]
33         [PR.PR_PUNCTUATION, /^[-.,;#()\[\]{}]/]
34     ]),
35     ['sc']);