Fixed #1959 (Do you support the oracle Pro*C ?)
This commit is contained in:
parent
42dfd255e3
commit
55e0e435bd
|
@ -1701,6 +1701,30 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::s
|
|||
|
||||
createTokens(code);
|
||||
|
||||
|
||||
// remove inline SQL (Oracle PRO*C). Ticket: #1959
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
if (Token::simpleMatch(tok, "EXEC SQL"))
|
||||
{
|
||||
// delete all tokens until ";"
|
||||
while (tok && tok->str() != ";")
|
||||
tok->deleteThis();
|
||||
|
||||
// insert "asm ( ) ;"
|
||||
if (tok)
|
||||
{
|
||||
tok->insertToken("asm");
|
||||
tok = tok->next();
|
||||
tok->insertToken("(");
|
||||
tok = tok->next();
|
||||
tok->insertToken(")");
|
||||
tok = tok->next();
|
||||
tok->insertToken(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!createLinks())
|
||||
{
|
||||
// Source has syntax errors, can't proceed
|
||||
|
|
|
@ -258,6 +258,8 @@ private:
|
|||
TEST_CASE(bitfields5); // ticket #1956
|
||||
|
||||
TEST_CASE(microsoftMFC);
|
||||
|
||||
TEST_CASE(sql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4610,6 +4612,15 @@ private:
|
|||
const char code4[] = "class MyDialog : public CDialog { DECLARE_DYNAMIC_CLASS(MyDialog) private: CString text; };";
|
||||
ASSERT_EQUALS("class MyDialog : public CDialog { private: CString text ; } ;", tokenizeAndStringify(code4,false));
|
||||
}
|
||||
|
||||
void sql()
|
||||
{
|
||||
// Oracle PRO*C extensions for inline SQL. Just replace the SQL with "asm()" to fix wrong error messages
|
||||
// ticket: #1959
|
||||
const char code1[] = "; EXEC SQL SELECT A FROM B;";
|
||||
ASSERT_EQUALS("; ; asm ( ) ;", tokenizeAndStringify(code1,false));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestTokenizer)
|
||||
|
|
Loading…
Reference in New Issue