-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement painless error reporting in monaco
- Loading branch information
1 parent
3958cdd
commit 9321231
Showing
24 changed files
with
9,326 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
lexer grammar PainlessLexer; | ||
|
||
WS: [ \t\n\r]+ -> skip; | ||
COMMENT: ( '//' .*? [\n\r] | '/*' .*? '*/' ) -> skip; | ||
|
||
LBRACK: '{'; | ||
RBRACK: '}'; | ||
LBRACE: '['; | ||
RBRACE: ']'; | ||
LP: '('; | ||
RP: ')'; | ||
// We switch modes after a dot to ensure there are not conflicts | ||
// between shortcuts and decimal values. Without the mode switch | ||
// shortcuts such as id.0.0 will fail because 0.0 will be interpreted | ||
// as a decimal value instead of two individual list-style shortcuts. | ||
DOT: '.' -> mode(AFTER_DOT); | ||
NSDOT: '?.' -> mode(AFTER_DOT); | ||
COMMA: ','; | ||
SEMICOLON: ';'; | ||
IF: 'if'; | ||
IN: 'in'; | ||
ELSE: 'else'; | ||
WHILE: 'while'; | ||
DO: 'do'; | ||
FOR: 'for'; | ||
CONTINUE: 'continue'; | ||
BREAK: 'break'; | ||
RETURN: 'return'; | ||
NEW: 'new'; | ||
TRY: 'try'; | ||
CATCH: 'catch'; | ||
THROW: 'throw'; | ||
THIS: 'this'; | ||
INSTANCEOF: 'instanceof'; | ||
|
||
BOOLNOT: '!'; | ||
BWNOT: '~'; | ||
MUL: '*'; | ||
DIV: '/' { this.isSlashRegex() == false }?; | ||
REM: '%'; | ||
ADD: '+'; | ||
SUB: '-'; | ||
LSH: '<<'; | ||
RSH: '>>'; | ||
USH: '>>>'; | ||
LT: '<'; | ||
LTE: '<='; | ||
GT: '>'; | ||
GTE: '>='; | ||
EQ: '=='; | ||
EQR: '==='; | ||
NE: '!='; | ||
NER: '!=='; | ||
BWAND: '&'; | ||
XOR: '^'; | ||
BWOR: '|'; | ||
BOOLAND: '&&'; | ||
BOOLOR: '||'; | ||
COND: '?'; | ||
COLON: ':'; | ||
ELVIS: '?:'; | ||
REF: '::'; | ||
ARROW: '->'; | ||
FIND: '=~'; | ||
MATCH: '==~'; | ||
INCR: '++'; | ||
DECR: '--'; | ||
|
||
ASSIGN: '='; | ||
AADD: '+='; | ||
ASUB: '-='; | ||
AMUL: '*='; | ||
ADIV: '/='; | ||
AREM: '%='; | ||
AAND: '&='; | ||
AXOR: '^='; | ||
AOR: '|='; | ||
ALSH: '<<='; | ||
ARSH: '>>='; | ||
AUSH: '>>>='; | ||
|
||
OCTAL: '0' [0-7]+ [lL]?; | ||
HEX: '0' [xX] [0-9a-fA-F]+ [lL]?; | ||
INTEGER: ( '0' | [1-9] [0-9]* ) [lLfFdD]?; | ||
DECIMAL: ( '0' | [1-9] [0-9]* ) (DOT [0-9]+)? ( [eE] [+\-]? [0-9]+ )? [fFdD]?; | ||
|
||
STRING: ( '"' ( '\\"' | '\\\\' | ~[\\"] )*? '"' ) | ( '\'' ( '\\\'' | '\\\\' | ~[\\'] )*? '\'' ); | ||
REGEX: '/' ( '\\' ~'\n' | ~('/' | '\n') )+? '/' [cilmsUux]* { this.isSlashRegex() }?; | ||
|
||
TRUE: 'true'; | ||
FALSE: 'false'; | ||
|
||
NULL: 'null'; | ||
|
||
PRIMITIVE: 'boolean' | 'byte' | 'short' | 'char' | 'int' | 'long' | 'float' | 'double'; | ||
DEF: 'def'; | ||
|
||
ID: [_a-zA-Z] [_a-zA-Z0-9]*; | ||
|
||
mode AFTER_DOT; | ||
|
||
DOTINTEGER: ( '0' | [1-9] [0-9]* ) -> mode(DEFAULT_MODE); | ||
DOTID: [_a-zA-Z] [_a-zA-Z0-9]* -> mode(DEFAULT_MODE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
WS=1 | ||
COMMENT=2 | ||
LBRACK=3 | ||
RBRACK=4 | ||
LBRACE=5 | ||
RBRACE=6 | ||
LP=7 | ||
RP=8 | ||
DOT=9 | ||
NSDOT=10 | ||
COMMA=11 | ||
SEMICOLON=12 | ||
IF=13 | ||
IN=14 | ||
ELSE=15 | ||
WHILE=16 | ||
DO=17 | ||
FOR=18 | ||
CONTINUE=19 | ||
BREAK=20 | ||
RETURN=21 | ||
NEW=22 | ||
TRY=23 | ||
CATCH=24 | ||
THROW=25 | ||
THIS=26 | ||
INSTANCEOF=27 | ||
BOOLNOT=28 | ||
BWNOT=29 | ||
MUL=30 | ||
DIV=31 | ||
REM=32 | ||
ADD=33 | ||
SUB=34 | ||
LSH=35 | ||
RSH=36 | ||
USH=37 | ||
LT=38 | ||
LTE=39 | ||
GT=40 | ||
GTE=41 | ||
EQ=42 | ||
EQR=43 | ||
NE=44 | ||
NER=45 | ||
BWAND=46 | ||
XOR=47 | ||
BWOR=48 | ||
BOOLAND=49 | ||
BOOLOR=50 | ||
COND=51 | ||
COLON=52 | ||
ELVIS=53 | ||
REF=54 | ||
ARROW=55 | ||
FIND=56 | ||
MATCH=57 | ||
INCR=58 | ||
DECR=59 | ||
ASSIGN=60 | ||
AADD=61 | ||
ASUB=62 | ||
AMUL=63 | ||
ADIV=64 | ||
AREM=65 | ||
AAND=66 | ||
AXOR=67 | ||
AOR=68 | ||
ALSH=69 | ||
ARSH=70 | ||
AUSH=71 | ||
OCTAL=72 | ||
HEX=73 | ||
INTEGER=74 | ||
DECIMAL=75 | ||
STRING=76 | ||
REGEX=77 | ||
TRUE=78 | ||
FALSE=79 | ||
NULL=80 | ||
PRIMITIVE=81 | ||
DEF=82 | ||
ID=83 | ||
DOTINTEGER=84 | ||
DOTID=85 | ||
'{'=3 | ||
'}'=4 | ||
'['=5 | ||
']'=6 | ||
'('=7 | ||
')'=8 | ||
'.'=9 | ||
'?.'=10 | ||
','=11 | ||
';'=12 | ||
'if'=13 | ||
'in'=14 | ||
'else'=15 | ||
'while'=16 | ||
'do'=17 | ||
'for'=18 | ||
'continue'=19 | ||
'break'=20 | ||
'return'=21 | ||
'new'=22 | ||
'try'=23 | ||
'catch'=24 | ||
'throw'=25 | ||
'this'=26 | ||
'instanceof'=27 | ||
'!'=28 | ||
'~'=29 | ||
'*'=30 | ||
'/'=31 | ||
'%'=32 | ||
'+'=33 | ||
'-'=34 | ||
'<<'=35 | ||
'>>'=36 | ||
'>>>'=37 | ||
'<'=38 | ||
'<='=39 | ||
'>'=40 | ||
'>='=41 | ||
'=='=42 | ||
'==='=43 | ||
'!='=44 | ||
'!=='=45 | ||
'&'=46 | ||
'^'=47 | ||
'|'=48 | ||
'&&'=49 | ||
'||'=50 | ||
'?'=51 | ||
':'=52 | ||
'?:'=53 | ||
'::'=54 | ||
'->'=55 | ||
'=~'=56 | ||
'==~'=57 | ||
'++'=58 | ||
'--'=59 | ||
'='=60 | ||
'+='=61 | ||
'-='=62 | ||
'*='=63 | ||
'/='=64 | ||
'%='=65 | ||
'&='=66 | ||
'^='=67 | ||
'|='=68 | ||
'<<='=69 | ||
'>>='=70 | ||
'>>>='=71 | ||
'true'=78 | ||
'false'=79 | ||
'null'=80 | ||
'def'=82 |
Oops, something went wrong.