本文整理汇总了C++中IsAlpha函数的典型用法代码示例。如果您正苦于以下问题:C++ IsAlpha函数的具体用法?C++ IsAlpha怎么用?C++ IsAlpha使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsAlpha函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: assert
// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The
// "assign" optimization removes over 10% of the execution time.
//
const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
{
// Oddly, not supported on some comilers,
//name->clear();
// So use this:
*name = "";
assert( p );
// Names start with letters or underscores.
// Of course, in unicode, tinyxml has no idea what a letter *is*. The
// algorithm is generous.
//
// After that, they can be letters, underscores, numbers,
// hyphens, or colons. (Colons are valid ony for namespaces,
// but tinyxml can't tell namespaces from names.)
if ( p && *p
&& ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
{
const char* start = p;
while( p && *p
&& ( IsAlphaNum( (unsigned char ) *p, encoding )
|| *p == '_'
|| *p == '-'
|| *p == '.'
|| *p == ':' ) )
{
//(*name) += *p; // expensive
++p;
}
if ( p-start > 0 ) {
name->assign( start, p-start );
}
return p;
}
return 0;
}
开发者ID:hihua,项目名称:hihuacode,代码行数:39,代码来源:tinyxmlparser.cpp
示例2: CharFilterAlpha
int CharFilterAlpha(int c)
{
return IsAlpha(c) ? c : 0;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:4,代码来源:StrUtil.cpp
示例3: SkipWhiteSpace
MDBXMLNode* MDBXMLNode::Identify( const char* p, MDBXMLEncoding encoding )
{
MDBXMLNode* returnNode = 0;
p = SkipWhiteSpace( p, encoding );
if( !p || !*p || *p != '<' )
{
return 0;
}
MDBXMLDocument* doc = GetDocument();
p = SkipWhiteSpace( p, encoding );
if ( !p || !*p )
{
return 0;
}
// What is this thing?
// - Elements start with a letter or underscore, but xml is reserved.
// - Comments: <!--
// - Decleration: <?xml
// - Everthing else is unknown to tinyxml.
//
const char* xmlHeader = { "<?xml" };
const char* commentHeader = { "<!--" };
const char* dtdHeader = { "<!" };
const char* cdataHeader = { "<![CDATA[" };
if ( StringEqual( p, xmlHeader, true, encoding ) )
{
#ifdef DEBUG_PARSER
MDBXML_LOG( "XML parsing Declaration\n" );
#endif
returnNode = new MDBXMLDeclaration();
}
else if ( StringEqual( p, commentHeader, false, encoding ) )
{
#ifdef DEBUG_PARSER
MDBXML_LOG( "XML parsing Comment\n" );
#endif
returnNode = new MDBXMLComment();
}
else if ( StringEqual( p, cdataHeader, false, encoding ) )
{
#ifdef DEBUG_PARSER
MDBXML_LOG( "XML parsing CDATA\n" );
#endif
MDBXMLText* text = new MDBXMLText( "" );
text->SetCDATA( true );
returnNode = text;
}
else if ( StringEqual( p, dtdHeader, false, encoding ) )
{
#ifdef DEBUG_PARSER
MDBXML_LOG( "XML parsing Unknown(1)\n" );
#endif
returnNode = new MDBXMLUnknown();
}
else if ( IsAlpha( *(p+1), encoding )
|| *(p+1) == '_' )
{
#ifdef DEBUG_PARSER
MDBXML_LOG( "XML parsing Element\n" );
#endif
returnNode = new MDBXMLElement( "" );
}
else
{
#ifdef DEBUG_PARSER
MDBXML_LOG( "XML parsing Unknown(2)\n" );
#endif
returnNode = new MDBXMLUnknown();
}
if ( returnNode )
{
// Set the parent, so it can report errors
returnNode->parent = this;
}
else
{
if ( doc )
doc->SetError( MDBXML_ERROR_OUT_OF_MEMORY, 0, 0, MDBXML_ENCODING_UNKNOWN );
}
return returnNode;
}
开发者ID:alienyu9527,项目名称:QMDB81,代码行数:88,代码来源:mdbXMLParser.cpp
示例4: IsAlNum
bool IsAlNum(char c)
{
return IsAlpha(c) || IsDigit(c);
}
开发者ID:A-deLuna,项目名称:Let-s-build-a-compiler,代码行数:4,代码来源:cradle.c
示例5: GetNumber
static UInt GetNumber(Int readDecimalPoint)
{
UInt symbol = S_ILLEGAL;
UInt i = 0;
Char c;
UInt seenADigit = 0;
UInt seenExp = 0;
UInt seenExpDigit = 0;
STATE(ValueObj) = 0;
c = PEEK_CURR_CHAR();
if (readDecimalPoint) {
STATE(Value)[i++] = '.';
}
else {
// read initial sequence of digits into 'Value'
while (IsDigit(c)) {
i = AddCharToValue(i, c);
seenADigit = 1;
c = GET_NEXT_CHAR();
}
// maybe we saw an identifier character and realised that this is an
// identifier we are reading
if (IsIdent(c) || c == '\\') {
// if necessary, copy back from STATE(ValueObj) to STATE(Value)
if (STATE(ValueObj)) {
i = GET_LEN_STRING(STATE(ValueObj));
GAP_ASSERT(i >= MAX_VALUE_LEN - 1);
memcpy(STATE(Value), CONST_CSTR_STRING(STATE(ValueObj)), MAX_VALUE_LEN);
STATE(ValueObj) = 0;
}
// this looks like an identifier, scan the rest of it
return GetIdent(i);
}
// Or maybe we saw a '.' which could indicate one of two things: a
// float literal or S_DOT, i.e., '.' used to access a record entry.
if (c == '.') {
GAP_ASSERT(i < MAX_VALUE_LEN - 1);
// If the symbol before this integer was S_DOT then we must be in
// a nested record element expression, so don't look for a float.
// This is a bit fragile
if (STATE(Symbol) == S_DOT || STATE(Symbol) == S_BDOT) {
symbol = S_INT;
goto finish;
}
// peek ahead to decide which
if (PEEK_NEXT_CHAR() == '.') {
// It was '.', so this looks like '..' and we are probably
// inside a range expression.
symbol = S_INT;
goto finish;
}
// Now the '.' must be part of our number; store it and move on
i = AddCharToValue(i, '.');
c = GET_NEXT_CHAR();
}
else {
// Anything else we see tells us that the token is done
symbol = S_INT;
goto finish;
}
}
// When we get here we have read possibly some digits, a . and possibly
// some more digits, but not an e,E,d,D,q or Q
// read digits
while (IsDigit(c)) {
i = AddCharToValue(i, c);
seenADigit = 1;
c = GET_NEXT_CHAR();
}
if (!seenADigit)
SyntaxError("Badly formed number: need a digit before or after the "
"decimal point");
if (c == '\\')
SyntaxError("Badly formed number");
// If we found an identifier type character in this context could be an
// error or the start of one of the allowed trailing marker sequences
if (IsIdent(c) && c != 'e' && c != 'E' && c != 'd' && c != 'D' &&
c != 'q' && c != 'Q') {
// Allow one letter on the end of the numbers -- could be an i, C99
// style
if (IsAlpha(c)) {
i = AddCharToValue(i, c);
c = GET_NEXT_CHAR();
}
// independently of that, we allow an _ signalling immediate conversion
if (c == '_') {
i = AddCharToValue(i, c);
//.........这里部分代码省略.........
开发者ID:cdwensley,项目名称:gap,代码行数:101,代码来源:scanner.c
示例6: CfgNextTok
void CfgNextTok (void)
/* Read the next token from the input stream */
{
unsigned I;
Again:
/* Skip whitespace */
while (isspace (C)) {
NextChar ();
}
/* Remember the current position */
CfgErrorLine = InputLine;
CfgErrorCol = InputCol;
/* Identifier? */
if (C == '_' || IsAlpha (C)) {
/* Read the identifier */
I = 0;
while (C == '_' || IsAlNum (C)) {
if (I < CFG_MAX_IDENT_LEN) {
CfgSVal [I++] = C;
}
NextChar ();
}
CfgSVal [I] = '\0';
CfgTok = CFGTOK_IDENT;
return;
}
/* Hex number? */
if (C == '$') {
NextChar ();
if (!isxdigit (C)) {
Error ("%s(%u): Hex digit expected", CfgName, InputLine);
}
CfgIVal = 0;
while (isxdigit (C)) {
CfgIVal = CfgIVal * 16 + DigitVal (C);
NextChar ();
}
CfgTok = CFGTOK_INTCON;
return;
}
/* Decimal number? */
if (isdigit (C)) {
CfgIVal = 0;
while (isdigit (C)) {
CfgIVal = CfgIVal * 10 + DigitVal (C);
NextChar ();
}
CfgTok = CFGTOK_INTCON;
return;
}
/* Other characters */
switch (C) {
case '{':
NextChar ();
CfgTok = CFGTOK_LCURLY;
break;
case '}':
NextChar ();
CfgTok = CFGTOK_RCURLY;
break;
case ';':
NextChar ();
CfgTok = CFGTOK_SEMI;
break;
case '.':
NextChar ();
if (C == '.') {
NextChar ();
CfgTok = CFGTOK_DOTDOT;
} else {
CfgTok = CFGTOK_DOT;
}
break;
case ',':
NextChar ();
CfgTok = CFGTOK_COMMA;
break;
case '=':
NextChar ();
CfgTok = CFGTOK_EQ;
break;
case ':':
NextChar ();
CfgTok = CFGTOK_COLON;
break;
//.........这里部分代码省略.........
开发者ID:eakmeister,项目名称:cc65,代码行数:101,代码来源:scanner.c
示例7: AsmInc
void AsmInc (const char* Filename, char CommentStart, int IgnoreUnknown)
/* Read an assembler include file */
{
char Buf[1024];
char* L;
const char* Comment;
unsigned Line;
unsigned Len;
long Val;
unsigned DVal;
int Sign;
unsigned Base;
unsigned Digits;
StrBuf Ident = STATIC_STRBUF_INITIALIZER;
/* Try to open the file for reading */
FILE* F = fopen (Filename, "r");
if (F == 0) {
Error ("Cannot open asm include file \"%s\": %s",
Filename, strerror (errno));
}
/* Read line by line, check for NAME = VALUE lines */
Line = 0;
while ((L = fgets (Buf, sizeof (Buf), F)) != 0) {
/* One more line read */
++Line;
/* Ignore leading white space */
while (IsBlank (*L)) {
++L;
}
/* Remove trailing whitespace */
Len = strlen (L);
while (Len > 0 && IsSpace (L[Len-1])) {
--Len;
}
L[Len] = '\0';
/* If the line is empty or starts with a comment char, ignore it */
if (*L == '\0' || *L == CommentStart) {
continue;
}
/* Read an identifier */
SB_Clear (&Ident);
if (IsAlpha (*L) || *L == '_') {
SB_AppendChar (&Ident, *L++);
while (IsAlNum (*L) || *L == '_') {
SB_AppendChar (&Ident, *L++);
}
SB_Terminate (&Ident);
} else {
if (!IgnoreUnknown) {
Error ("%s(%u): Syntax error", Filename, Line);
}
continue;
}
/* Ignore white space */
L = SkipWhitespace (L);
/* Check for := or = */
if (*L == '=') {
++L;
} else if (*L == ':' && *++L == '=') {
++L;
} else {
if (!IgnoreUnknown) {
Error ("%s(%u): Missing `='", Filename, Line);
}
continue;
}
/* Allow white space once again */
L = SkipWhitespace (L);
/* A number follows. Read the sign. */
if (*L == '-') {
Sign = -1;
++L;
} else {
Sign = 1;
if (*L == '+') {
++L;
}
}
/* Determine the base of the number. Allow $ and % as prefixes for
* hex and binary numbers respectively.
*/
if (*L == '$') {
Base = 16;
++L;
} else if (*L == '%') {
Base = 2;
++L;
} else {
//.........这里部分代码省略.........
开发者ID:Aliandrana,项目名称:snesdev,代码行数:101,代码来源:asminc.c
示例8: IsAlpha
bool CgaLexer::IsAlphaNumeric(char c)
{
return IsAlpha(c) || IsDigit(c);
}
开发者ID:coderespawn,项目名称:cga-parser,代码行数:4,代码来源:CgaLexer.cpp
示例9: IsAlphaOrUnderscore
static inline bool IsAlphaOrUnderscore(char c) {
return IsAlpha(c) || (c == '_');
}
开发者ID:asoffer,项目名称:Icarus,代码行数:3,代码来源:Lexer.cpp
示例10: IsAlphaNumeric
static inline bool IsAlphaNumeric(char c) { return IsAlpha(c) || IsDigit(c); }
开发者ID:asoffer,项目名称:Icarus,代码行数:1,代码来源:Lexer.cpp
示例11: FormatStopwatch
static String FormatStopwatch(int64 us, const String& format)
{
String result, keyPattern;
if (us < 0)
{
result.push_back(U'-');
us = -us;
}
bool inQuot = false;
char32 previousChar = U'\0';
for (size_t i = 0; i < format.length(); ++i)
{
const char32 ch = format[i];
if (IsAlpha(ch))
{
if (inQuot)
{
result.push_back(ch);
}
else
{
if (keyPattern.isEmpty() || ch == previousChar)
{
keyPattern.push_back(ch);
}
else
{
result.append(GetFormattedElement(us, keyPattern));
keyPattern.clear();
keyPattern.push_back(ch);
}
}
}
else
{
if (!keyPattern.isEmpty())
{
result.append(GetFormattedElement(us, keyPattern));
keyPattern.clear();
}
if (ch == U'\'')
{
if (format[i + 1] == U'\'')
{
result.push_back(U'\'');
++i;
continue;
}
inQuot = !inQuot;
}
else
{
result.push_back(ch);
}
}
previousChar = ch;
}
if (!keyPattern.isEmpty())
{
result.append(GetFormattedElement(us, keyPattern));
}
return result;
}
开发者ID:azaika,项目名称:OpenSiv3D,代码行数:76,代码来源:SivStopwatch.cpp
示例12: IsAlphaNumberic
/**
* @brief Checks if current character is alphanumeric (a-z|0-9).
*
* @return
*/
bool IsAlphaNumberic() const {
return IsAlpha() || IsRange('0', '9');
}
开发者ID:05storm26,项目名称:codelite,代码行数:8,代码来源:CMakeParser.cpp
示例13: return
bool wxSimpleHtmlParser::IsWord()
{
return (IsAlpha(GetChar(m_pos)));
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:4,代码来源:htmlparser.cpp
示例14: CharFilterAlphaToLower
int CharFilterAlphaToLower(int c)
{
return IsAlpha(c) ? IsLower(c) ? c : ToLower(c) : 0;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:4,代码来源:StrUtil.cpp
示例15: CharFilterAlphaToUpper
int CharFilterAlphaToUpper(int c)
{
return IsAlpha(c) ? IsUpper(c) ? c : ToUpper(c) : 0;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:4,代码来源:StrUtil.cpp
示例16: Indent
//.........这里部分代码省略.........
// constants
HashMap<String, JSBModule::Constant>& constants = module_->GetConstants();
if (constants.Size())
{
source += "\n";
String line = "public static partial class Constants\n";
source += IndentLine(line);
source += IndentLine("{\n");
const Vector<String>& constantsName = constants.Keys();
Indent();
for (unsigned i = 0; i < constantsName.Size(); i++)
{
const String& cname = constantsName.At(i);
JSBModule::Constant& constant = constants[cname];
String managedType = GetManagedPrimitiveType(constant.type);
String value = constant.value;
if (!value.Length())
continue;
//static const unsigned M_MIN_UNSIGNED = 0x00000000;
// /static const unsigned M_MAX_UNSIGNED = 0xffffffff;
if (cname == "M_MIN_INT")
value = "int.MinValue";
if (cname == "M_INFINITY")
value = "float.MaxValue";
if (value == "M_MAX_UNSIGNED")
value = "0xffffffff";
// Input stuff
if (module_->GetName() == "Input")
{
if (cname.StartsWith("KEY_"))
{
if (value.Length() == 1 && (IsAlpha(value[0]) || IsDigit(value[0])))
value = "'" + value + "'";
}
// https://raw.githubusercontent.com/flibitijibibo/SDL2-CS/master/src/SDL2.cs
if (value.StartsWith("SDL_BUTTON_") || value.StartsWith("SDL_HAT_"))
{
value = "(int) SDL." + value;
}
else if (value.StartsWith("SDLK_"))
{
value = "(int) SDL.SDL_Keycode." + value;
}
else if (value.StartsWith("SDL_SCANCODE_"))
{
value = "(int) SDL.SDL_Scancode." + value;
}
else if (value.StartsWith("SDL_CONTROLLER_BUTTON_"))
{
value = "(int) SDL.SDL_GameControllerButton." + value;
}
else if (value.StartsWith("SDL_CONTROLLER_AXIS_"))
{
value = "(int) SDL.SDL_GameControllerAxis." + value;
}
}
String line = "public const " + managedType + " " + cname + " = " + value;
if (managedType == "float" && !line.EndsWith("f") && IsDigit(line[line.Length()-1]))
line += "f";
line += ";\n";
source += IndentLine(line);
}
Dedent();
source += "\n";
line = "}\n";
source += IndentLine(line);
}
source += "\n";
Dedent();
}
开发者ID:GREYFOXRGR,项目名称:AtomicGameEngine,代码行数:101,代码来源:CSModuleWriter.cpp
示例17: ParseCommand
void ParseCommand(char *string)
{
char Command;
char Command2 = 0;
unsigned int Params[MAX_COMMAND_PARAMS];
unsigned int NumParams=0;
/* UsartWriteString("Command Received: ");
UsartWriteString(string);
UsartWriteString("\n\r");
*/
// assume commands are single character followed by numerical parameters sep by spaces
// e.g. "s 1 5", "b 7", "b 100 120 001 212 123"
Command = string[0];
if(IsAlpha(string[1])) // multi-char command (e.g. pa, oa, ia, etc)
Command2 = string[1];
if(Command != 0)
{
NumParams=GetParams(string,Params); // read any optional parameters after command
/*
UsartWriteString("CommandID: ");
UsartWriteChar(Command);
if(Command2 != 0)
UsartWriteChar(Command2);
UsartWriteString(" #Params: ");
UsartWriteChar(48+NumParams);
UsartWriteString("\n\r");
*/
}
else
{
UsartWriteString("No Command\n\r");
};
unsigned short lcdDataIn;
static char buffer[10];
switch(Command)
{
case 'a': // ADC do immediate conversion
PORTQ.OUTCLR = PIN0_bm | PIN2_bm; //ENCODE pins
_delay_ms(1);
PORTQ.OUTSET = PIN0_bm | PIN2_bm;
_delay_ms(1);
char value = PORTD.IN;
IntToString(value,&buffer[0]);
UsartWriteLine(buffer);
break;
case 'b': // read imager flag
PORTA.DIR &= ~0x01;
char bb6 = PORTA.IN & 0x01;
IntToString(bb6,&buffer[0]);
UsartWriteLine(buffer);
break;
case 'y': // Start Image
frame = 0;
start_interrupts();
break;
case 'z': // Stop Image
stop_interrupts();
break;
case 'l':
lcdDataIn = TSLCDInDat();
IntToString(lcdDataIn,&buffer[0]);
UsartWriteLine(buffer);
break;
case 'x':
IntToString(4,&buffer[0]);
UsartWriteLine(buffer);
break;
case 'T': // Usart TX test
DoUsartTx(Command2,Params[0],"0123456789");
break;
case 'S': // Config SPI port
DoSpiConfig(Command2,Params[0]);
break;
case 'X': // SPI TX test
DoSpiTx(Command2,"0123456789");
break;
case 's': // Sleep CPU
DoSleep(Params[0]); // this will not return
break;
//.........这里部分代码省略.........
开发者ID:jpwright,项目名称:asp-lfc,代码行数:101,代码来源:ASP-LFC.c
示例18: switch
NNT Lexer::NextOperator() {
switch (*cursor) {
case '`': IncrementCursor(); RETURN_NNT("`", op_bl, 1);
case '@': IncrementCursor(); RETURN_NNT("@", op_l, 1);
case ',': IncrementCursor(); RETURN_NNT(",", comma, 1);
case ';': IncrementCursor(); RETURN_NNT(";", semicolon, 1);
case '(': IncrementCursor(); RETURN_NNT("(", l_paren, 1);
case ')': IncrementCursor(); RETURN_NNT(")", r_paren, 1);
case '[': IncrementCursor(); RETURN_NNT("[", l_bracket, 1);
case ']': IncrementCursor(); RETURN_NNT("]", r_bracket, 1);
case '{': IncrementCursor(); RETURN_NNT("{", l_brace, 1);
case '}': IncrementCursor(); RETURN_NNT("}", r_brace, 1);
case '$': IncrementCursor(); RETURN_NNT("$", op_l, 1);
case '.': {
Cursor cursor_copy = cursor;
// Note: safe because we know we have a null-terminator
while (*cursor == '.') { IncrementCursor(); }
size_t num_dots = cursor.offset - cursor_copy.offset;
if (num_dots == 1) {
RETURN_NNT(".", op_b, 1);
} else {
if (num_dots > 2) { ErrorLog::TooManyDots(cursor_copy, num_dots); }
RETURN_NNT("..", dots, 2);
}
} break;
case '\\': {
Cursor cursor_copy = cursor;
size_t dist = 1;
IncrementCursor();
++dist;
switch(*cursor) {
case '\\':
IncrementCursor();
RETURN_NNT("", newline, 0);
break;
case '\0':
// Ignore the following newline
IncrementCursor();
return Next();
case ' ':
case '\t':
while (IsWhitespace(*cursor)) {
IncrementCursor();
++dist;
}
if (*cursor == '\0') {
IncrementCursor();
return Next();
}
// Intentionally falling through. Looking at a non-whitespace after a '\'
default:
ErrorLog::NonWhitespaceAfterNewlineEscape(cursor_copy, dist);
return Next();
}
} break;
case '#': {
IncrementCursor();
Cursor cursor_copy = cursor;
if (!IsAlpha(*cursor)) {
ErrorLog::InvalidHashtag(cursor_copy);
return Next();
}
do { IncrementCursor(); } while (IsAlphaNumericOrUnderscore(*cursor));
if (cursor.offset - cursor_copy.offset == 0) {
ErrorLog::InvalidHashtag(cursor_copy);
}
char old_char = *cursor;
*cursor = '\0';
const char *tag_ref = cursor.line.ptr + cursor_copy.offset;
size_t tag_len = strlen(tag_ref);
char *tag = new char[tag_len + 1];
strcpy(tag, tag_ref);
*cursor = old_char;
RETURN_NNT(tag, hashtag, tag_len + 1);
} break;
case '+':
case '%':
case '<':
case '>':
case '|':
case '^': {
char first_char = *cursor;
IncrementCursor();
char *token = new char[3];
token[0] = first_char;
if (*cursor == '=') {
//.........这里部分代码省略.........
开发者ID:asoffer,项目名称:Icarus,代码行数:101,代码来源:Lexer.cpp
示例19: while
CgaToken CgaLexer::GetToken()
{
// Eat white space
while (IsWhiteSpace(c)) {
MoveNext();
}
// Handle identifiers
if (IsAlpha(c)) {
CGAString identifier;
identifier += c;
MoveNext();
while (IsAlphaNumeric(c) || c == '.') {
identifier += c;
MoveNext();
}
if (identifier == "true") {
return CreateToken(CgaTokenType::True, "true");
}
else if (identifier == "false") {
return CreateToken(CgaTokenType::False, "false");
}
else if (identifier == "var") {
return CreateToken(CgaTokenType::Var, "var");
}
else {
return CreateToken(CgaTokenType::Identifier, identifier);
}
}
// Handle Numbers
if (IsDigit(c) || c == '.') {
CGAString snum;
while (IsDigit(c)) {
snum += c;
MoveNext();
}
if (c == '.') {
snum += c;
MoveNext();
while (IsDigit(c)) {
snum += c;
MoveNext();
}
}
float num = static_cast<float>(atof(snum.c_str()));
if (c == 'r') {
snum += c;
MoveNext(); // Eat 'r'
return CreateToken(CgaTokenType::ArgNumber, snum, num);
}
else {
return CreateToken(CgaTokenType::Number, snum);
}
}
// Handle string
if (c == '\"') {
MoveNext(); // Eat "
CGAString value;
while (c != '\"') {
value += c;
MoveNext();
if (stream.eof()) break;
}
MoveNext(); // Eat "
return CreateToken(CgaTokenType::String, value);
}
// Handle Comments
if (c == '#') {
// Eat till end of line
while (c != '\n' && !stream.eof())
{
MoveNext();
}
MoveNext(); // Eat \n
}
// Handle additive operators
if (c == '+' || c == '-') {
char lastChar = c;
CGAString op;
op += c;
MoveNext();
// Handle arrow op '->'
if (lastChar == '-' && c == '>') {
op += c;
MoveNext();
return CreateToken(CgaTokenType::Arrow, op);
}
return CreateToken(CgaTokenType::BinaryOp, op);
//.........这里部分代码省略.........
开发者ID:coderespawn,项目名称:cga-parser,代码行数:101,代码来源:CgaLexer.cpp
示例20: IsAlpha
bool Pxf::IsAlphanumeric(const char c)
{
return IsAlpha(c) || IsNumeric(c) || c == '_';
}
开发者ID:pxf,项目名称:pxf-tech2,代码行数:4,代码来源:String.cpp
注:本文中的IsAlpha函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论