mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.cpp
git-svn-id: svn://ultimatepp.org/upp/trunk@8436 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
75304bcf39
commit
9ffdf5e847
3 changed files with 23 additions and 15 deletions
|
|
@ -8,6 +8,8 @@ NAMESPACE_UPP
|
|||
bool IsCPPFile(const String& file);
|
||||
bool IsHFile(const String& path);
|
||||
|
||||
const char *SkipString(const char *s);
|
||||
|
||||
void RemoveComments(String& l, bool& incomment);
|
||||
|
||||
void LoadPPConfig(const String& json);
|
||||
|
|
@ -122,7 +124,6 @@ struct Cpp {
|
|||
|
||||
void Define(const char *s);
|
||||
|
||||
static const char *SkipString(const char *s);
|
||||
void ParamAdd(Vector<String>& param, const char *b, const char *e);
|
||||
String Expand(const char *s);
|
||||
void DoFlatInclude(const String& header_path);
|
||||
|
|
|
|||
|
|
@ -5,19 +5,6 @@ NAMESPACE_UPP
|
|||
#define LTIMING(x) RTIMING(x)
|
||||
#define LLOG(x) // DLOG(x)
|
||||
|
||||
const char *Cpp::SkipString(const char *s)
|
||||
{
|
||||
CParser p(s);
|
||||
try {
|
||||
p.ReadOneString(*s);
|
||||
}
|
||||
catch(CParser::Error) {}
|
||||
s = p.GetPtr();
|
||||
while((byte)*(s - 1) <= ' ')
|
||||
s--;
|
||||
return s;
|
||||
}
|
||||
|
||||
void Cpp::ParamAdd(Vector<String>& param, const char *s, const char *e)
|
||||
{
|
||||
while(s < e && (byte)*s <= ' ') s++;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,19 @@ void SetSpaces(String& l, int pos, int count)
|
|||
l = s;
|
||||
}
|
||||
|
||||
const char *SkipString(const char *s)
|
||||
{
|
||||
CParser p(s);
|
||||
try {
|
||||
p.ReadOneString(*s);
|
||||
}
|
||||
catch(CParser::Error) {}
|
||||
s = p.GetPtr();
|
||||
while((byte)*(s - 1) <= ' ')
|
||||
s--;
|
||||
return s;
|
||||
}
|
||||
|
||||
void RemoveComments(String& l, bool& incomment)
|
||||
{
|
||||
int q = -1;
|
||||
|
|
@ -29,7 +42,14 @@ void RemoveComments(String& l, bool& incomment)
|
|||
if(incomment)
|
||||
q = w = 0;
|
||||
else {
|
||||
q = l.Find("/*");
|
||||
const char *s = l;
|
||||
while(*s) {
|
||||
if(*s == '\"')
|
||||
s = SkipString(s);
|
||||
else
|
||||
if(s[0] == '/' && s[1] == '*')
|
||||
q = int(s - ~l);
|
||||
}
|
||||
if(q >= 0)
|
||||
w = q + 2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue