HHH-14249 MultiLineImport fails when script contains blank spaces or tabs at the end of the last sql statement
This commit is contained in:
parent
425ee2d3d5
commit
112d215371
|
@ -57,16 +57,23 @@ options {
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
script
|
script
|
||||||
: (newLineToSkip)* (statement)* EOF
|
: blankSpacesToSkip (statement blankSpacesToSkip)* EOF
|
||||||
;
|
;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: { statementStarted(); } (statementPart (afterStatementPartNewline)*)* DELIMITER (newLineToSkip)* { statementEnded(); }
|
: { statementStarted(); } statementFirstPart (statementPart (afterStatementPartNewline)*)* DELIMITER { statementEnded(); }
|
||||||
|
;
|
||||||
|
|
||||||
|
statementFirstPart
|
||||||
|
: quotedString
|
||||||
|
| nonSkippedChar
|
||||||
;
|
;
|
||||||
|
|
||||||
statementPart
|
statementPart
|
||||||
: quotedString
|
: quotedString
|
||||||
| nonSkippedChar
|
| nonSkippedChar
|
||||||
|
| nonSkippedSpace
|
||||||
|
| nonSkippedTab
|
||||||
;
|
;
|
||||||
|
|
||||||
quotedString
|
quotedString
|
||||||
|
@ -75,11 +82,15 @@ quotedString
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
blankSpacesToSkip
|
||||||
|
: (newLineToSkip | spaceToSkip | tabToSkip)*
|
||||||
|
;
|
||||||
|
|
||||||
afterStatementPartNewline
|
afterStatementPartNewline
|
||||||
: n:NEWLINE {
|
: n:NEWLINE {
|
||||||
out( " " );
|
out( " " );
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
newLineToSkip
|
newLineToSkip
|
||||||
: NEWLINE {
|
: NEWLINE {
|
||||||
|
@ -87,11 +98,34 @@ newLineToSkip
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
spaceToSkip
|
||||||
|
: SPACE {
|
||||||
|
skip();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
tabToSkip
|
||||||
|
: TAB {
|
||||||
|
skip();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
nonSkippedSpace
|
||||||
|
: s:SPACE {
|
||||||
|
out( s );
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
nonSkippedTab
|
||||||
|
: t:TAB {
|
||||||
|
out( t );
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
nonSkippedChar
|
nonSkippedChar
|
||||||
: c:CHAR {
|
: c:CHAR {
|
||||||
out( c );
|
out( c );
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,9 +158,16 @@ protected
|
||||||
ESCqs : '\'' '\'' ;
|
ESCqs : '\'' '\'' ;
|
||||||
|
|
||||||
CHAR
|
CHAR
|
||||||
: ( ' ' | '\t' ) => ( ' ' | '\t' )
|
: ~( ';' | '\n' | '\r' | ' ' | '\t')
|
||||||
| ~( ';' | '\n' | '\r' )
|
;
|
||||||
;
|
|
||||||
|
SPACE
|
||||||
|
: ' '
|
||||||
|
;
|
||||||
|
|
||||||
|
TAB
|
||||||
|
: '\t'
|
||||||
|
;
|
||||||
|
|
||||||
NEWLINE
|
NEWLINE
|
||||||
: ( '\r' | '\n' | '\r''\n' )
|
: ( '\r' | '\n' | '\r''\n' )
|
||||||
|
|
Loading…
Reference in New Issue