[d24f17c] | 1 | Prism.languages.antlr4 = {
|
---|
| 2 | 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
---|
| 3 | 'string': {
|
---|
| 4 | pattern: /'(?:\\.|[^\\'\r\n])*'/,
|
---|
| 5 | greedy: true
|
---|
| 6 | },
|
---|
| 7 | 'character-class': {
|
---|
| 8 | pattern: /\[(?:\\.|[^\\\]\r\n])*\]/,
|
---|
| 9 | greedy: true,
|
---|
| 10 | alias: 'regex',
|
---|
| 11 | inside: {
|
---|
| 12 | 'range': {
|
---|
| 13 | pattern: /([^[]|(?:^|[^\\])(?:\\\\)*\\\[)-(?!\])/,
|
---|
| 14 | lookbehind: true,
|
---|
| 15 | alias: 'punctuation'
|
---|
| 16 | },
|
---|
| 17 | 'escape': /\\(?:u(?:[a-fA-F\d]{4}|\{[a-fA-F\d]+\})|[pP]\{[=\w-]+\}|[^\r\nupP])/,
|
---|
| 18 | 'punctuation': /[\[\]]/
|
---|
| 19 | }
|
---|
| 20 | },
|
---|
| 21 | 'action': {
|
---|
| 22 | pattern: /\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/,
|
---|
| 23 | greedy: true,
|
---|
| 24 | inside: {
|
---|
| 25 | 'content': {
|
---|
| 26 | // this might be C, C++, Python, Java, C#, or any other language ANTLR4 compiles to
|
---|
| 27 | pattern: /(\{)[\s\S]+(?=\})/,
|
---|
| 28 | lookbehind: true
|
---|
| 29 | },
|
---|
| 30 | 'punctuation': /[{}]/
|
---|
| 31 | }
|
---|
| 32 | },
|
---|
| 33 | 'command': {
|
---|
| 34 | pattern: /(->\s*(?!\s))(?:\s*(?:,\s*)?\b[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,
|
---|
| 35 | lookbehind: true,
|
---|
| 36 | inside: {
|
---|
| 37 | 'function': /\b\w+(?=\s*(?:[,(]|$))/,
|
---|
| 38 | 'punctuation': /[,()]/
|
---|
| 39 | }
|
---|
| 40 | },
|
---|
| 41 | 'annotation': {
|
---|
| 42 | pattern: /@\w+(?:::\w+)*/,
|
---|
| 43 | alias: 'keyword'
|
---|
| 44 | },
|
---|
| 45 | 'label': {
|
---|
| 46 | pattern: /#[ \t]*\w+/,
|
---|
| 47 | alias: 'punctuation'
|
---|
| 48 | },
|
---|
| 49 | 'keyword': /\b(?:catch|channels|finally|fragment|grammar|import|lexer|locals|mode|options|parser|returns|throws|tokens)\b/,
|
---|
| 50 | 'definition': [
|
---|
| 51 | {
|
---|
| 52 | pattern: /\b[a-z]\w*(?=\s*:)/,
|
---|
| 53 | alias: ['rule', 'class-name']
|
---|
| 54 | },
|
---|
| 55 | {
|
---|
| 56 | pattern: /\b[A-Z]\w*(?=\s*:)/,
|
---|
| 57 | alias: ['token', 'constant']
|
---|
| 58 | },
|
---|
| 59 | ],
|
---|
| 60 | 'constant': /\b[A-Z][A-Z_]*\b/,
|
---|
| 61 | 'operator': /\.\.|->|[|~]|[*+?]\??/,
|
---|
| 62 | 'punctuation': /[;:()=]/
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | Prism.languages.g4 = Prism.languages.antlr4;
|
---|