本文整理汇总了C++中Accessor::ChangeLexerState方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessor::ChangeLexerState方法的具体用法?C++ Accessor::ChangeLexerState怎么用?C++ Accessor::ChangeLexerState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accessor
的用法示例。
在下文中一共展示了Accessor::ChangeLexerState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ColouriseBashDoc
//.........这里部分代码省略.........
sc.ChangeState(SCE_SH_BACKTICKS);
QuoteStack.Start(sc.ch, BASH_DELIM_COMMAND);
} else if (sc.ch == '`') { // $` seen in a configure script, valid?
sc.ChangeState(SCE_SH_BACKTICKS);
QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK);
} else {
continue; // scalar has no delimiter pair
}
} else if (sc.Match('<', '<')) {
sc.SetState(SCE_SH_HERE_DELIM);
HereDoc.State = 0;
if (sc.GetRelative(2) == '-') { // <<- indent case
HereDoc.Indent = true;
sc.Forward();
} else {
HereDoc.Indent = false;
}
} else if (sc.ch == '-' && // one-char file test operators
setSingleCharOp.Contains(sc.chNext) &&
!setWord.Contains(sc.GetRelative(2)) &&
IsASpace(sc.chPrev)) {
sc.SetState(SCE_SH_WORD);
sc.Forward();
} else if (setBashOperator.Contains(sc.ch)) {
char s[10];
bool isCmdDelim = false;
sc.SetState(SCE_SH_OPERATOR);
// globs have no whitespace, do not appear in arithmetic expressions
if (cmdState != BASH_CMD_ARITH && sc.ch == '(' && sc.chNext != '(') {
int i = GlobScan(sc);
if (i > 1) {
sc.SetState(SCE_SH_IDENTIFIER);
sc.Forward(i);
continue;
}
}
// handle opening delimiters for test/arithmetic expressions - ((,[[,[
if (cmdState == BASH_CMD_START
|| cmdState == BASH_CMD_BODY) {
if (sc.Match('(', '(')) {
cmdState = BASH_CMD_ARITH;
sc.Forward();
} else if (sc.Match('[', '[') && IsASpace(sc.GetRelative(2))) {
cmdState = BASH_CMD_TEST;
testExprType = 1;
sc.Forward();
} else if (sc.ch == '[' && IsASpace(sc.chNext)) {
cmdState = BASH_CMD_TEST;
testExprType = 2;
}
}
// special state -- for ((x;y;z)) in ... looping
if (cmdState == BASH_CMD_WORD && sc.Match('(', '(')) {
cmdState = BASH_CMD_ARITH;
sc.Forward();
continue;
}
// handle command delimiters in command START|BODY|WORD state, also TEST if 'test'
if (cmdState == BASH_CMD_START
|| cmdState == BASH_CMD_BODY
|| cmdState == BASH_CMD_WORD
|| (cmdState == BASH_CMD_TEST && testExprType == 0)) {
s[0] = static_cast<char>(sc.ch);
if (setBashOperator.Contains(sc.chNext)) {
s[1] = static_cast<char>(sc.chNext);
s[2] = '\0';
isCmdDelim = cmdDelimiter.InList(s);
if (isCmdDelim)
sc.Forward();
}
if (!isCmdDelim) {
s[1] = '\0';
isCmdDelim = cmdDelimiter.InList(s);
}
if (isCmdDelim) {
cmdState = BASH_CMD_DELIM;
continue;
}
}
// handle closing delimiters for test/arithmetic expressions - )),]],]
if (cmdState == BASH_CMD_ARITH && sc.Match(')', ')')) {
cmdState = BASH_CMD_BODY;
sc.Forward();
} else if (cmdState == BASH_CMD_TEST && IsASpace(sc.chPrev)) {
if (sc.Match(']', ']') && testExprType == 1) {
sc.Forward();
cmdState = BASH_CMD_BODY;
} else if (sc.ch == ']' && testExprType == 2) {
cmdState = BASH_CMD_BODY;
}
}
}
}// sc.state
}
sc.Complete();
if (sc.state == SCE_SH_HERE_Q) {
styler.ChangeLexerState(sc.currentPos, styler.Length());
}
sc.Complete();
}