| 6dd74de | | | 1 | // Base terminals and fragments for common language constructs |
| 6dd74de | | | 2 | // Terminal Precedence: Lazy to Greedy |
| 6dd74de | | | 3 | // When imported, the terminals are considered after the terminals in the importing grammar |
| 6dd74de | | | 4 | // Note: Hence, to add a terminal greedier than the common terminals, import it separately after the common import |
| 6dd74de | | | 5 | |
| 6dd74de | | | 6 | EOL returns string: NEWLINE+ | EOF; |
| 6dd74de | | | 7 | |
| 6dd74de | | | 8 | fragment TitleAndAccessibilities: |
| 6dd74de | | | 9 | ((accDescr=ACC_DESCR | accTitle=ACC_TITLE | title=TITLE) EOL)+ |
| 6dd74de | | | 10 | ; |
| 6dd74de | | | 11 | |
| 6dd74de | | | 12 | terminal BOOLEAN returns boolean: 'true' | 'false'; |
| 6dd74de | | | 13 | |
| 6dd74de | | | 14 | terminal ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/; |
| 6dd74de | | | 15 | terminal ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/; |
| 6dd74de | | | 16 | terminal TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/; |
| 6dd74de | | | 17 | |
| 6dd74de | | | 18 | terminal FLOAT returns number: /[0-9]+\.[0-9]+(?!\.)/; |
| 6dd74de | | | 19 | terminal INT returns number: /0|[1-9][0-9]*(?!\.)/; |
| 6dd74de | | | 20 | terminal NUMBER returns number: FLOAT | INT; |
| 6dd74de | | | 21 | |
| 6dd74de | | | 22 | terminal STRING returns string: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/; |
| 6dd74de | | | 23 | |
| 6dd74de | | | 24 | // Alphanumerics with underscores and dashes |
| 6dd74de | | | 25 | // Must start with an alphanumeric or an underscore |
| 6dd74de | | | 26 | // Cant end with a dash |
| 6dd74de | | | 27 | terminal ID returns string: /[\w]([-\w]*\w)?/; |
| 6dd74de | | | 28 | |
| 6dd74de | | | 29 | terminal NEWLINE: /\r?\n/; |
| 6dd74de | | | 30 | |
| 6dd74de | | | 31 | hidden terminal WHITESPACE: /[\t ]+/; |
| 6dd74de | | | 32 | hidden terminal YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/; |
| 6dd74de | | | 33 | hidden terminal DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/; |
| 6dd74de | | | 34 | hidden terminal SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/; |