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

C++ ParseError函数代码示例

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

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



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

示例1: if

void QuantifiedRegexObject::parse(Regex* rgx)
{
	regexObject = new RegexObject;
	regexObject->parse(rgx);
	char c = rgx->src.peek();
	if (c == '+' || c == '*' || c == '?')
	{
		rgx->src.get();
		if (c == '+') type = QuantifierType::KLEENE_PLUS;
		else if (c == '*') type = QuantifierType::KLEENE_STAR;
		else type = QuantifierType::QUESTION_MARK;
		if (rgx->src.peek() == '?')
		{
			greedy = false;
			rgx->src.get();
		}
	}
	else if (c == '{')
	{
		char x;
		int minVal, maxVal;
		minVal = Utility::parseInt(rgx);
		if (rgx->src.get() != ',')
		{
			rgx->src.moveBack();
			maxVal = minVal;
		}
		else
		{
			if (Utility::isDigit(rgx->src.peek()))
			{
				maxVal = Utility::parseInt(rgx);
			}
			else
			{
				maxVal = oo;
			}
		}
		
		if (rgx->src.get() != '}') throw ParseError("");
		if (maxVal < minVal) swap(minVal, maxVal);
		range = make_pair(minVal, maxVal);
		type = QuantifierType::RANGED;
	}
}
开发者ID:IbrahimSba3i,项目名称:RegexTesting,代码行数:45,代码来源:QuantifiedRegexObject.cpp


示例2: ParseError

	/***************************************************************
	* Function: Parser::parseText()
	* Purpose : Parse an XML text region
	* Initial : Maxime Chevalier-Boisvert on October 20, 2008
	****************************************************************
	Revisions and bug fixes:
	*/
	Text* Parser::parseText(const std::string& xmlString, size_t& charIndex, const PosVector& positions)
	{
		// Declare a string to store the text
		std::string text;

		// For each character
		for (;; ++charIndex)
		{
			// If we are past the length of the input stream
			if (charIndex >= xmlString.length())
			{
				// Throw an exception
				throw ParseError("Unexpected end of stream in text region", positions[charIndex]);
			}

			// Extract the current character
			char thisChar = xmlString[charIndex];

			// If this character is the beggining of an escape sequence
			if (thisChar == '&')
			{
				// Parse the escape sequence
				text += parseEscapeSeq(xmlString, charIndex, positions);

				// Move on to the next character
				continue;
			}

			// If this character is the beginning of a tag
			if (thisChar == '<')
			{
				// Move back one character
				charIndex--;

				// Break out of this loop
				break;
			}

			// Add this character to the text
			text += thisChar;
		}

		// Create and returna new text node
		return new Text(text);
	}
开发者ID:dcdelia,项目名称:mcvm,代码行数:52,代码来源:xml.cpp


示例3: Read_termstr_rtn

void Read_termstr_rtn(P_WBXML_INFO buffer, char** result)
{

#define STRING_BLOCK_SIZE 256

	int buflen = STRING_BLOCK_SIZE;
	char* strbuf = (char*) malloc(buflen);
	BOOL doubled = FALSE;
	int i = 0;

	if (!result)
		ParseError(ERR_INTERNAL_BAD_PARAM);

	while ( (BytesLeft(buffer) >= 1) && (*(buffer->m_curpos) != 0) )
	{
		if (i>=buflen)
		{
			buflen += STRING_BLOCK_SIZE;
			strbuf = realloc(strbuf, buflen);
		}

		if (*(buffer->m_curpos) != '$' || doubled == TRUE)
		{
			strbuf[i] = *(buffer->m_curpos);
			buffer->m_curpos++;
			i++;
			if (doubled == TRUE)
				doubled = FALSE;
		}
		else
		{
			strbuf[i] = *(buffer->m_curpos);
			i++;
			doubled = TRUE;
		}
	}

	strbuf[i] = 0;
	buffer->m_curpos++;

	if (*result)
		free(*result);

	*result = strbuf;
}
开发者ID:Phonebooth,项目名称:kannel,代码行数:45,代码来源:decompile.c


示例4: ParseEndIf

/* ParseEndIf - parse the 'END IF' statement */
static void ParseEndIf(ParseContext *c)
{
    switch (CurrentBlockType(c)) {
    case BLOCK_IF:
        fixupbranch(c, c->bptr->u.IfBlock.nxt, codeaddr(c));
        fixupbranch(c, c->bptr->u.IfBlock.end, codeaddr(c));
        PopBlock(c);
        break;
    case BLOCK_ELSE:
        fixupbranch(c, c->bptr->u.ElseBlock.end, codeaddr(c));
        PopBlock(c);
        break;
    default:
        ParseError(c, "END IF without a matching IF/ELSE IF/ELSE");
        break;
    }
    FRequire(c, T_EOL);
}
开发者ID:neutered,项目名称:propgcc,代码行数:19,代码来源:db_statement.c


示例5: ParseError

void CodeTranslator::translate(std::string str)
{
	m_grammar.clear();
    std::string::iterator begin = str.begin(), end = str.end();

    bool success = qi::parse(begin, end, m_grammar);


    if(!success || begin != end)
    {
		m_lbls.clear();
		m_command.setOperationType(Command::NONE);
		throw ParseError("stopped at: " + std::string(begin, end));
	}

    if(m_command.getOperationType() != Command::NONE)
    	checkCorrectness();
}
开发者ID:anjin-viktor,项目名称:composite_vm,代码行数:18,代码来源:CodeTranslator.cpp


示例6: parse_path_absolute

//   path-absolute = "/" [ segment-nz *( "/" segment ) ]
TextCursor parse_path_absolute(TextCursor cursor)
{
    char c = get_char(cursor);
    if (c != '/')
        throw ParseError();
    else
    {
        try
        {
            TextCursor cursor2(parse_segment_nz(cursor));
            REPEAT_IGNORING(parse_slash_segment, cursor2);
        }
        catch(ParseError)
        {
            return cursor;
        }
    }
}
开发者ID:serathius,项目名称:uri-in-file-browser,代码行数:19,代码来源:parser.cpp


示例7: ParseError

// ------------------------------------------------------------------------------------------------
const std::string & ColladaModelFactory::FindAndValidateString(std::map<std::string, std::string> * stringMap, const std::string & index)
{
    // if empty, just return another empty string
    if (index.empty())
    {
        return index;
    }

    // look up 'index' in map
    auto it = stringMap->find(index);
    if (it == stringMap->end())
    {
        static const std::string c_emptyString;
        ParseError("could not find '%s'\n", index.c_str());
        return c_emptyString;
    }
    return it->second;
}
开发者ID:EmmetCooper,项目名称:LevelEditor,代码行数:19,代码来源:ColladaModelFactory.cpp


示例8: free

void Configuration::Assign(const string &field, const string &value)
{
	map<string, char *>::const_iterator match;

	match = _str_map.find(field);
	if (match != _str_map.end())
	{
		free(_str_map[field]);
		_str_map[field] = strdup(value.c_str());
	}
	else
	{
		string errmsg = "Unknown field ";
		errmsg += field;

		ParseError(errmsg, 0);
	}
}
开发者ID:daib,项目名称:workspace,代码行数:18,代码来源:config_utils.cpp


示例9: ParseError

VExpression* VDynamicCast::DoResolve(VEmitContext& ec)
{
	if (op)
		op = op->Resolve(ec);
	if (!op)
	{
		delete this;
		return NULL;
	}

	if (op->Type.Type != TYPE_Reference)
	{
		ParseError(Loc, "Bad expression, class reference required");
		delete this;
		return NULL;
	}
	Type = VFieldType(Class);
	return this;
}
开发者ID:JoshEngebretson,项目名称:Mongrel,代码行数:19,代码来源:vc_expr_cast.cpp


示例10: Parser

	Parser(typename Encode<E>::PointerType input, Automata& nfa)
		: reader(input)
	{
		nfa.clear();
		if (reader.peek() == 0)
		{
			return;
		}
		auto ast = parseRE();
		if (reader.peek() != 0)
		{
			throw ParseError();
		}
		State s;
		State e;
		ast->convertToNFA(nfa, s, e);
		nfa.setStart(s);
		nfa.setTerminate(e);
	}
开发者ID:heleifz,项目名称:HRegex,代码行数:19,代码来源:experiment.cpp


示例11: v_ProcessLibArguments

 // Interpret the next argument as a path, and obtain the IShellItem for it to be consumed by the derived class.
 HRESULT v_ProcessLibArguments(PCWSTR *ppszArgs, int cArgs)
 {
     PCWSTR pszFolderPath = CONSUME_NEXT_ARG(ppszArgs, cArgs);
     HRESULT hr = pszFolderPath ? S_OK : E_INVALIDARG;
     if (SUCCEEDED(hr))
     {
         hr = SHStrDupW(pszFolderPath, &_pszFolderPath);
         if (SUCCEEDED(hr))
         {
             hr = SHCreateItemFromParsingName(pszFolderPath, NULL, IID_PPV_ARGS(&_psiFolder));
         }
     }
     else
     {
         ParseError(L"Missing folder path argument.\n");
     }
     // On success, pass any remaining arguments on to the derived class.
     return SUCCEEDED(hr) ? v_ProcessFolderArguments(ppszArgs, cArgs) : hr;
 }
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:20,代码来源:ShellLibraryCommandLine.cpp


