• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ readToken函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中readToken函数的典型用法代码示例。如果您正苦于以下问题:C++ readToken函数的具体用法?C++ readToken怎么用?C++ readToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了readToken函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: currentValue

bool Reader::readArray(Token& tokenStart) {
  currentValue() = Value(arrayValue);
  currentValue().setOffsetStart(tokenStart.start_ - begin_);
  skipSpaces();
  if (*current_ == ']') // empty array
  {
    Token endArray;
    readToken(endArray);
    return true;
  }
  int index = 0;
  for (;;) {
    Value& value = currentValue()[index++];
    nodes_.push(&value);
    bool ok = readValue();
    nodes_.pop();
    if (!ok) // error already set
      return recoverFromError(tokenArrayEnd);

    Token token;
    // Accept Comment after last item in the array.
    ok = readToken(token);
    while (token.type_ == tokenComment && ok) {
      ok = readToken(token);
    }
    bool badTokenType =
        (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
    if (!ok || badTokenType) {
      return addErrorAndRecover(
          "Missing ',' or ']' in array declaration", token, tokenArrayEnd);
    }
    if (token.type_ == tokenArrayEnd)
      break;
  }
  return true;
}
开发者ID:4ker,项目名称:CMake,代码行数:36,代码来源:json_reader.cpp


示例2: parseTrait

/* parses a trait:
 * 	trait Foo {} */
static boolean parseTrait (tokenInfo *const token)
{
	boolean readNext = TRUE;
	tokenInfo *name;

	readToken (token);
	if (token->type != TOKEN_IDENTIFIER)
		return FALSE;

	name = newToken ();
	copyToken (name, token, TRUE);

	makeSimplePhpTag (name, K_TRAIT, ACCESS_UNDEFINED);

	readToken (token);
	if (token->type == TOKEN_OPEN_CURLY)
		enterScope (token, name->string, K_TRAIT);
	else
		readNext = FALSE;

	deleteToken (name);

	return readNext;
}
开发者ID:Dev0Null,项目名称:ctags,代码行数:26,代码来源:php.c


示例3: next

inline bool Json::next(const JsonValue& _current, JsonValue& _next)
{
	m_readPos = m_fileContent.data() + _current.offset;
	// Iterate through the stream to the next ','. Meanwhile the number of
	// brackets ({} and []) must match.
	int parenthesis = 0;
	do {
		if(!readToken()) return false;
		if(m_tokenPos[0] == '{' || m_tokenPos[0] == '[') ++parenthesis;
		else if(m_tokenPos[0] == '}' || m_tokenPos[0] == ']') --parenthesis;
	} while(parenthesis > 0 || m_tokenPos[0] != ',');
	if(parenthesis < 0) return false;
	readProperty(_next);
	return true;
}
开发者ID:Jojendersie,项目名称:Bim,代码行数:15,代码来源:json.hpp


示例4: parseClass

static void parseClass (tokenInfo *const token)
{
	Assert (isKeyword (token, KEYWORD_class));
	readToken (token);
	if (isType (token, TOKEN_IDENTIFIER))
	{
#ifndef TYPE_REFERENCE_TOOL
		makeEiffelClassTag (token);
		readToken (token);
#else
		vStringCopy (token->className, token->string);
		vStringUpper (token->className);
		if (PrintClass)
			puts (vStringValue (token->className));
		if (! PrintReferences)
			exit (0);
		readToken (token);
#endif
	}

	do
	{
		if (isType (token, TOKEN_OPEN_BRACKET))
			parseGeneric (token, TRUE);
		else if (! isType (token, TOKEN_KEYWORD))
			readToken (token);
		else switch (token->keyword)
		{
			case KEYWORD_inherit:  parseInherit (token);        break;
			case KEYWORD_feature:  parseFeatureClauses (token); break;
			case KEYWORD_convert:  parseConvert (token);        break;
			default:               readToken (token);           break;
		}
	} while (! isKeyword (token, KEYWORD_end) &&
	         ! isType (token, TOKEN_EOF));
}
开发者ID:koron,项目名称:ctags,代码行数:36,代码来源:eiffel.c


示例5: parseRename

static void parseRename (tokenInfo *const token)
{
	do {
		readToken (token);
		if (readFeatureName (token))
		{
			readToken (token);
			if (isKeyword (token, KEYWORD_as))
			{
				readToken (token);
				if (readFeatureName (token))
				{
#ifndef TYPE_REFERENCE_TOOL
					makeEiffelFeatureTag (token);  /* renamed feature */
#endif
					readToken (token);
				}
			}
		}
	} while (isType (token, TOKEN_COMMA));

	findKeyword (token, KEYWORD_end);
	readToken (token);
}
开发者ID:05storm26,项目名称:codelite,代码行数:24,代码来源:eiffel.c


示例6: syntaxError

PARSENODE_PTR SQLParser::parseInsert() {
    if (!startsInsert(nowReading)) {
        syntaxError(nowReading, "expect insert token!");        
        return nullptr;
    }
    //LOG_TRACE(logger, "parse insert statement.");

    PARSENODE_PTR insertNode = PARSENODE_PTR(new ParseNode(INSERT));
    readToken();
    expect(INTO);
    insertNode->children.push_back(parseIdentifier());
    expect(VALUES);

    expect(LEFT_BRACE);
    insertNode->children.push_back(parseLiteral());
    while (nowReading == SLICE) {
        readToken();
        insertNode->children.push_back(parseLiteral());
    }
    expect(RIGHT_BRACE);

    expect(TERMINATOR);
    return insertNode;
}
开发者ID:LLLLKKKK,项目名称:miniSQL,代码行数:24,代码来源:SQLParser.cpp


示例7: parseConvert

static void parseConvert (tokenInfo *const token)
{
	Assert (isKeyword (token, KEYWORD_convert));
	do
	{
		readToken (token);
		if (! isType (token, TOKEN_IDENTIFIER))
			break;
		else if (isType (token, TOKEN_OPEN_PAREN))
		{
			while (! isType (token, TOKEN_CLOSE_PAREN) &&
			       ! isType (token, TOKEN_EOF))
				readToken (token);
		}
		else if (isType (token, TOKEN_COLON))
		{
			readToken (token);
			if (! isType (token, TOKEN_OPEN_BRACE))
				break;
			else while (! isType (token, TOKEN_CLOSE_BRACE))
				readToken (token);
		}
	} while (isType (token, TOKEN_COMMA));
}
开发者ID:jankap,项目名称:ctags,代码行数:24,代码来源:eiffel.c


示例8: expectData

bool DbcParser::expectData(DbcParser::DbcTokenList &tokens, dbc_token_type_t type, QString *data, bool skipWhitespace, bool skipSectionEnding, bool newLineIsSectionEnding)
{
    DbcToken *token;
    if (!(token = readToken(tokens, type, skipWhitespace, skipSectionEnding, newLineIsSectionEnding))) {
        return false;
    }

    if (data) {
        data->clear();
        data->append(token->getData());
    }

    free(token);
    return true;
}
开发者ID:esclear,项目名称:cangaroo,代码行数:15,代码来源:DbcParser.cpp


示例9: int

bool 
Reader::recoverFromError( TokenType skipUntilToken )
{
   int errorCount = int(errors_.size());
   Token skip;
   for (;;)
   {
      if ( !readToken(skip) )
         errors_.resize( errorCount ); // discard errors caused by recovery
      if ( skip.type_ == skipUntilToken  ||  skip.type_ == tokenEndOfStream )
         break;
   }
   errors_.resize( errorCount );
   return false;
}
开发者ID:AchironOS,项目名称:chromium-2,代码行数:15,代码来源:json_reader.cpp


示例10: parseConstant

static void parseConstant (bool local)
{
	tokenInfo *const name = newToken ();
	readToken (name);
	if (local)
	{
		makeVhdlTag (name, VHDLTAG_LOCAL);
	}
	else
	{
		makeVhdlTag (name, VHDLTAG_CONSTANT);
	}
	skipToCharacterInInputFile (';');
	deleteToken (name);
}
开发者ID:pragmaware,项目名称:ctags,代码行数:15,代码来源:vhdl.c


示例11: parseLocal

static void parseLocal (tokenInfo *const token)
{
    Assert (isKeyword (token, KEYWORD_local));
    readToken (token);

    /*  Check keyword first in case local clause is empty
     */
    while (! isKeyword (token, KEYWORD_do)  &&
	   ! isKeyword (token, KEYWORD_once))
    {
#ifndef TYPE_REFERENCE_TOOL
	if (isType (token, TOKEN_IDENTIFIER))
	    makeEiffelLocalTag (token);

#endif
	readToken (token);
	if (isType (token, TOKEN_COLON))
	{
	    readToken (token);
	    if (isType (token, TOKEN_IDENTIFIER))
		parseType (token);
	}
    }
}
开发者ID:att,项目名称:uwin,代码行数:24,代码来源:eiffel.c


示例12: findJsonTags

static void findJsonTags (void)
{
	tokenInfo *const token = newToken ();

	/* We allow multiple top-level elements, although it's not actually valid
	 * JSON.  An interesting side effect of this is that we allow a leading
	 * Unicode BOM mark -- even though ok, many JSON parsers will choke on it */
	do
	{
		readToken (token);
		parseValue (token);
	}
	while (token->type != TOKEN_EOF);

	deleteToken (token);
}
开发者ID:FabianInostroza,项目名称:geany,代码行数:16,代码来源:json.c


示例13: parseInherit

static void parseInherit (tokenInfo *const token)
{
    Assert (isKeyword (token, KEYWORD_inherit));
#ifdef TYPE_REFERENCE_TOOL
    readToken (token);
    while (isType (token, TOKEN_IDENTIFIER))
    {
        parseType (token);
        if (isType (token, TOKEN_KEYWORD))
        {
            switch (token->keyword)  /* check for feature adaptation */
            {
            case KEYWORD_rename:
            case KEYWORD_export:
            case KEYWORD_undefine:
            case KEYWORD_redefine:
            case KEYWORD_select:
                findKeyword (token, KEYWORD_end);
                readToken (token);
            default:
                break;
            }
        }
    }
#else
    readToken (token);
    while (isType (token, TOKEN_IDENTIFIER))
    {
        parseType (token);
        switch (token->keyword)  /* check for feature adaptation */
        {
        case KEYWORD_rename:
            parseRename (token);
            if (isKeyword (token, KEYWORD_end))
                readToken (token);
            break;

        case KEYWORD_export:
        case KEYWORD_undefine:
        case KEYWORD_redefine:
        case KEYWORD_select:
            findKeyword (token, KEYWORD_end);
            readToken (token);
            break;

        case KEYWORD_end:
            readToken (token);
            break;

        default:
            break;
        }
    }
#endif
}
开发者ID:Figoer,项目名称:i_figoer,代码行数:55,代码来源:eiffel.c


示例14: findHtmlTags

static void findHtmlTags (void)
{
	tokenInfo token;

	token.string = vStringNew ();

	do
	{
		readToken (&token, true);
		if (token.type == TOKEN_TAG_START)
			readTag (&token, NULL, 0);
	}
	while (token.type != TOKEN_EOF);

	vStringDelete (token.string);
}
开发者ID:qzhuyan,项目名称:ctags,代码行数:16,代码来源:html.c


示例15: while

int Parser::readToken(s_cursor_t &it, const s_cursor_t &end) {
    // skipping any whitespace
    while (it != end && isspace(_lastChar))
      _lastChar = *(it++); // getting char and advancing cursor

    if (isalpha(_lastChar)) { /// identifier: [a-zA-Z][a-zA-Z0-9]*
        _identifier = _lastChar;
        while (it != end && isalnum((_lastChar = *(it++))))
          _identifier += _lastChar;

        if (_identifier == def_id)
            return tok_def;
        else if (_identifier == extern_id)
            return tok_extern;

        return tok_identifier;
    }

    if (isdigit(_lastChar)) { // number [0-9]
        std::string num;
        do {
          num += _lastChar;
        } while (it != end && isdigit((_lastChar = *(it++))));
        _number = strtol(num.c_str(), nullptr, 10);

        return tok_number;
    }

    if (_lastChar == '#') {
        // just a loop for ignoring everything after the #
        do
            _lastChar = *(it++);
        while (it != end && _lastChar != '\n' && _lastChar != '\r');

        if (_lastChar != EOF)
        return readToken(it, end);
    }

    if (it == end || _lastChar == EOF) {
      _lastChar = tok_eof;
    }

    // don't know what to do with this char
    int thisChar = _lastChar;
    _lastChar = *(it++);
    return thisChar;
}
开发者ID:alediaferia,项目名称:sand,代码行数:47,代码来源:parser.cpp


示例16: eatWhitespace

bool MenuConf::readItemNameIfPresent(FILE* f, Item* item)
{
    eatWhitespace(f);
    if(! isAlpha(curChar)) {
        return true;//Name not present
    }
    if(! readToken(f, item->data->name, ItemData::NameSize)) {
        return false;
    }
    eatWhitespace(f);
    if(curChar != ':') {
        printf("%d, %d: Expected ':'\n", lineIndex, caret);
        return false;
    }
    nextChar(f);
    return true;
}
开发者ID:Kopakc,项目名称:NoiseWorld,代码行数:17,代码来源:MenuConf.cpp


示例17: throwRuntimeException

JNIEXPORT jboolean JNICALL Java_gov_nasa_jpf_symbolic_dp_NativeInterface_isSatisfiable
  (JNIEnv *env, jclass cls, jstring constraintString )
{
  constraint = (char*) (*env)->GetStringUTFChars(env,constraintString, NULL);
  if( constraint == NULL ){
    throwRuntimeException( "out of memory?" );
  }

  //printf( "query: %s\n", constraint);
  //fflush(stdout);
  if (constraint[0] == '\0')
    return TRUE;

  vc_push(vc);
  marker = 0;
  int constraintCount = 1;
  char c;
  int i = 0;
  do{
    c = constraint[i++];
    if (c == ',')
      constraintCount++;
  }while(c != '\0');

  Expr* constraintArray = (Expr*) malloc(sizeof(Expr)*constraintCount);
  i = 0;
  char token[2]; // it must be just a comma and '\0'
  do{
    constraintArray[i++] = parse();
  }while(readToken(token));

  Expr andExpr = vc_andExprN(vc, constraintArray, constraintCount);
  linkedlist_add(&exprPool, andExpr);
  
  jboolean result = check(vc, andExpr);

  //fflush(stdout);

  //clean up
  (*env)->ReleaseStringUTFChars(env,constraintString, constraint);
  free(constraintArray);
  freeStuff();
  vc_pop(vc);

  return result;
}
开发者ID:MohsinN,项目名称:jpf,代码行数:46,代码来源:cvcl.c


示例18: readToken

/* Tokenizer::peekToken
 * Returns the next token without actually moving past it
 *******************************************************************/
string Tokenizer::peekToken()
{
	// Backup current position
	char* c = current;
	uint32_t p = position;
	int oline = line;

	// Read the next token
	readToken();

	// Go back to original position
	current = c;
	position = p;
	line = oline;

	// Return the token
	return token_current;
}
开发者ID:Monsterovich,项目名称:SLADE,代码行数:21,代码来源:Tokenizer.cpp


示例19: readEmployeeRecord

Employee *
readEmployeeRecord(FILE *fp)          // we pass the file pointer in
    {
    char *name,*title;
    int years;
    double salary;
    
    name = readString(fp);           //name is a string, not a token

    if (feof(fp)) { return 0; }      // no record, return the null pointer

    name = name;
    title = readToken(fp);
    years = readInt(fp);
    salary = readReal(fp);

    return newEmployee(name,title,years,salary);
    }
开发者ID:Uname-a,项目名称:cs150,代码行数:18,代码来源:structures.c


示例20: parseFeatureClauses

static void parseFeatureClauses (tokenInfo *const token)
{
    Assert (isKeyword (token, KEYWORD_feature));
    do
    {
        if (isKeyword (token, KEYWORD_feature))
            parseExport (token);
        if (! isKeyword (token, KEYWORD_feature) &&
                ! isKeyword (token, KEYWORD_invariant) &&
                ! isKeyword (token, KEYWORD_indexing))
        {
            if (! parseFeature (token))
                readToken (token);
        }
    } while (! isKeyword (token, KEYWORD_end) &&
             ! isKeyword (token, KEYWORD_invariant) &&
             ! isKeyword (token, KEYWORD_indexing));
}
开发者ID:Figoer,项目名称:i_figoer,代码行数:18,代码来源:eiffel.c



注:本文中的readToken函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readU16函数代码示例发布时间:2022-05-30
下一篇:
C++ readString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap