Õ
ÕÅÑï Santa
Recently I am developing an SQL parser with Bison++ and Flex++ under
Windows. The SQL statements we parse may contain Chinese characters in
strings. Sometimes we could successfully parse the Chinese characters,
but most often the lexer will fail, going to an endless loop and
prints "--(end of buffer or a NULL)" continuously.
Since we are parsing statements from std::string, not from input
stream, we #define some macros in our lexer.l. The INPUT_CODE macros
is #define as:
%define INPUT_CODE \
result = 0; \
while (result < max_size && pos < inputText.length()) { \
buffer[result] = inputText[pos]; \
pos++; \
result++; } \
} \
return 0;
the inputText is a member of Lexer, in which we stored the SQL
statement to be parsed. And "pos" is an int member of Lexer which
stores the number of character we've lex'ed.
Could somebody please tell us how to deal with the endless loop "--
(end of buffer or a NULL)" ? Thank you very much!
Windows. The SQL statements we parse may contain Chinese characters in
strings. Sometimes we could successfully parse the Chinese characters,
but most often the lexer will fail, going to an endless loop and
prints "--(end of buffer or a NULL)" continuously.
Since we are parsing statements from std::string, not from input
stream, we #define some macros in our lexer.l. The INPUT_CODE macros
is #define as:
%define INPUT_CODE \
result = 0; \
while (result < max_size && pos < inputText.length()) { \
buffer[result] = inputText[pos]; \
pos++; \
result++; } \
} \
return 0;
the inputText is a member of Lexer, in which we stored the SQL
statement to be parsed. And "pos" is an int member of Lexer which
stores the number of character we've lex'ed.
Could somebody please tell us how to deal with the endless loop "--
(end of buffer or a NULL)" ? Thank you very much!