version 4.3.1

PICodeParser now works with multi-line macros
This commit is contained in:
2024-10-23 19:11:46 +03:00
parent 7cd2f7a310
commit 9f1d23ad8e
2 changed files with 9 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(PIP) project(PIP)
set(PIP_MAJOR 4) set(PIP_MAJOR 4)
set(PIP_MINOR 3) set(PIP_MINOR 3)
set(PIP_REVISION 0) set(PIP_REVISION 1)
set(PIP_SUFFIX ) set(PIP_SUFFIX )
set(PIP_COMPANY SHS) set(PIP_COMPANY SHS)
set(PIP_DOMAIN org.SHS) set(PIP_DOMAIN org.SHS)

View File

@@ -343,6 +343,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
static const PIString s_typedef = PIStringAscii("typedef"); static const PIString s_typedef = PIStringAscii("typedef");
static const PIString s_namespace = PIStringAscii("namespace"); static const PIString s_namespace = PIStringAscii("namespace");
static const PIString s_template = PIStringAscii("template"); static const PIString s_template = PIStringAscii("template");
static const PIString s_L = PIStringAscii("$L");
bool mlc = false, cc = false; bool mlc = false, cc = false;
int mls = 0, ole = -1, /*ccs = 0,*/ end = 0; int mls = 0, ole = -1, /*ccs = 0,*/ end = 0;
@@ -365,8 +366,9 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
} }
if (i > 0) if (i > 0)
if (c == '\\' && fc[i - 1].toAscii() != '\\') { if (c == '\\' && fc[i - 1].toAscii() != '\\') {
fc.cutMid(i, 2); fc.cutMid(i, 1);
--i; fc.replace(i, 1, s_L);
++i;
continue; continue;
} }
if (cc) continue; if (cc) continue;
@@ -390,6 +392,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
} }
} }
pfc = procMacros(fc); pfc = procMacros(fc);
pfc.removeAll(s_L);
if (main) return true; if (main) return true;
@@ -1248,6 +1251,7 @@ PIString PICodeParser::procMacros(PIString fc) {
static const PIString s_elif = PIStringAscii("elif"); static const PIString s_elif = PIStringAscii("elif");
static const PIString s_else = PIStringAscii("else"); static const PIString s_else = PIStringAscii("else");
static const PIString s_endif = PIStringAscii("endif"); static const PIString s_endif = PIStringAscii("endif");
static const PIString s_L = PIStringAscii("$L");
if (fc.isEmpty()) return PIString(); if (fc.isEmpty()) return PIString();
int ifcnt = 0; int ifcnt = 0;
bool grab = false, skip = false, cond_ok = false; 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_define = PIStringAscii("define");
static const PIString s_undef = PIStringAscii("undef"); static const PIString s_undef = PIStringAscii("undef");
static const PIString s_PIMETA = PIStringAscii("PIMETA"); static const PIString s_PIMETA = PIStringAscii("PIMETA");
static const PIString s_L = PIStringAscii("$L");
if (d.isEmpty()) return true; if (d.isEmpty()) return true;
d.replaceAll(s_L, '\n');
PIString dname = d.takeCWord(); PIString dname = d.takeCWord();
// piCout << "parseDirective" << d; // piCout << "parseDirective" << d;
if (dname == s_include) { if (dname == s_include) {