示例12: match

 const Insert &insert_stmt() {
     if (lookahead == INSERT) {
         // insert_stmt -> INSERT INTO id L_PAREN column_list R_PAREN
         //                VALUES L_PAREN value_list R_PAREN SEMICOLON
         match(INSERT); match(INTO);
         string table_id = id();
         match(L_PAREN);
         vector<string> columns;
         column_list(columns);
         match(R_PAREN);
         vector<int> values;
         value_list(values);
         match(R_PAREN);
         match(SEMICOLON);
         return Insert(table_id, columns, values);
     } else {
         throw ParseError("Syntax error");
     }
 }
开发者ID:joyeecheung,项目名称:simple-sql-parser,代码行数:19,代码来源:Parser.cpp


示例13: load

Value load(std::istream& ss) {
// Parse a JSON entity, using the inputstream ss
    parseWhitespace(ss);
    switch (ss.peek()) {
    case '{': return parseObject(ss);
    case '[': return parseArray(ss);
    case '"': return parseString(ss);
    case 't': return parseTrue(ss);
    case 'f': return parseFalse(ss);
    case 'n': return parseNull(ss);
    case '-': return parseNumber(ss);
    default: 
        if(isdigit(ss.peek())) {
            return parseNumber(ss);
        } else {
            throw ParseError(std::string("unexpected token: '")+char(ss.peek())+"'");
        }
    }
}
开发者ID:mfichman,项目名称:json,代码行数:19,代码来源:json.cpp


示例14: ParseElseIf

/* ParseElseIf - parse the 'ELSE IF' statement */
static void ParseElseIf(ParseContext *c)
{
    switch (CurrentBlockType(c)) {
    case BLOCK_IF:
        putcbyte(c, OP_BR);
        c->bptr->u.IfBlock.end = putcword(c, c->bptr->u.IfBlock.end);
        fixupbranch(c, c->bptr->u.IfBlock.nxt, codeaddr(c));
        c->bptr->u.IfBlock.nxt = 0;
        ParseRValue(c);
        FRequire(c, T_THEN);
        putcbyte(c, OP_BRF);
        c->bptr->u.IfBlock.nxt = putcword(c, 0);
        FRequire(c, T_EOL);
        break;
    default:
        ParseError(c, "ELSE IF without a matching IF");
        break;
    }
}
开发者ID:neutered,项目名称:propgcc,代码行数:20,代码来源:db_statement.c


示例15: qDebug

	void DriveManager::handleGetFileInfo ()
	{
		QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender ());
		if (!reply)
			return;

		reply->deleteLater ();

		bool ok = false;
		const auto& res = QJson::Parser ().parse (reply->readAll (), &ok);
		if (!ok)
		{
			qDebug () << Q_FUNC_INFO
					<< "parse error";
			return;
		}

		const QVariantMap& map = res.toMap ();
		QString access_token = Reply2DownloadAccessToken_.take (reply);

		if (!map.contains ("error"))
		{
			DriveItem it = CreateDriveItem (res);
			if (it.DownloadUrl_.isEmpty ())
			{
				QMessageBox::warning (Core::Instance ().GetProxy ()->GetRootWindowsManager ()->GetPreferredWindow (),
						"LeechCraft",
						tr ("This file cannot be downloaded. Use export instead of Download or Open File action"));
				DownloadsQueue_.removeFirst ();
				return;
			}

			if (!access_token.isEmpty ())
				it.DownloadUrl_.addQueryItem ("access_token", access_token);

			if (!DownloadsQueue_.isEmpty ())
				DownloadsQueue_.dequeue () (it.DownloadUrl_);
			return;
		}

		ParseError (map);
	}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:42,代码来源:drivemanager.cpp


示例16: assert

