本文整理汇总了C++中CLanguageProxy::Text方法的典型用法代码示例。如果您正苦于以下问题:C++ CLanguageProxy::Text方法的具体用法?C++ CLanguageProxy::Text怎么用?C++ CLanguageProxy::Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLanguageProxy
的用法示例。
在下文中一共展示了CLanguageProxy::Text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Balance
_EXPORT bool Balance(CLanguageProxy& proxy, int32& start, int32& end)
{
bool in = false;
const char *txt = proxy.Text(), *st;
int32 size = proxy.Size();
if (start < 0 || start > end || end > size)
return false;
st = txt + start;
while (txt < st)
{
const char *t = in ? skip_in(txt + 1) : skip_out(txt + 1);
in = !in;
if (*t && t > st)
{
start = txt - proxy.Text() + 1;
end = t - proxy.Text();
return true;
}
txt = t;
}
return false;
} /* Balance */
示例2: FindNextWord
_EXPORT int32 FindNextWord(const CLanguageProxy& proxy)
{
int32 mark = 0, i = 0;
int32 unicode, state, len;
const char *txt = proxy.Text();
state = 1;
while (state && i < proxy.Size())
{
proxy.CharInfo(txt + i, unicode, len);
if (proxy.isspace_uc(unicode))
{
state = 0;
}
else
{
mark = i + len - 1;
}
i += len;
}
return mark;
} /* FindNextWord */
示例3: FindNextWord
int32 FindNextWord(const CLanguageProxy& proxy)
{
int32 mark = 0, i = 0;
int32 unicode, state, len;
state = 1;
while (state > 0 && i < proxy.Size())
{
proxy.CharInfo(proxy.Text() + i, unicode, len);
int cl = 0;
if (unicode == '\n')
cl = 3;
else if (proxy.isspace_uc(unicode))
cl = 2;
else if (proxy.isalnum_uc(unicode))
cl = 4;
else
switch (unicode)
{
case 160:
case 8199:
case 8209:
cl = 1;
break;
case '&':
case '*':
case '+':
case '-':
// case '/':
// case '<':
case '=':
// case '>':
case '\\':
case '^':
case '|':
cl = 5;
break;
default:
cl = 4;
}
unsigned char t = kWordWrapTable[(state - 1) * 6 + cl];
state = t & 0x7f;
if (t & 0x80)
mark = i + len - 1;
i += len;
}
return mark;
} /* FindNextWord */
示例4: add_to_popup
void add_to_popup(const char* name, PopupList &pul, CLanguageProxy& proxy)
{
if (pul.size() > 0)
{
proxy.AddSeparator(name);
for (uint i=0; i<pul.size(); i++)
{
proxy.AddFunction(pul[i].label.String(), pul[i].text.String(),
pul[i].position - proxy.Text(), pul[i].italic);
}
}
}
示例5: strncmp
// ColorLine
_EXPORT
void
ColorLine(CLanguageProxy& proxy, int32& /*state*/)
{
if (strncmp(proxy.Text(), "diff", 4) == 0
|| strncmp(proxy.Text(), "@@", 2) == 0) {
proxy.SetColor(0, kColorComment1);
} else if (*proxy.Text() == '-' || *proxy.Text() == '<') {
proxy.SetColor(0, kColorError1);
} else if (*proxy.Text() == '+' || *proxy.Text() == '>') {
proxy.SetColor(0, kColorString1);
} else
proxy.SetColor(0, kColorText);
}
示例6: ScanForFunctions
void ScanForFunctions(CLanguageProxy& proxy)
{
const char *text = proxy.Text(), *max = text + proxy.Size();
if (*max != 0) return;
while (text < max)
{
text = comment(text);
switch (*text++)
{
case 'c':
case 'C':
if (!strncasecmp(text, "onstructor", 10)) text = parseFunction(text + 10, proxy);
break;
case 'd':
case 'D':
if (!strncasecmp(text, "estructor", 9)) text = parseFunction(text + 9, proxy);
break;
case 'f':
case 'F':
if (!strncasecmp(text, "unction", 7))
text = parseFunction(text + 7, proxy);
break;
case 'p':
case 'P':
if (!strncasecmp(text, "rocedure", 8))
text = parseFunction(text + 8, proxy);
break;
case 'u':
case 'U':
if (!strncasecmp(text, "ses", 3)) text = parseUses(text + 3, proxy);
break;
}
}
}
示例7: ScanForFunctions
void ScanForFunctions(CLanguageProxy& proxy)
{
const char *text = proxy.Text(), *max = text + proxy.Size();
if (*max != 0)
return;
while (text < max)
{
text = skip(text, '<');
text = skip_white(text);
switch (toupper(*text))
{
case 0:
return;
case 'A':
if (isspace(*++text))
text = Anchor(text, proxy);
else
text = skip_nc(text, '>');
break;
case 'H':
if (*++text >= '1' && *text <= '6')
{
text = Heading(text, proxy);
}
else
text = skip_nc(text, '>');
break;
case 'S':
if (strncasecmp(text, "SCRIPT", 6) == 0)
text = JavaScript(text, proxy);
break;
default:
text = skip_nc(text + 1, '>');
break;
}
}
} /* ScanForFunctions */
示例8: ScanForFunctions
void ScanForFunctions(CLanguageProxy& proxy)
{
const char* text = proxy.Text(), *max = text + proxy.Size();
char* scope = (char*)"file";
if (*max != 0)
return;
while (text < max)
{
text = comment(text, false);
switch (*text)
{
case 0:
return;
case '\'':
text = skip(text + 1, '\'');
break;
case '"':
text = skip(text + 1, '"');
break;
case '(':
case '{':
case '[':
text = parens(text + 1, *text);
break;
case '#':
text = preprocessor(text + 1, proxy);
break;
default:
if (isidentf(*text))
text = ident(text, proxy, scope);
else
text++;
break;
}
}
} /* ScanForFunctions */
示例9: matchLine
// ScanForFunctions
_EXPORT
void
ScanForFunctions(CLanguageProxy& proxy)
{
const char* text = proxy.Text();
for(const char* pos = text; pos != NULL; ) {
if (strncmp(pos, "--- ", 4) == 0 && !isdigit(*(pos+4))) {
const char* displayPos = pos + 4;
// skip to filename
const char* lineEnd = strchr(pos, '\n');
if (!lineEnd)
lineEnd = pos + strlen(pos);
const char* tabPos = strchr(pos, '\t');
if (tabPos && tabPos < lineEnd)
// cut line off at tab, in order to drop the date following the filename
lineEnd = tabPos;
BString matchLine(pos, lineEnd-pos);
BString displayLine(displayPos, lineEnd-displayPos);
proxy.SetNestLevel(0);
proxy.AddFunction(displayLine.String(), matchLine.String(), pos-text, false);
} else if (strncmp(pos, "@@", 2) == 0
|| (strncmp(pos, "--- ", 4) == 0 && isdigit(*(pos+4)))) {
const char* displayPos = pos + 2;
// skip over "@@" or "--"
const char* lineEnd = strchr(pos, '\n');
if (!lineEnd)
lineEnd = pos + strlen(pos);
BString matchLine(pos, lineEnd-pos);
BString displayLine(displayPos, lineEnd-2-displayPos);
// -2 in order to skip back over '@@'
proxy.SetNestLevel(1);
proxy.AddFunction(displayLine.String(), matchLine.String(), pos-text, false);
}
if ((pos = strchr(pos+1, '\n')) != NULL)
pos++;
}
}
示例10: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state)
{
const char *text = proxy.Text();
int32 size = proxy.Size();
int32 i = 0, s = 0, kws = 0, esc = 0;
char c;
bool leave = false;
if (state == LCOMMENT)
proxy.SetColor(0, kColorComment1);
else
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
GETCHAR;
if (c == '`')
{
GETCHAR;
c = ' ';
}
switch (state)
{
case START:
if (c == '\\')
state = COMMAND1;
else if (c == '%')
state = LCOMMENT;
else if (c == '$')
state = MATH;
else if (c == '\n' || c == 0)
leave = true;
else if (isalnum(c))
state = WORD;
/* This is a bit strange to have some of the characters covered above, but who cares?*/
else if (c == '#' || c == '&'
|| c == '~' || c == '_' || c == '^'
|| c == '{' || c == '}'
|| c == '[' || c == ']'
)
state = CONSTCHAR;
if ((leave || state != START) && s < i)
{
proxy.SetColor(s, kColorText);
s = i - 1;
}
break;
case CONSTCHAR:
proxy.SetColor(s, kColorCharConst);
s = --i;
state = START;
break;
case WORD:
if (!isalnum(c))
{
proxy.SetColor(s, kColorText);
s = --i;
state = START;
}
break;
case LCOMMENT:
proxy.SetColor(s, kColorComment1);
leave = true;
if (text[size - 1] == '\n')
state = START;
break;
case COMMAND1:
if (c=='('){
state = MATH;
} else if ((isalnum(c)) || (c=='@')) /* a generic command has been found. */
/* Note that commands with "@" in their name only appear in .cls or .sty files */
{
kws = proxy.Move(c, 1);
state = COMMAND2;
}
else /* we are escaping a special text character such as \# or \$*/
{
proxy.SetColor(s, kColorText);
s = i;
state = START;
}
break;
case COMMAND2: /* Inside the name of a generic command */
if (!(isalnum(c)) && !(c=='@')) /* found end of command name */
{ /* now check the command name against a keyword list */
int kwc;
if (i > s + 1 && (kwc = proxy.IsKeyword(kws)) != 0)
{
switch (kwc)
//.........这里部分代码省略.........
示例11: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state)
{
const char *text = proxy.Text();
int32 size = proxy.Size();
int32 i = 0, s = 0, kws = 0, esc = 0;
char c = 0;
bool leave = false;
if (state == LCOMMENT)
proxy.SetColor(0, kColorComment1);
else
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
char b = c;
GETCHAR;
switch (state) {
case START:
if (c == '#' && (!b || isspace(b)))
state = LCOMMENT;
else if (isalpha(c) || c == '_')
{
kws = proxy.Move(c, 1);
state = IDENT;
}
else if (c == '"')
state = STRING1;
else if (c == '\'')
state = STRING2;
else if (c == '\n' || c == 0)
leave = true;
if (leave || (state != START && s < i))
{
proxy.SetColor(s, kColorText);
s = i - 1;
}
break;
case LCOMMENT:
proxy.SetColor(s, kColorComment1);
leave = true;
if (text[size - 1] == '\n')
state = START;
break;
case IDENT:
if (!isalnum(c) && c != '_')
{
int kwc;
if (i >= s + 1 && (kwc = proxy.IsKeyword(kws)) != 0)
{
switch (kwc)
{
case 1: proxy.SetColor(s, kColorKeyword1); break;
case 2: proxy.SetColor(s, kColorUserSet1); break;
case 3: proxy.SetColor(s, kColorUserSet2); break;
case 4: proxy.SetColor(s, kColorUserSet3); break;
case 5: proxy.SetColor(s, kColorUserSet4); break;
// default:ASSERT(false);
}
}
else
{
proxy.SetColor(s, kColorText);
}
s = --i;
state = START;
}
else if (kws)
kws = proxy.Move((int)(unsigned char)c, kws);
break;
case STRING1:
if (c == '"' && !esc)
{
proxy.SetColor(s, kColorString1);
s = i;
state = START;
}
else if (c == '\n' || c == 0)
{
if (text[i - 2] == '\\' && text[i - 3] != '\\')
{
proxy.SetColor(s, kColorString1);
}
else
{
proxy.SetColor(s, kColorText);
state = START;
}
s = size;
//.........这里部分代码省略.........
示例12: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state)
{
const char *text = proxy.Text();
int32 size = proxy.Size();
int32 i = 0, s = 0, kws = 0, cc_cnt = 0, esc = 0;
char c;
bool leave = false;
if (state == COMMENT || state == LCOMMENT)
proxy.SetColor(0, kColorComment1);
else
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
GETCHAR;
switch (state) {
case START:
if (isalpha(c) || c == '_')
{
kws = proxy.Move(c, 1);
state = IDENT;
}
else if (c == '/' && text[i] == '*')
state = COMMENT;
else if (c == '/' && text[i] == '/')
state = LCOMMENT;
else if (c == '"')
state = STRING;
else if (c == '\'')
{
state = CHAR_CONST;
cc_cnt = 0;
}
else if (c == '\n' || c == 0)
leave = true;
if (leave || (state != START && s < i))
{
proxy.SetColor(s, kColorText);
s = i - 1;
}
break;
case COMMENT:
if ((s == 0 || i > s + 1) && c == '*' && text[i] == '/')
{
proxy.SetColor(s, kColorComment1);
s = i + 1;
state = START;
}
else if (c == 0 || c == '\n')
{
proxy.SetColor(s, kColorComment1);
leave = true;
}
break;
case LCOMMENT:
proxy.SetColor(s, kColorComment1);
leave = true;
if (text[size - 1] == '\n')
state = START;
break;
case IDENT:
if (!isalnum(c) && c != '_' && c != '.')
{
int32 kwc;
if (i > s + 1 && (kwc = proxy.IsKeyword(kws)) != 0)
{
switch (kwc)
{
case 1: proxy.SetColor(s, kColorKeyword1); break;
case 2: proxy.SetColor(s, kColorUserSet1); break;
case 3: proxy.SetColor(s, kColorUserSet2); break;
case 4: proxy.SetColor(s, kColorUserSet3); break;
case 5: proxy.SetColor(s, kColorUserSet4); break;
// default: ASSERT(false);
}
}
else
{
proxy.SetColor(s, kColorText);
}
s = --i;
state = START;
}
else if (kws)
kws = proxy.Move((int)(unsigned char)c, kws);
break;
case STRING:
if (c == '"' && !esc)
//.........这里部分代码省略.........
示例13: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state)
{
const char *text = proxy.Text();
int32 size = proxy.Size();
int32 i = 0, s = 0, kws = 0, esc = 0;
char c;
bool leave = false;
bool floating_point = false;
bool hex_num = false;
// int sqrBraquetStrCount = 0;
if (state == LCOMMENT)
proxy.SetColor(0, kColorComment1);
else
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
GETCHAR;
switch (state) {
case START:
if (isalpha(c) || c == '_')
{
kws = proxy.Move(tolower(c), 1);
state = IDENT;
}
else if (c == '-' && text[i] == '-')
{
i++;
state = LCOMMENT;
}
else if (c == '"')
state = STRING;
else if (c == '\'')
state = STRING2;
/*
else if (c == '[' && text[i] == '[')
{
sqrBraquetStrCount++;
state = STRING3;
}
*/
else if (isNumeric(c) || (c == '$' && isHexNum(text[i])))
{
state = NUMERIC;
}
else if (isOperator(c))
{
state = OPERATOR;
}
else if (isSymbol(c))
{
state = SYMBOL;
}
else if (c == '\n' || c == 0)
leave = true;
if (leave || (state != START && s < i))
{
proxy.SetColor(s, kColorText);
s = i - 1;
}
break;
// -- format comments
case LCOMMENT:
proxy.SetColor(s - 1, kColorComment1);
leave = true;
if (text[size - 1] == '\n')
state = START;
break;
case IDENT:
if (!isalnum(c) && c != '_')
{
int32 kwc;
if (i > s + 1 && (kwc = proxy.IsKeyword(kws)) != 0)
{
switch (kwc)
{
case 1: proxy.SetColor(s, kColorKeyword1); break;
case 2: proxy.SetColor(s, kColorUserSet1); break;
case 3: proxy.SetColor(s, kColorUserSet2); break;
case 4: proxy.SetColor(s, kColorUserSet3); break;
case 5: proxy.SetColor(s, kColorUserSet4); break;
}
s = --i;
state = START;
}
else
{
proxy.SetColor(s, kColorText);
s = --i;
state = START;
//.........这里部分代码省略.........
示例14: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int& state)
{
const char *text = proxy.Text();
int size = proxy.Size();
int i = 0, s = 0, kws = 0, esc = 0;
char c, mc = 0;
bool leave = false;
if (state == COMMENT || state == LCOMMENT)
proxy.SetColor(0, kColorComment1);
else
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
GETCHAR;
switch (state) {
case START:
if (c == '#' && text[i - 2] != '$')
state = LCOMMENT;
else if (isalpha(c) || c == '_')
{
kws = proxy.Move(c, 1);
state = IDENT;
}
else if (c == '"')
state = STRING1;
else if (c == '\'')
state = STRING2;
else if (c == '&')
state = SCOPE;
else if (c == '$')
{
if (isalpha(text[i]) || text[i] == '#')
{
i++;
state = VAR;
}
else
{
i++;
proxy.SetColor(s, kColorText);
s = i;
}
}
else if (c == '@' || c == '*')
state = VAR;
else if (c == '/')
{
mc = '/';
state = REGEX1;
}
else if (c == '\n' || c == 0)
leave = true;
if (leave || (state != START && s < i))
{
proxy.SetColor(s, kColorText);
s = i - 1;
}
break;
case LCOMMENT:
proxy.SetColor(s, kColorComment1);
leave = true;
if (text[size - 1] == '\n')
state = START;
break;
case IDENT:
if (!isalnum(c) && c != '_')
{
int kwc;
if (i >= s + 1 && (kwc = proxy.IsKeyword(kws)) != 0)
{
switch (kwc)
{
case 1: proxy.SetColor(s, kColorKeyword1); break;
case 2: proxy.SetColor(s, kColorUserSet1); break;
case 3: proxy.SetColor(s, kColorUserSet2); break;
case 4: proxy.SetColor(s, kColorUserSet3); break;
case 5: proxy.SetColor(s, kColorUserSet4); break;
// default:ASSERT(false);
}
}
else
{
proxy.SetColor(s, kColorText);
}
if (i == s + 2)
{
switch (*(text + s))
{
case 'm': state = REGEX1; break;
//.........这里部分代码省略.........
示例15: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int& state)
{
const char *text = proxy.Text();
int size = proxy.Size();
int i = 0, s = 0, kws = 0, cc_cnt = 0, esc = 0;
char c;
bool leave = false;
// floating point flag, true when the NUMERIC: label finds a . inside a number, and checks to make sure that a number with two '.' is invalid. (and not highlighted as numeric)
bool floating_point = false;
// same flag, only for hex numbers. allows proper highlighting only for 1 x per number. (0x21 is ok. 0x023x31 is not. will look wierd.)
bool hex_num = false;
int ifZeroCounter = state >> STATE_SHIFT;
state = state & STATE_MASK;
if (state == COMMENT || state == LCOMMENT)
proxy.SetColor(0, kColorComment1);
else
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
GETCHAR;
switch (state) {
case START:
s = i - 1;
proxy.SetColor(s, kColorText);
if (c == '#')
{
kws = proxy.Move(c, 1);
state = PRAGMA1;
}
else if (isalpha(c) || c == '_')
{
kws = proxy.Move(c, 1);
state = IDENT;
}
else if (c == '/' && text[i] == '*')
{
i++;
state = COMMENT;
}
else if (c == '/' && text[i] == '/')
{
i++;
state = LCOMMENT;
}
else if (c == '"')
state = STRING;
else if (c == '\'')
{
state = CHAR_CONST;
cc_cnt = 0;
}
// m7m: here are the 3 magic IFs.
else if (isNumeric(c))
{
state = NUMERIC;
}
else if (isOperator(c))
{
state = OPERATOR;
}
else if (isSymbol(c))
{
state = SYMBOL;
}
else if (c == '\n' || c == 0)
leave = true;
break;
case COMMENT:
if ((s == 0 || i > s + 1) && c == '*' && text[i] == '/')
{
proxy.SetColor(s, kColorComment1);
i++;
state = START;
}
else if (c == 0 || c == '\n')
{
proxy.SetColor(s, kColorComment1);
leave = true;
}
break;
case LCOMMENT:
proxy.SetColor(s, kColorComment1);
leave = true;
if (text[size - 1] == '\n')
state = START;
break;
case IDENT:
if (!isalnum(c) && c != '_')
{
int kwc;
//.........这里部分代码省略.........