fix: correct the grammar usage, especially in the parts targeting javascript (#109)

* build: ignore gen folder

* fix: correct the grammar when targeting Typescript

* fix: move base Lexer and fix javascript syntax

* fix: correct the usage of Javascript in grammar
This commit is contained in:
Ziv
2023-05-24 15:07:53 +08:00
committed by GitHub
parent 9c82a5d248
commit eeb111b5c5
23 changed files with 231 additions and 215 deletions

View File

@ -24,10 +24,6 @@ options {
superClass=PlSqlBaseLexer;
}
@lexer::postinclude {
#include <PlSqlBaseLexer.h>
}
ABORT: 'ABORT';
ABS: 'ABS';
ACCESS: 'ACCESS';
@ -2342,17 +2338,17 @@ INTRODUCER: '_';
SINGLE_LINE_COMMENT: '--' ~('\r' | '\n')* NEWLINE_EOF -> channel(HIDDEN);
MULTI_LINE_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
// https://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve034.htm#SQPUG054
REMARK_COMMENT: 'REM' {IsNewlineAtPos(-4)}? 'ARK'? (' ' ~('\r' | '\n')*)? NEWLINE_EOF -> channel(HIDDEN);
REMARK_COMMENT: 'REM' {this.IsNewlineAtPos(-4)}? 'ARK'? (' ' ~('\r' | '\n')*)? NEWLINE_EOF -> channel(HIDDEN);
// https://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve032.htm#SQPUG052
PROMPT_MESSAGE: 'PRO' {IsNewlineAtPos(-4)}? 'MPT'? (' ' ~('\r' | '\n')*)? NEWLINE_EOF;
PROMPT_MESSAGE: 'PRO' {this.IsNewlineAtPos(-4)}? 'MPT'? (' ' ~('\r' | '\n')*)? NEWLINE_EOF;
// TODO: should starts with newline
START_CMD
//: 'STA' 'RT'? SPACE ~('\r' | '\n')* NEWLINE_EOF
// https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12002.htm
// https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12003.htm
: '@' {IsNewlineAtPos(-2)}? '@'? ~('\r' | '\n')* NEWLINE_EOF
: '@' {this.IsNewlineAtPos(-2)}? '@'? ~('\r' | '\n')* NEWLINE_EOF
;
REGULAR_ID: SIMPLE_LETTER (SIMPLE_LETTER | '$' | '_' | '#' | [0-9])*;
@ -2366,4 +2362,4 @@ fragment QUESTION_MARK : '?';
fragment SIMPLE_LETTER : [A-Z];
fragment FLOAT_FRAGMENT : UNSIGNED_INTEGER* '.'? UNSIGNED_INTEGER+;
fragment NEWLINE : '\r'? '\n';
fragment SPACE : [ \t];
fragment SPACE : [ \t];

View File

@ -25,10 +25,6 @@ options {
superClass=PlSqlBaseParser;
}
@parser::postinclude {
#include <PlSqlBaseParser.h>
}
program: sql_script EOF;
sql_script
@ -2254,7 +2250,7 @@ partial_database_recovery
;
partial_database_recovery_10g
: {isVersion10()}? STANDBY
: {this.isVersion10()}? STANDBY
( TABLESPACE tablespace (',' tablespace)*
| DATAFILE CHAR_STRING | filenumber (',' CHAR_STRING | filenumber)*
)
@ -6760,4 +6756,4 @@ numeric_function_name
| NVL
| ROUND
| SUM
;
;