version 4.3.1
PICodeParser now works with multi-line macros
This commit is contained in:
@@ -343,6 +343,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
||||
static const PIString s_typedef = PIStringAscii("typedef");
|
||||
static const PIString s_namespace = PIStringAscii("namespace");
|
||||
static const PIString s_template = PIStringAscii("template");
|
||||
static const PIString s_L = PIStringAscii("$L");
|
||||
|
||||
bool mlc = false, cc = false;
|
||||
int mls = 0, ole = -1, /*ccs = 0,*/ end = 0;
|
||||
@@ -365,8 +366,9 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
||||
}
|
||||
if (i > 0)
|
||||
if (c == '\\' && fc[i - 1].toAscii() != '\\') {
|
||||
fc.cutMid(i, 2);
|
||||
--i;
|
||||
fc.cutMid(i, 1);
|
||||
fc.replace(i, 1, s_L);
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (cc) continue;
|
||||
@@ -390,6 +392,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
||||
}
|
||||
}
|
||||
pfc = procMacros(fc);
|
||||
pfc.removeAll(s_L);
|
||||
|
||||
if (main) return true;
|
||||
|
||||
@@ -1248,6 +1251,7 @@ PIString PICodeParser::procMacros(PIString fc) {
|
||||
static const PIString s_elif = PIStringAscii("elif");
|
||||
static const PIString s_else = PIStringAscii("else");
|
||||
static const PIString s_endif = PIStringAscii("endif");
|
||||
static const PIString s_L = PIStringAscii("$L");
|
||||
if (fc.isEmpty()) return PIString();
|
||||
int ifcnt = 0;
|
||||
bool grab = false, skip = false, cond_ok = false;
|
||||
@@ -1337,7 +1341,9 @@ bool PICodeParser::parseDirective(PIString d) {
|
||||
static const PIString s_define = PIStringAscii("define");
|
||||
static const PIString s_undef = PIStringAscii("undef");
|
||||
static const PIString s_PIMETA = PIStringAscii("PIMETA");
|
||||
static const PIString s_L = PIStringAscii("$L");
|
||||
if (d.isEmpty()) return true;
|
||||
d.replaceAll(s_L, '\n');
|
||||
PIString dname = d.takeCWord();
|
||||
// piCout << "parseDirective" << d;
|
||||
if (dname == s_include) {
|
||||
|
||||
Reference in New Issue
Block a user