Skip to content

Commit

Permalink
chore: sql preprocessor don't consume end dot
Browse files Browse the repository at this point in the history
  • Loading branch information
ishche committed May 13, 2024
1 parent 005917e commit 0094f34
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ options {tokenVocab = Db2SqlLexer; superClass = MessageServiceParser;}
startRule: .*? (execRule .*?) * EOF;
//startIncludeRule: .*? (includeStatement .*?)* EOF;

execRule: EXEC SQL sqlCode END_EXEC DOT_FS?
| EXEC SQL END_EXEC DOT_FS?
| EXEC SQLIMS sqlCode END_EXEC DOT_FS? // TODO: check when should this grammar be activated. Probably based on some compiler directives
| {notifyError("cobolParser.missingEndExec");} EXEC SQL sqlCode DOT_FS? EOF
execRule: EXEC SQL sqlCode END_EXEC
| EXEC SQL END_EXEC
| EXEC SQLIMS sqlCode END_EXEC // TODO: check when should this grammar be activated. Probably based on some compiler directives
| {notifyError("cobolParser.missingEndExec");} EXEC SQL sqlCode EOF
| {notifyError("cobolParser.missingEndExec");} EXEC SQL;

sqlCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
PROCEDURE DIVISION.
EXEC CICS HANDLE ABEND
END-EXEC.
.
Original file line number Diff line number Diff line change
Expand Up @@ -533,5 +533,5 @@ cobolWord
;

dialectNodeFiller
: ZERO_WIDTH_SPACE+
: ZERO_WIDTH_SPACE+ DOT_FS? EOF?
;
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,5 @@ cobolWord
;

dialectNodeFiller
: ZERO_WIDTH_SPACE+
: ZERO_WIDTH_SPACE+ DOT_FS? EOF?
;
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ procedureSection

sentence
: statement * (endClause | dialectStatement)
| dialectStatement
;

paragraph
Expand Down Expand Up @@ -2207,7 +2208,7 @@ literal
: NONNUMERICLITERAL | figurativeConstant | numericLiteral | booleanLiteral | charString | dialectLiteral | utfLiteral | hexadecimalUtfLiteral
;

dialectLiteral: dialectNodeFiller+;
dialectLiteral: dialectNodeFiller+ DOT_FS?;

utfLiteral: U_CHAR NONNUMERICLITERAL;

Expand Down Expand Up @@ -2244,7 +2245,7 @@ power
;

basis
: dialectNodeFiller | generalIdentifier | literal | LPARENCHAR arithmeticExpression RPARENCHAR
: (dialectNodeFiller DOT_FS?) | generalIdentifier | literal | LPARENCHAR arithmeticExpression RPARENCHAR
;

cobolWord
Expand All @@ -2263,7 +2264,7 @@ cobolKeywords
;

dialectNodeFiller
: ZERO_WIDTH_SPACE+
: ZERO_WIDTH_SPACE+ DOT_FS? EOF?
;

dot_fs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ COMMENTLINE : COMMENTTAG ~('\n' | '\r')* -> channel(COMMENTS);
WS : [ \t\f]+ -> channel(HIDDEN);
COMPILERLINE : DOUBLEMORETHANCHAR ~('\n' | '\r')* -> channel(HIDDEN);
// period full stopPosition
DOT : '.';
DOT_FS : '.' EOF?;

LEVEL_NUMBER : ([1-9])|([0][1-9])|([1234][0-9]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ paragraph

sentence
: statement * (endClause | dialectStatement)
| dialectStatement
;

conditionalStatementCall
Expand Down Expand Up @@ -1499,5 +1500,5 @@ cobolKeywords
;

dialectNodeFiller
: ZERO_WIDTH_SPACE+
: ZERO_WIDTH_SPACE+ DOT? EOF?
;

0 comments on commit 0094f34

Please sign in to comment.