本文整理汇总了C++中codedocument::Iterator::nextChar方法的典型用法代码示例。如果您正苦于以下问题:C++ Iterator::nextChar方法的具体用法?C++ Iterator::nextChar怎么用?C++ Iterator::nextChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类codedocument::Iterator
的用法示例。
在下文中一共展示了Iterator::nextChar方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseOctalLiteral
bool parseOctalLiteral (CodeDocument::Iterator& source) noexcept
{
if (source.nextChar() != '0')
return false;
if (! isOctalDigit (source.nextChar()))
return false;
while (isOctalDigit (source.peekNextChar()))
source.skip();
return skipNumberSuffix (source);
}
示例2: skipQuotedString
void skipQuotedString (CodeDocument::Iterator& source) noexcept
{
const juce_wchar quote = source.nextChar();
for (;;)
{
const juce_wchar c = source.nextChar();
if (c == quote || c == 0)
break;
if (c == '\\')
source.skip();
}
}
示例3: parseIdentifier
int parseIdentifier (CodeDocument::Iterator& source) noexcept
{
int tokenLength = 0;
String::CharPointerType::CharType possibleIdentifier [100];
String::CharPointerType possible (possibleIdentifier);
while (isIdentifierBody (source.peekNextChar()))
{
const juce_wchar c = source.nextChar();
if (tokenLength < 20)
possible.write (c);
++tokenLength;
}
if (tokenLength > 1 && tokenLength <= 16)
{
possible.writeNull();
if (isReservedKeyword (String::CharPointerType (possibleIdentifier), tokenLength))
return CPlusPlusCodeTokeniser::tokenType_builtInKeyword;
}
return CPlusPlusCodeTokeniser::tokenType_identifier;
}
示例4: parseHexLiteral
bool parseHexLiteral (CodeDocument::Iterator& source) noexcept
{
if (source.nextChar() != '0')
return false;
juce_wchar c = source.nextChar();
if (c != 'x' && c != 'X')
return false;
int numDigits = 0;
while (isHexDigit (source.peekNextChar()))
{
++numDigits;
source.skip();
}
if (numDigits == 0)
return false;
return skipNumberSuffix (source);
}
示例5: skipComment
void skipComment (CodeDocument::Iterator& source) noexcept
{
bool lastWasStar = false;
for (;;)
{
const juce_wchar c = source.nextChar();
if (c == 0 || (c == '/' && lastWasStar))
break;
lastWasStar = (c == '*');
}
}
示例6: skipComment
static void skipComment (CodeDocument::Iterator& source) throw()
{
bool lastWasStar = false;
for (;;)
{
const juce_wchar c = source.nextChar();
if (c == 0 || (c == T('/') && lastWasStar))
break;
lastWasStar = (c == '*');
}
}
示例7: parseIdentifier
static int parseIdentifier (CodeDocument::Iterator& source) throw()
{
static const tchar* keywords2Char[] =
{ T("if"), T("do"), T("or"), 0 };
static const tchar* keywords3Char[] =
{ T("for"), T("int"), T("new"), T("try"), T("xor"), T("and"), T("asm"), T("not"), 0 };
static const tchar* keywords4Char[] =
{ T("bool"), T("void"), T("this"), T("true"), T("long"), T("else"), T("char"),
T("enum"), T("case"), T("goto"), T("auto"), 0 };
static const tchar* keywords5Char[] =
{ T("while"), T("bitor"), T("break"), T("catch"), T("class"), T("compl"), T("const"), T("false"),
T("float"), T("short"), T("throw"), T("union"), T("using"), T("or_eq"), 0 };
static const tchar* keywords6Char[] =
{ T("return"), T("struct"), T("and_eq"), T("bitand"), T("delete"), T("double"), T("extern"),
T("friend"), T("inline"), T("not_eq"), T("public"), T("sizeof"), T("static"), T("signed"),
T("switch"), T("typeid"), T("wchar_t"), T("xor_eq"), 0};
static const tchar* keywordsOther[] =
{ T("const_cast"), T("continue"), T("default"), T("explicit"), T("mutable"), T("namespace"),
T("operator"), T("private"), T("protected"), T("register"), T("reinterpret_cast"), T("static_cast"),
T("template"), T("typedef"), T("typename"), T("unsigned"), T("virtual"), T("volatile"),
T("@implementation"), T("@interface"), T("@end"), T("@synthesize"), T("@dynamic"), T("@public"),
T("@private"), T("@property"), T("@protected"), T("@class"), 0 };
int tokenLength = 0;
tchar possibleIdentifier [19];
while (isIdentifierBody (source.peekNextChar()))
{
const tchar c = source.nextChar();
if (tokenLength < numElementsInArray (possibleIdentifier) - 1)
possibleIdentifier [tokenLength] = c;
++tokenLength;
}
if (tokenLength > 1 && tokenLength <= 16)
{
possibleIdentifier [tokenLength] = 0;
const tchar** k;
switch (tokenLength)
{
case 2: k = keywords2Char; break;
case 3: k = keywords3Char; break;
case 4: k = keywords4Char; break;
case 5: k = keywords5Char; break;
case 6: k = keywords6Char; break;
default: k = keywordsOther; break;
}
int i = 0;
while (k[i] != 0)
{
if (k[i][0] == possibleIdentifier[0] && CharacterFunctions::compare (k[i], possibleIdentifier) == 0)
return CPlusPlusCodeTokeniser::tokenType_builtInKeyword;
++i;
}
}
return CPlusPlusCodeTokeniser::tokenType_identifier;
}