PyList* CRowSet::_GetColumnList() const { PyRep* r = FindKeyword( "columns" ); assert( r ); return r->AsList(); }
PyDict* GPSTransportClosed::GetReasonArgs() const { PyRep* r = FindKeyword( "reasonArgs" ); assert( r ); return pyAs(Dict, r); }
DBRowDescriptor* CRowSet::_GetRowDesc() const { PyRep* r = FindKeyword( "header" ); assert( r ); return (DBRowDescriptor*)r->AsObjectEx(); }
PyDict* UserError::_GetDictKeywords() const { PyRep* r = FindKeyword( "dict" ); assert( r ); return pyAs(Dict, r); }
static int ScanIdentifier() { unsigned char* start = CURSOR; if('L' == *CURSOR) { if('\'' == CURSOR[1]) { return ScanCharLiteral(); } else if('\"' == CURSOR[1]) { return ScanStringLiteral(); } } CURSOR++; while(IsLetterOrDigit(*CURSOR)) { CURSOR++; } return FindKeyword((char *)start, (int)(CURSOR - start)); }
/* 标示符扫描函数 */ static int ScanIdentifierOR (int def) { unsigned char *start = CURRENT; int tok; /* 处理宽字符或宽字符串 */ if ('L' == *CURRENT) { /* 处理字符 */ if ('\'' == CURRENT[1]) return ScanCharLiteral (); /* 处理宽字符串 */ if ('"' == CURRENT[1]) return ScanStringLiteral (); } if ( !IsLetterOrDigit (*CURRENT) ) return TK_BEGIN; CURRENT++; /* 字母和数字下画线都符合标示符的要求 */ while (IsLetterOrDigit (*CURRENT)) CURRENT++; /* 判断是否是关键字 */ tok = FindKeyword ((char*)start, (int)(CURRENT - start)); if (TK_ID == tok) { Symbol p; /* 将字符串的值保存在字符串池中 */ TokenValue.p = InternStr ((char*)start, (int)(CURRENT - start)); // 该符号是define if (!def && (p = LookupDefine (TokenValue.p))) { LoadDefine (p); return GetNextToken (); } } else TokenValue.p = TokenString[tok]; return tok; }
void ParseIdentifier() { StartToken(); lastSourceToken.tokenType = TokenType::Identifier; while (index < length && IsIdentifierSafe(Current())) { ++lastSourceToken.length; Advance(); } buffer.assign(source + lastSourceToken.offset, lastSourceToken.length); auto tokenIndex = FindKeyword(buffer.data()); if (tokenIndex != -1) { lastSourceToken.tokenType = TokenType::Reserved; lastSourceToken.tokenIndex = tokenIndex; } }
/** * Read an identifier. */ void ReadIdentifier() { size_t count = 0; /* Read the rest of the identifier */ do { this->buf[count++] = this->current_char; this->Next(); if (count >= buf_len) { /* Scale the buffer if required */ this->buf_len *= 2; this->buf = (char *)realloc(this->buf, sizeof(*this->buf) * this->buf_len); } } while ((isalpha(this->current_char) || this->current_char == '_' || isdigit(this->current_char))); this->buf[count] = '\0'; free(this->string); this->string = strdup(this->buf); this->token = FindKeyword(this->string); }