78 lines
1.3 KiB
Plaintext
78 lines
1.3 KiB
Plaintext
|
|
I had to change grammar, as follows :
|
||
|
|
|
||
|
|
PlSqlLexer.g4
|
||
|
|
|
||
|
|
all string litterals are changed with normal letters (without quotes), and after, there is definition for letters like :
|
||
|
|
|
||
|
|
fragment A: [aA];
|
||
|
|
fragment B: [bB];
|
||
|
|
fragment C: [cC];
|
||
|
|
fragment D: [dD];
|
||
|
|
fragment E: [eE];
|
||
|
|
fragment F: [fF];
|
||
|
|
fragment G: [gG];
|
||
|
|
fragment H: [hH];
|
||
|
|
fragment I: [iI];
|
||
|
|
fragment J: [jJ];
|
||
|
|
fragment K: [kK];
|
||
|
|
fragment L: [lL];
|
||
|
|
fragment M: [mM];
|
||
|
|
fragment N: [nN];
|
||
|
|
fragment O: [oO];
|
||
|
|
fragment P: [pP];
|
||
|
|
fragment Q: [qQ];
|
||
|
|
fragment R: [rR];
|
||
|
|
fragment S: [sS];
|
||
|
|
fragment T: [tT];
|
||
|
|
fragment U: [uU];
|
||
|
|
fragment V: [vV];
|
||
|
|
fragment W: [wW];
|
||
|
|
fragment X: [xX];
|
||
|
|
fragment Y: [yY];
|
||
|
|
fragment Z: [zZ];
|
||
|
|
|
||
|
|
also, change this :
|
||
|
|
|
||
|
|
fragment
|
||
|
|
SIMPLE_LETTER
|
||
|
|
: [A-Z]
|
||
|
|
;
|
||
|
|
|
||
|
|
to this :
|
||
|
|
|
||
|
|
fragment
|
||
|
|
SIMPLE_LETTER
|
||
|
|
: 'a'..'z'
|
||
|
|
| 'A'..'Z'
|
||
|
|
;
|
||
|
|
|
||
|
|
after changing litterals, it's safe to replace next strings (in both, PlSqlLexer.g4 and PlSqlParser.g4)
|
||
|
|
|
||
|
|
NULL -> HAMO
|
||
|
|
null -> hamo
|
||
|
|
|
||
|
|
NAN -> MUJO
|
||
|
|
nan -> mujo
|
||
|
|
|
||
|
|
OVERFLOW -> HASO
|
||
|
|
overflow -> haso
|
||
|
|
|
||
|
|
|
||
|
|
______
|
||
|
|
|
||
|
|
Building small c++ library for antlr with just one function
|
||
|
|
|
||
|
|
library is in antlr-library.cpp
|
||
|
|
|
||
|
|
compile with command :
|
||
|
|
|
||
|
|
g++ -c -I runtime-linux/antlr4-runtime/ -I generated -std=c++11 antlr-library.cpp -o antlr-library.o
|
||
|
|
|
||
|
|
make static library with command :
|
||
|
|
|
||
|
|
ar rcs antlr-library.a antlr-library.o
|
||
|
|
|
||
|
|
-------------------
|
||
|
|
|
||
|
|
Note :
|
||
|
|
Should link with runtime library staticly
|