void Args::accept_arg(Pass1 *pass1, ParseNode *arg)
{
	assert(arg->token == RULE_ARG);
	std::list<ParseNode *>::iterator i = arg->children.begin();
	assert(i != arg->children.end());
	assert((*i)->token == CTokenEnums::TOKEN_IDENT);
	std::string base_size = (*i)->text;
	short scalar = 1;
	++i;	// skip past base type
	assert(i != arg->children.end());
	if((*i)->token == '*')
	{
		++i;	// skip past *
		assert(i != arg->children.end());
		assert((*i)->token == CTokenEnums::TOKEN_NUM);
		scalar = get_short((*i)->text);
		if(scalar <= 1)
		{
			throw ParseError(std::string("Invalid argument type: ") + base_size + "*" + (*i)->text,
				arg->lineNum, arg->fileNum, __LINE__
			);
		}
		++i;	// skip scalar
	}
	assert((*i)->token == CTokenEnums::TOKEN_IDENT);
	std::string arg_name = (*i)->text;
	Arg xarg;
	xarg.arg_name = arg_name;
	xarg.size_name = base_size;
	xarg.scalar = scalar;
	Size tmp = pass1->get_exact_size(base_size);
	///std::cout << "(" << base_size << " " << tmp.base << " " << tmp.scalar << ")";
	if(tmp.scalar == 0)
		xarg.base_size = -1;	// parameterized size
	else
	{
		xarg.base_size = tmp.base;
		assert(xarg.scalar == 1);
	}
	///argnums[arg_name] = args.size();
	args.push_back(xarg);
}
开发者ID:huffman,项目名称:CRUDASM7,代码行数:42,代码来源:pass1.cpp


示例17: ParseError

MailAddress::MailAddress(const QVariantList &input, const QByteArray &line, const int start)
{
    // FIXME: all offsets are wrong here
    if (input.size() != 4)
        throw ParseError("MailAddress: not four items", line, start);

    if (input[0].type() != QVariant::ByteArray)
        throw UnexpectedHere("MailAddress: item#1 not a QByteArray", line, start);
    if (input[1].type() != QVariant::ByteArray)
        throw UnexpectedHere("MailAddress: item#2 not a QByteArray", line, start);
    if (input[2].type() != QVariant::ByteArray)
        throw UnexpectedHere("MailAddress: item#3 not a QByteArray", line, start);
    if (input[3].type() != QVariant::ByteArray)
        throw UnexpectedHere("MailAddress: item#4 not a QByteArray", line, start);

    name = Imap::decodeRFC2047String(input[0].toByteArray());
    adl = Imap::decodeRFC2047String(input[1].toByteArray());
    mailbox = Imap::decodeRFC2047String(input[2].toByteArray());
    host = Imap::decodeRFC2047String(input[3].toByteArray());
}
开发者ID:SpOOnman,项目名称:trojita,代码行数:20,代码来源:MailAddress.cpp


示例18: EOF

Flake* Parser::parse_value(){
	Flake* f;
	if(f=parse_text()){
		return f;
	}

	if(f=parse_tag()){
		return f;
	}

	if(f=parse_section()){
		return f;
	}

	//Error checking

	/*
	Snow errors are very predictable, so check for common
	mistakes. By this point, we know the next character is
	one of the quote characters, ], }, whitespace, a control
	character, or EOF (if not, something is HORRIBLY wrong)
	*/

	if(it==end){
		throw ParseError(TAG_EOF,line,col);
	}

	char c=*it;

	if(c==CLOSE_SECTION){
		throw ParseError(UNEXPECTED_CLOSE_SECTION,line,col-1);
	}

	if(c==CLOSE_TAG){
		throw ParseError(UNNAMED_ATTR,colonline,coloncol);
	}

	if(c==NAMED_ATTR){
		throw ParseError(ILLEGAL_NAMED,line,col-1);
	}

	if(isspace(c)){
		//This should NEVER happen. Guarantees a problem with the parser.
		throw ParseError(UNEXPECTED_SPACE,line,col);
	}

	//Reserved for cosmic ray errors
	throw ParseError(COSMIC_RAY_ERR,line,col);
}
开发者ID:ConsciousCode,项目名称:Snow,代码行数:49,代码来源:parser.cpp


示例19: parseString

/**
Parse a source string as an expression
*/
Tuple parseString(const char* str, const char* srcName)
{
    auto input = new Input(
        str,
        srcName
    );

    input->eatWS();

    auto expr = parseExpr(input);

    input->eatWS();

    if (!input->eof())
    {
        throw ParseError(input, "unconsumed input remains");
    }

    return expr;
}
开发者ID:maximecb,项目名称:bjrn,代码行数:23,代码来源:parser.cpp


示例20: parseLetExpr

/**
Parse a let expression
let <ident> = <expr>
*/
Tuple parseLetExpr(Input* input)
{
    input->eatWS();
    auto ident = parseIdentStr(input);

    input->eatWS();
    if (!input->matchCh('='))
    {
        throw ParseError(input, "expected '=' in let expression");
    }

    auto initExpr = parseExpr(input);

    return Tuple{
        Tuple("let"),
        ident,
        initExpr,
        -1
    };
}
开发者ID:maximecb,项目名称:bjrn,代码行数:24,代码来源:parser.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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