mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-17 22:03:07 -06:00
Merge continued
git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
adf46bd64e
commit
2e4b276e07
3860 changed files with 1161787 additions and 438 deletions
45
uppdev/cpp2/util.cpp
Normal file
45
uppdev/cpp2/util.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "cpp.h"
|
||||
|
||||
void SetSpaces(String& l, int pos, int count)
|
||||
{
|
||||
StringBuffer s = l;
|
||||
memset(~s + pos, ' ', count);
|
||||
l = s;
|
||||
}
|
||||
|
||||
void RemoveComments(String& l, bool& incomment)
|
||||
{
|
||||
int q = -1;
|
||||
int w = -1;
|
||||
int lim = l.Find("//");
|
||||
if(incomment)
|
||||
q = w = 0;
|
||||
else {
|
||||
q = l.Find("/*");
|
||||
if(q >= 0 && q < lim)
|
||||
w = q + 2;
|
||||
}
|
||||
while(q >= 0 && q < lim) {
|
||||
int eq = l.Find("*/", w);
|
||||
if(eq < 0) {
|
||||
incomment = true;
|
||||
SetSpaces(l, q, l.GetCount() - q);
|
||||
return;
|
||||
}
|
||||
SetSpaces(l, q, eq + 2 - q);
|
||||
incomment = false;
|
||||
q = l.Find("/*");
|
||||
w = q + 2;
|
||||
}
|
||||
}
|
||||
|
||||
const Index<String>& CppKeywordsIndex()
|
||||
{
|
||||
static Index<String> id;
|
||||
ONCELOCK {
|
||||
const char **cppk = CppKeyword();
|
||||
for(int i = 0; cppk[i]; i++)
|
||||
id.Add(cppk[i]);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue