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

C++ ParseToken函数代码示例

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

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



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

示例1: ParseToken

void RawParser::ParseInfoToken(const char *&pcs, int &iLen, bool *pbMoreFollows)
{
	if (!FindNextToken()) {
		if (pbMoreFollows) *pbMoreFollows = false;
		return;
	}

	pcs = (const char *)pbPos;
	if (*pcs == '"') pcs++;

	ParseToken(sz, pbMoreFollows);

	iLen = int(strlen(sz));
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:14,代码来源:ief_raw.cpp


示例2: InitNetSvcList

// Initialize net service list
void InitNetSvcList(CEDAR *cedar)
{
	char filename[MAX_PATH] = "/etc/services";
	BUF *b;
	// Validate arguments
	if (cedar == NULL)
	{
		return;
	}

#ifdef	OS_WIN32
	Format(filename, sizeof(filename), "%s\\drivers\\etc\\services", MsGetSystem32Dir());
#endif

	cedar->NetSvcList = NewList(CompareNetSvc);

	b = ReadDump(filename);
	if (b == NULL)
	{
		return;
	}

	while (true)
	{
		char *s = CfgReadNextLine(b);
		if (s == NULL)
		{
			break;
		}

		Trim(s);
		if (s[0] != '#')
		{
			TOKEN_LIST *t = ParseToken(s, " \t/");
			if (t->NumTokens >= 3)
			{
				NETSVC *n = ZeroMalloc(sizeof(NETSVC));
				n->Name = CopyStr(t->Token[0]);
				n->Udp = (StrCmpi(t->Token[2], "udp") == 0 ? true : false);
				n->Port = ToInt(t->Token[1]);
				Add(cedar->NetSvcList, n);
			}
			FreeToken(t);
		}
		Free(s);
	}

	FreeBuf(b);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:50,代码来源:Cedar.c


示例3: ListidP

int Anasin::ListidP(){
	Lexema nextLexema = this->_symTab->lookAheadLexema();
	if(nextLexema._tipo == "Punctuation" && nextLexema._valor == ","){
		//12) ListidP -> , Listid
		if(!ParseToken(Lexema("Punctuation",","),true)) return 0;
		if(!Listid()) return 0;
	}else if(nextLexema._tipo == "Reserved" && nextLexema._valor == "nil"){
		//13) ListidP -> €
		// No hago nada
	}else{
		std::cout << "Error sintáctico, se esperaba : Punctuation, nil y se obtuvo: " << nextLexema._tipo << " ("<< nextLexema._valor <<")["<< this->_symTab->getOffset() <<"]" << std::endl;
		return 0;
	}
	return 1;
}
开发者ID:sabs231,项目名称:compilers,代码行数:15,代码来源:Anasin.cpp


示例4: json_wide

Value* JSONReader::JsonToValue(const std::string& json, bool check_root,
                               bool allow_trailing_comma)
{
    // 输入必须是UTF-8编码.
    if(!IsStringUTF8(json.c_str()))
    {
        error_code_ = JSON_UNSUPPORTED_ENCODING;
        return NULL;
    }

    // 从UTF8到wstring的转换会移除空字节(好事).
    std::wstring json_wide(UTF8ToWide(json));
    start_pos_ = json_wide.c_str();

    // 当输入的JSON字符串开头有UTF-8的Byte-Order-Mark(0xEF, 0xBB, 0xBF),
    // UTF8ToWide()函数会把它转换成BOM(U+FEFF). 为防止JSONReader::BuildValue()
    // 函数把它当成非法字符而返回NULL, 如果存在Unicode的BOM则先跳过.
    if(!json_wide.empty() && start_pos_[0]==0xFEFF)
    {
        ++start_pos_;
    }

    json_pos_ = start_pos_;
    allow_trailing_comma_ = allow_trailing_comma;
    stack_depth_ = 0;
    error_code_ = JSON_NO_ERROR;

    scoped_ptr<Value> root(BuildValue(check_root));
    if(root.get())
    {
        if(ParseToken().type == Token::END_OF_INPUT)
        {
            return root.release();
        }
        else
        {
            SetErrorCode(JSON_UNEXPECTED_DATA_AFTER_ROOT, json_pos_);
        }
    }

    // "语法错误".
    if(error_code_ == 0)
    {
        SetErrorCode(JSON_SYNTAX_ERROR, json_pos_);
    }

    return NULL;
}
开发者ID:kanego,项目名称:CoreProject,代码行数:48,代码来源:json_reader.cpp


示例5: asASSERT

eTokenType asCTokenizer::GetToken(const char *source, size_t sourceLength, size_t *tokenLength, asETokenClass *tc)
{
	asASSERT(source != 0);
	asASSERT(tokenLength != 0);

	this->source = source;
	this->sourceLength = sourceLength;

	asETokenClass t = ParseToken();
	if( tc ) *tc = t;

	// Copy the output to the token
	*tokenLength = this->tokenLength;

	return tokenType;
}
开发者ID:badotter,项目名称:badotter-ogitor-physx,代码行数:16,代码来源:as_tokenizer.cpp


示例6: ParseExtendedTX

static int
ParseExtendedTX(void)
{
    int style = TX_ORIGINAL;

    if (ParseToken(PARSE_COMMENT)) {
	if (!strncmp(token, "//TX", 4)) {
	    if (token[4] == '1')
		style = TX_QUARK_TYPE1;
	    else if (token[4] == '2')
		style = TX_QUARK_TYPE2;
	}
    }

    return style;
}
开发者ID:AidHamza,项目名称:eviltoys,代码行数:16,代码来源:map.c


示例7: ParseExtendedTX

static texcoord_style_t
ParseExtendedTX(parser_t *parser)
{
    texcoord_style_t style = TX_ORIGINAL;

    if (ParseToken(parser, PARSE_COMMENT)) {
	if (!strncmp(parser->token, "//TX", 4)) {
	    if (parser->token[4] == '1')
		style = TX_QUARK_TYPE1;
	    else if (parser->token[4] == '2')
		style = TX_QUARK_TYPE2;
	}
    }

    return style;
}
开发者ID:JoshEngebretson,项目名称:FSRadQuakeStuff,代码行数:16,代码来源:map.c


示例8: CommandLineMode

void CommandLineMode(int argc, char *argv[], void *htmsocket) {
    char *messageName;
    char *token;
    typedArg args[MAX_ARGS];
    int i,j, numArgs;
    OSCbuf buf[1];

    OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf);

    if (argc > 1) {
	if (OSC_openBundle(buf, OSCTT_Immediately())) {
	    complain("Problem opening bundle: %s\n", OSC_errorMessage);
	    return;
	}
    }

    for (i = 0; i < argc; i++) {
        messageName = strtok(argv[i], ",");
        if (messageName == NULL) {
            break;
        }

        j = 0;
        while ((token = strtok(NULL, ",")) != NULL) {
            args[j] = ParseToken(token);
            j++;
	    if (j >= MAX_ARGS) {
		complain("Sorry; your message has more than MAX_ARGS (%d) arguments; ignoring the rest.\n",
			 MAX_ARGS);
		break;
	    }
        }
        numArgs = j;

        WriteMessage(buf, messageName, numArgs, args);
    }

    if (argc > 1) {
	if (OSC_closeBundle(buf)) {
	    complain("Problem closing bundle: %s\n", OSC_errorMessage);
	    return;
	}
    }

    SendBuffer(htmsocket, buf);
}
开发者ID:Angeldude,项目名称:pd,代码行数:46,代码来源:sendOSC.c


示例9: Operador

int Anasin::Operador(){
	Lexema nextLexema = this->_symTab->lookAheadLexema();
	if(nextLexema._tipo == "Arithmetic"){
		// 27) Operador  -> arithmetic Expresion
		if(!ParseToken(Lexema("Arithmetic",""),false)) return 0;
		if(!Expresion()) return 0;
	}else if(nextLexema._tipo == "Relational" ||
			(nextLexema._tipo == "Agrupation" && nextLexema._valor == ")") ||
			(nextLexema._tipo == "Punctuation" && nextLexema._valor == ";")){
		// 28) Operador  -> €
		// No hago nada
	}else{
		std::cout << "Error sintáctico, se esperaba : Arithmetic, Relational, ) o ; y se obtuvo: " << nextLexema._tipo << " ("<< nextLexema._valor <<")["<< this->_symTab->getOffset() <<"]" << std::endl;
		return 0;
	}
	return 1;
}
开发者ID:sabs231,项目名称:compilers,代码行数:17,代码来源:Anasin.cpp


示例10: DoInclude

int DoInclude(ParsePtr p)
{
    DynamicBuffer buf;
    int r, e;

    DBufInit(&buf);
    if ( (r=ParseToken(p, &buf)) ) return r;
    e = VerifyEoln(p);
    if (e) Eprint("%s", ErrMsg[e]);
    if ( (r=IncludeFile(DBufValue(&buf))) ) {
	DBufFree(&buf);
	return r;
    }
    DBufFree(&buf);
    NumIfs = 0;
    IfFlags = 0;
    return OK;
}
开发者ID:Yomin,项目名称:remind,代码行数:18,代码来源:files.c


示例11: Ctx

bool CXMLElement::ParseRootTag (IMemoryBlock &Stream, CString *retsTag)

//	ParseRootTag
//
//	This function parses only enough to determine the root tag, either by reading
//	as far as the first open tag or by getting the DOCTYPE.
//
//	This function is a hack to allow Transcendence to read the root tag for an
//	extension without loading the whole file.

	{
	//	Initialize context

	ParserCtx Ctx(Stream, NULL);
	Ctx.m_bParseRootTag = true;

	//	Parse the prologue

	if (!ParsePrologue(&Ctx))
		return false;

	if (!Ctx.m_sRootTag.IsEmpty())
		{
		*retsTag = Ctx.m_sRootTag;
		return true;
		}

	//	Next token must be an element open tag

	if (Ctx.iToken != tkTagOpen)
		return false;

	//	Parse the root element name

	if (ParseToken(&Ctx) != tkText)
		return false;

	*retsTag = Ctx.sToken;

	//	Done

	return true;
	}
开发者ID:gmoromisato,项目名称:Hexarc,代码行数:43,代码来源:XMLParser.cpp


示例12: GetStream

int CCloseCaptionPhrase::CountTokens( void ) const
{
	int count = 0;
	wchar_t token[ 1024 ];
	wchar_t const *in = GetStream();

	while ( in )
	{
		in = ParseToken( in, token, sizeof( token ) );
		if ( wcslen( token ) > 0 )
		{
			count++;
		}
		if ( !in || *in == L'\0' )
			break;
	}

	return count;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:19,代码来源:sentence.cpp


示例13: Skip

bool Scanner::GetToken(Token *token)
{
	if ((token == NULL))
	{
		return false;
	}

	Skip();

	if (ParseDigit(token))
		return true;

	if (ParseToken(token))
		return true;

	if (ParseOperator(token))
		return true;

	return false;
}
开发者ID:CarbonOS,项目名称:libgraphics,代码行数:20,代码来源:scanner.cpp


示例14: ParseParams

bool RawParser::ParseParams(PCTCHAR pcszDefaultFile)
{
	if (!ParseToken(sz)) return false;
	if (_strcmpi(sz, "RawImage") != 0) return false;

	for (int n = 0; n < 4; n++) {
		_tcscpy(Comps[n].szFile, pcszDefaultFile);
		Comps[n].nStart = 0;
		Comps[n].nDelta = -1;
	}

	ParseMainBlock();

	for (int n = 0; n < 4; n++) {
		if (Comps[n].nDelta < 0)
			Comps[n].nDelta = cbComp;
	}

	return true;
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:20,代码来源:ief_raw.cpp


示例15: ParseFile

static inline
int ParseFile(char* Filename, GLArbToken* ArbHash,
               GLToken* FunctionsHash, unsigned int* FunctionCount,
               GLToken* DefinesHash, unsigned int* DefinesCount,
               GLSettings* Settings)
{
  char* Data = ReadEntireFile(Filename);
  int Success = 0;
  if (Data)
  {
    GLTokenizer Tokenizer;
    Tokenizer.At = Data;
    while(*Tokenizer.At)
    {
      GLToken Token = ParseToken(&Tokenizer);
      if (StartsWith(Token.Value, "gl") && IsUpperCase(Token.Value.Chars[2]))
      {
        if (!Contains(FunctionsHash, Token) && IsKnownOrIgnoredToken(ArbHash, &Token, Settings))
        {
          AddToken(FunctionsHash, Token);
          *FunctionCount += 1;
        }
      }
      if (StartsWith(Token.Value, "GL_"))
      {
        if (!Contains(DefinesHash, Token) && IsKnownOrIgnoredToken(ArbHash, &Token, Settings))
        {
          AddToken(DefinesHash, Token);
          *DefinesCount += 1;
        }
      }
    }
    free(Data);
    Success = 1;
  }
  else
  {
    fprintf(stderr, "Couldn't open file %s", Filename);
  }
  return Success;
}
开发者ID:MetricPanda,项目名称:glgen,代码行数:41,代码来源:glgen.cpp


示例16: while

//
// parses format and (via UpdateAttr and convert) outputs data
void ydpDictionary::ParseRTF(void) {
	char *def = curDefinition;
	int level=0, attr=0, attrs[16], phon;

	newline_=0; newattr=0; newphon=0;

	textlen=0;
	outputView->SetText("");

	while(*def) {
		switch(*def) {
			case '{':
				if (level<16) attrs[level++] = attr;
				break;
			case '\\':
				def = ParseToken(def);
				UpdateAttr(attr);
				attr = newattr;
				break;
			case '}':
				newattr = attrs[--level];
				UpdateAttr(attr);
				break;
			default:
				line += *def;
				break;
		}
		def++;
		if (newline_) {
			if (newattr & A_MARGIN) {
				line.Prepend("\t\t",2);
			}
			line.Append("\n",1);
			UpdateAttr(attr);
			newline_ = 0;
		}
		attr = newattr;
		phon = newphon;
	}
	UpdateAttr(attr);
}
开发者ID:louisdem,项目名称:beos-bydpdict,代码行数:43,代码来源:bydpdictionary.cpp


示例17: TokenizeString

// returns pointer to array of pointers to null terminated strings
// (like argc, argv from main), quoted arguments have quotes stripped.
// this function is destructive in that it will write null's and remove
// quotes from the string.
//
// the caller must use HeapFree to free the returned pointer.
//
LPCTSTR * TokenizeString (
   LPCTSTR pszInput,
   LPUINT  pcArgs)
{
   *pcArgs = 0;
   if ( ! pszInput)
      return NULL;

   UINT cch = lstrlen (pszInput);
   if ( ! cch)
      return NULL;

   UINT cbAlloc = ((cch + 1) * sizeof(char*) +  cch * sizeof(TCHAR) * 2);
   LPCTSTR * pArgv = (LPCTSTR *)HeapAlloc(GetProcessHeap(), 0, cbAlloc);
   if ( ! pArgv)
      return NULL;

   LPTSTR pszToken = (LPTSTR)(&pArgv[cch + 1]);
   UINT   cArgs    = 0;

   CopyMemory(pszToken, pszInput, (cch+1) * sizeof(TCHAR));

   pszToken = _SkipWhiteSpace (pszToken);
   while (0 != pszToken[0])
      {
      LPTSTR psz = ParseToken(pszToken);
      pArgv[cArgs++] = pszToken;
      pszToken = _SkipWhiteSpace (psz);
      }

   *pcArgs = cArgs;
   pArgv[cArgs] = NULL;
   if ( ! cArgs)
      {
      HeapFree(GetProcessHeap(), 0, pArgv);
      pArgv = NULL;
      }

   return pArgv;
}
开发者ID:blueskyll,项目名称:condor,代码行数:47,代码来源:tokenize.cpp


示例18: ParseMoves

void ParseMoves(POS *p, char *ptr) {
  
  char token[180];
  UNDO u[1];

  for (;;) {

    // Get next move to parse

    ptr = ParseToken(ptr, token);

  // No more moves!

    if (*token == '\0') break;

    p->DoMove(StrToMove(p, token), u);

  // We won't be taking back moves beyond this point:

    if (p->rev_moves == 0) p->head = 0;
  }
}
开发者ID:raimarHD,项目名称:lcec,代码行数:22,代码来源:uci.cpp


示例19: BloqueE

int Anasin::BloqueE(){
	Lexema nextLexema = this->_symTab->lookAheadLexema();
	if(nextLexema._tipo == "Reserved" && nextLexema._valor == "else"){
		// 15) BloqueE -> else BloqueS
		if(!ParseToken(Lexema("Reserved","else"),true)) return 0;
		if(!BloqueS()) return 0;
	}else if(nextLexema._tipo == "id" ||
			nextLexema._tipo == "Output" ||
			(nextLexema._tipo == "Agrupation" && nextLexema._valor == "}") ||
			(nextLexema._tipo == "Reserved" && nextLexema._valor == "while") ||
			(nextLexema._tipo == "Reserved" && nextLexema._valor == "if") ||
			(nextLexema._tipo == "Reserved" && nextLexema._valor == "arr") ||
			(nextLexema._tipo == "Reserved" && nextLexema._valor == "count")||
			nextLexema._tipo == "$"){
		// 16) BloqueE -> €
		// No hago nada
	}else{
		std::cout << "Error sintáctico, se esperaba : else, id, }, output, while, if, arr, count y se obtuvo: " << nextLexema._tipo << " ("<< nextLexema._valor <<")["<< this->_symTab->getOffset() <<"]" << std::endl;
		return 0;
	}
	return 1;
}
开发者ID:sabs231,项目名称:compilers,代码行数:22,代码来源:Anasin.cpp


示例20: while

void CEnvEffectsScript::LoadFromBuffer( const char *scriptfile, const char *buffer )
{
	while ( 1 )
	{
		ParseToken();
		
		if ( !token[0] )
		{
			break;
		}

		if ( !Q_stricmp( token, "effect" ) )
		{
			ParseNewEffect();
		}
		else
		{
			Warning( "CEnvEffectsScript: Unknown entry type '%s'\n", token );
			break;
		}
	}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:22,代码来源:env_effectsscript.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ParseValue函数代码示例发布时间:2022-05-30
下一篇:
C++ ParsePyTupleError函数代码示例发布时间: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