Parser.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | Parser.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 316 | skipping to change at line 316 | |||
UCHAR tok_class; | UCHAR tok_class; | |||
SSHORT c; | SSHORT c; | |||
// Find end of white space and skip comments | // Find end of white space and skip comments | |||
for (;;) | for (;;) | |||
{ | { | |||
if (lex.ptr >= lex.end) | if (lex.ptr >= lex.end) | |||
return false; | return false; | |||
c = *lex.ptr++; | if (yylexSkipEol()) | |||
continue; | ||||
// Process comments | // Process comments | |||
if (c == '\n') | c = *lex.ptr++; | |||
{ | ||||
lex.lines++; | ||||
lex.line_start = lex.ptr; | ||||
continue; | ||||
} | ||||
if (c == '-' && lex.ptr < lex.end && *lex.ptr == '-') | if (c == '-' && lex.ptr < lex.end && *lex.ptr == '-') | |||
{ | { | |||
// single-line | // single-line | |||
lex.ptr++; | lex.ptr++; | |||
while (lex.ptr < lex.end) | while (lex.ptr < lex.end) | |||
{ | { | |||
if ((c = *lex.ptr++) == '\n') | if (yylexSkipEol()) | |||
{ | ||||
lex.lines++; | ||||
lex.line_start = lex.ptr; // + 1; // CVC: | ||||
+1 left out. | ||||
break; | break; | |||
} | lex.ptr++; | |||
} | } | |||
if (lex.ptr >= lex.end) | if (lex.ptr >= lex.end) | |||
return false; | return false; | |||
continue; | continue; | |||
} | } | |||
else if (c == '/' && lex.ptr < lex.end && *lex.ptr == '*') | else if (c == '/' && lex.ptr < lex.end && *lex.ptr == '*') | |||
{ | { | |||
// multi-line | // multi-line | |||
const TEXT& start_block = lex.ptr[-1]; | const TEXT& start_block = lex.ptr[-1]; | |||
lex.ptr++; | lex.ptr++; | |||
while (lex.ptr < lex.end) | while (lex.ptr < lex.end) | |||
{ | { | |||
if (yylexSkipEol()) | ||||
continue; | ||||
if ((c = *lex.ptr++) == '*') | if ((c = *lex.ptr++) == '*') | |||
{ | { | |||
if (*lex.ptr == '/') | if (*lex.ptr == '/') | |||
break; | break; | |||
} | } | |||
if (c == '\n') | ||||
{ | ||||
lex.lines++; | ||||
lex.line_start = lex.ptr; // + 1; // CVC: | ||||
+1 left out. | ||||
} | ||||
} | } | |||
if (lex.ptr >= lex.end) | if (lex.ptr >= lex.end) | |||
{ | { | |||
// I need this to report the correct beginning of the block, | // I need this to report the correct beginning of the block, | |||
// since it's not a token really. | // since it's not a token really. | |||
lex.last_token = &start_block; | lex.last_token = &start_block; | |||
yyerror("unterminated block comment"); | yyerror("unterminated block comment"); | |||
return false; | return false; | |||
} | } | |||
lex.ptr++; | lex.ptr++; | |||
skipping to change at line 387 | skipping to change at line 376 | |||
tok_class = classes(c); | tok_class = classes(c); | |||
if (!(tok_class & CHR_WHITE)) | if (!(tok_class & CHR_WHITE)) | |||
break; | break; | |||
} | } | |||
return true; | return true; | |||
} | } | |||
bool Parser::yylexSkipEol() | ||||
{ | ||||
bool eol = false; | ||||
const TEXT c = *lex.ptr; | ||||
if (c == '\r') | ||||
{ | ||||
lex.ptr++; | ||||
if (lex.ptr < lex.end && *lex.ptr == '\n') | ||||
lex.ptr++; | ||||
eol = true; | ||||
} | ||||
else if (c == '\n') | ||||
{ | ||||
lex.ptr++; | ||||
eol = true; | ||||
} | ||||
if (eol) | ||||
{ | ||||
lex.lines++; | ||||
lex.line_start = lex.ptr; // + 1; // CVC: +1 left out. | ||||
} | ||||
return eol; | ||||
} | ||||
int Parser::yylexAux() | int Parser::yylexAux() | |||
{ | { | |||
thread_db* tdbb = JRD_get_thread_data(); | thread_db* tdbb = JRD_get_thread_data(); | |||
MemoryPool& pool = *tdbb->getDefaultPool(); | MemoryPool& pool = *tdbb->getDefaultPool(); | |||
SSHORT c = lex.ptr[-1]; | SSHORT c = lex.ptr[-1]; | |||
UCHAR tok_class = classes(c); | UCHAR tok_class = classes(c); | |||
char string[MAX_TOKEN_LEN]; | char string[MAX_TOKEN_LEN]; | |||
// Depending on tok_class of token, parse token | // Depending on tok_class of token, parse token | |||
End of changes. 7 change blocks. | ||||
21 lines changed or deleted | 35 lines changed or added |