本文整理汇总了C++中CLanguageProxy::Move方法的典型用法代码示例。如果您正苦于以下问题:C++ CLanguageProxy::Move方法的具体用法?C++ CLanguageProxy::Move怎么用?C++ CLanguageProxy::Move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLanguageProxy
的用法示例。
在下文中一共展示了CLanguageProxy::Move方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
//.........这里部分代码省略.........
示例2: 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)
//.........这里部分代码省略.........
示例3: 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)
//.........这里部分代码省略.........
示例4: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state)
{
const char *text = proxy.Text();
int32 size = proxy.Size();
char c; // Current character
int32 nxt = 0, // Position after current character in text (i)
beg = 0, // (s)
kws = 0, //
forceState = START, //
color, //
kwc; // Keywordcode
bool leave = false, esc = false, script = false, percent = false, style = false;
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
script = (state >= JAVASCRIPT);
percent = false;
#if DEBUG_PHP
printf("#############################################################################\nColorLine(%s:%s)\n%s\n", DEB_StateName(state), script ? "IsScript" : "NoScript", text);
#endif
while (!leave)
{
c = get_char(nxt, size, text);
switch (state)
{
case START:
DEB_PrintState(state, c);
if (c == '<')
state = TAG_START;
else if (c == '&')
state = SPECIAL;
else if (c == 0 || c == '\n')
leave = true;
if ((leave || state != START) && beg < nxt)
{
proxy.SetColor(beg, kColorText);
beg = nxt-1;
}
break;
case TAG_START:
DEB_PrintState(state, c);
if (c == '/')
state = TAG_KEYWORD_END;
else if (c == '!')
{
state = COMMENT_DTD;
forceState = START;
}
else if (c == '?' || c == '%')
{
proxy.SetColor(beg, kColorTag);
beg = nxt;
if (strncasecmp(text+beg, "php", 3) == 0)
{
proxy.SetColor(beg, kColorTag);
beg = (nxt += 3);
}
state = PHP_SCRIPT;
percent = (c == '%');
}
else if (isalpha(c))
{
proxy.SetColor(beg, kColorTag);
beg = nxt-1;
kws = proxy.Move(CASE_SENSITIVE_TAG ? c : tolower(c), 1);
state = TAG_KEYWORD_START;
}
else if (c == 0 || c == '\n')
{
proxy.SetColor(beg, kColorTag);
leave = true;
}
else if (!isspace(c))
{
nxt--;
state = TAG;
}
break;
case TAG_KEYWORD_END:
DEB_PrintState(state, c);
if (isalpha(c))
{
proxy.SetColor(beg, kColorTag);
beg = nxt-1;
kws = proxy.Move(CASE_SENSITIVE_TAG ? c : tolower(c), 1);
state = TAG_KEYWORD_START;
}
else if (c == 0 || c == '\n')
{
//.........这里部分代码省略.........
示例5: if
_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state)
{
const char *text = proxy.Text();
int32 size = proxy.Size();
char c;
int32 i = 0, s = 0, kws = 0;
bool leave = false, esc = false;
proxy.SetColor(0, kColorText);
if (size <= 0)
return;
while (!leave)
{
GETCHAR;
switch (state)
{
case START:
if (c == '<')
state = TAG;
else if (c == '&')
state = SPECIAL;
else if (c == 0 || c == '\n')
leave = true;
if ((leave || state != START) && s < i)
{
proxy.SetColor(s, kColorText);
s = i - 1;
}
break;
case TAG:
case JSTAG:
switch (c)
{
case 0:
case '\n':
proxy.SetColor(s, kColorTag);
leave = true;
break;
case '>':
proxy.SetColor(s, kColorTag);
s = i;
proxy.SetColor(s, kColorText);
state--; // START
break;
case '"':
proxy.SetColor(s, kColorTag);
s = i - 1;
state++; // TAGSTRING1
break;
case '\'':
proxy.SetColor(s, kColorTag);
s = i - 1;
state += 2; // TAGSTRING2
break;
case '!':
if (i == s + 2)
{
proxy.SetColor(s, kColorTag);
state += 5; // COMMENT_DTD
}
break;
default:
if (isalpha(c))
{
proxy.SetColor(s, kColorTag);
s = i - 1;
kws = proxy.Move(tolower(c), 1);
state += 3; // TAGKEYWORD
}
break;
}
break;
case TAGSTRING1:
case JSTAGSTRING1:
if (c == '"')
{
proxy.SetColor(s, kColorString2);
s = i;
state--; // TAG
}
else if (c == '\n' || c == 0)
{
proxy.SetColor(s, kColorString2);
leave = true;
}
break;
case TAGSTRING2:
case JSTAGSTRING2:
if (c == '\'')
{
proxy.SetColor(s, kColorString2);
s = i;
state -= 2; // TAG
//.........这里部分代码省略.........
示例6: 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;
//.........这里部分代码省略.........
示例7: 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;
//.........这里部分代码省略.........
示例8: 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;
//.........这里部分代码省略.........