SCDocParser: filter out \r (carriage return) when reading file, also improved String...
[supercollider.git] / HelpSource / lang-sc.js
blob19e69fd58f013e17690c8659551eb918f290feb3
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         /* special variables */
16         [PR.PR_TAG,         /^(?:super|thisFunctionDef|thisFunction|thisMethod|thisProcess|thisThread|this)\b/],
17         /* special values */
18         [PR.PR_KEYWORD,     /^(?:true|false|nil|inf)\b/],
19         /* variable declarations */
20         [PR.PR_DECLARATION, /^(?:var|classvar|const|arg)\b/],
21 //        [PR.PR_DECLARATION, /^\|/],
22         /* class names */
23         [PR.PR_TYPE,        /^\b([A-Z][A-Za-z_0-9]+)\b/],
24         [PR.PR_COMMENT,     /^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/], //fixme: nested comments
25         /* numbers */
26         [PR.PR_LITERAL,     /^-?\d+r[\da-zA-Z]+(\.[\da-zA-Z]+)?/],
27 //        [PR.PR_LITERAL,     /^-?(?:(?:\d+(?:\.\d*)?)(?:e[+\-]?\d+)?)(pi)?|pi/],
28         [PR.PR_LITERAL,     /^-?(?:(?:\d+(\.\d+)?)(?:e[+\-]?\d+)?)(pi)?|pi/],
29         /* other stuff */
30         [PR.PR_PLAIN, /^[a-z_]\w*/i],
31 //        [PR.PR_PUNCTUATION, /^[-.,;!#$%&/+*<>=@()\[\]{}]/]
32         [PR.PR_PUNCTUATION, /^[-.,;!?#$%&\|/+*<>=@()\[\]{}]/]
33     ]),
34     ['sc']);