本文整理汇总了C++中ParserException函数的典型用法代码示例。如果您正苦于以下问题:C++ ParserException函数的具体用法?C++ ParserException怎么用?C++ ParserException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParserException函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TypeSpec
Node* Parser::StructDeclaration() {
Symbol *type = TypeSpec();
if(type != NULL) {
Node *decl = StructDeclaratorList(type);
if(oper == SEMICOLON)
Next();
else
throw ParserException(currentToken, "Struct declaration without ';'");
return decl;
}
return NULL;
}
开发者ID:forsaken1,项目名称:compiler,代码行数:15,代码来源:parser.cpp
示例2: ParserException
QString Parser::Private::blockingReadElementText()
{
//analogous to QXmlStreamReader::readElementText(), but blocking. readElementText() doesn't recover from PrematureEndOfData,
//but always returns a null string if isStartElement() is false (which is the case if it already parts of the text)
//affects at least Qt <= 4.7.1. Reported as QTBUG-14661.
if (!reader.isStartElement())
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"trying to read element text although current position is not start of element"));
QString result;
forever {
const QXmlStreamReader::TokenType type = blockingReadNext();
switch (type) {
case QXmlStreamReader::Characters:
case QXmlStreamReader::EntityReference:
result += reader.text();
break;
case QXmlStreamReader::EndElement:
return result;
case QXmlStreamReader::ProcessingInstruction:
case QXmlStreamReader::Comment:
break;
case QXmlStreamReader::StartElement:
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected child element while reading element text"));
default:
//TODO handle
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected token type %1").arg(type));
break;
}
}
return QString();
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:36,代码来源:parser.cpp
示例3: ParserException
Repeat Repeat::parse(const core::WithPos<core::GenericProperty> &generic)
{
if (!generic->getParameters().empty()) {
throw ParserException(generic.pos(), "The " + NAME + " property must have no parameters!");
}
auto &value = generic->getValue();
return Repeat {
/* NOTE: the spec doesn't specify that the value should be non-negative,
* so it is not checked (even though a negative value doesn't seem
* to make sense here) */
core::ValueParser::parseInteger(
value.pos(), value->begin(), value->end())
};
}
开发者ID:LuboO,项目名称:iCalendar-parser_PA193_Rteam,代码行数:15,代码来源:repeat.cpp
示例4: Parse_SyntaxExpressionAction
void Parse_SyntaxExpressionAction(Context& ctx)
{
if (ctx.Token() == TKLeftCurlyBracketCharacter)
{
//SyntaxExpressionAction => LeftCurlyBracketCharacter Identifier RightCurlyBracketCharacter
ctx.Match(TKLeftCurlyBracketCharacter);
ctx.Match(TKIdentifier);
ctx.Action_PrintAction();
ctx.Match(TKRightCurlyBracketCharacter);
}
else
{
throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
}
}
开发者ID:thradams,项目名称:tklgen,代码行数:15,代码来源:Sample1Parser.cpp
示例5: Next
Node* Parser::CompoundStmt() {
if(oper == FIGURE_LEFT_BRACKET) {
Next();
Node *decl = DeclarationList();
Node *stmt = StatementList();
if(oper != FIGURE_RIGHT_BRACKET)
throw ParserException(currentToken, "Compound statement without '}'");
else
Next();
return new NodeStmt("{stmt}", decl, stmt);
}
return NULL;
}
开发者ID:forsaken1,项目名称:compiler,代码行数:15,代码来源:parser.cpp
示例6: get_type
Type
get_type(const Token tok)
{
switch(tok)
{
case Token::StringType:
return Type::String;
case Token::FloatingType:
return Type::Floating;
case Token::IntegerType:
return Type::Integer;
default:
throw ParserException(ParserExceptionType::Unknown);
}
}
开发者ID:Zenol,项目名称:PiouPiou,代码行数:15,代码来源:Parser.cpp
示例7: ParserException
PktPacket::PktPacket(const GTTPacket& gttpkt) {
std::map<std::string, std::string>::const_iterator it;
// Check protocol
if (gttpkt.protocol.compare("MESH")) {
log::error << "RReply: Invalid GTT protocol "
<< gttpkt.protocol << log::endl;
throw ParserException("RReplyPacket", "Invalid GTT packet");
}
if (gttpkt.method.compare("PKT")) {
log::error << "RReply: Invalid GTT method "
<< gttpkt.method << log::endl;
throw ParserException("RReplyPacket", "Invalid GTT packet");
}
// Parse headers
for (it = gttpkt.headers.begin(); it != gttpkt.headers.end(); it++) {
if (boost::iequals(it->first, "Source")) {
source = Address(it->second);
} else if (boost::iequals(it->first, "Destination")) {
destination = Address(it->second);
} else if (boost::iequals(it->first, "NextHop")) {
nexthop = Address(it->second);
} else if (boost::iequals(it->first, "Seq")) {
seq = String::toInt(it->second);
} else {
log::error << "RReply: Unknown header "
<< it->first << log::endl;
throw ParserException("PktPacket", "Invalid GTT header");
}
}
// Copy data
size = gttpkt.size;
data = gttpkt.body;
}
开发者ID:fishilico,项目名称:ipovermesh,代码行数:36,代码来源:pktpacket.cpp
示例8: ParseVarSymbols
void Parser::ParseVarSymbols(sptr<SymTable> table, bool is_record)
{
table = table ? table : currSymTable;
do
{
if (Match(PROCEDURE, FUNCTION))
{
if (is_record) throw ParserException("functions is not allowed in records");
ParseFunc();
}
else
{
ParseVarList(table);
}
} while (MatchSkip(SEMICOLON, -1));
}
开发者ID:Arkm4n,项目名称:Syntaxer,代码行数:16,代码来源:Parser.cpp
示例9: Expression
Node* Parser::ExpressionStmt() {
Node *link = Expression();
if(oper == SEMICOLON) {
Next();
if(link == NULL)
return new NodeStmt("(stmt)", NULL, NULL);
return new NodeSafeStmt(link);
}
else
if(link != NULL)
throw ParserException(currentToken, "Expression without ';'");
return NULL;
}
开发者ID:forsaken1,项目名称:compiler,代码行数:16,代码来源:parser.cpp
示例10: switch
int Parser::Private::parseErrorKind(const QString &kind)
{
switch (tool) {
case Memcheck:
return parseMemcheckErrorKind(kind);
case Ptrcheck:
return parsePtrcheckErrorKind(kind);
case Helgrind:
return parseHelgrindErrorKind(kind);
case Unknown:
default:
break;
}
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse error kind, tool not yet set."));
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:16,代码来源:parser.cpp
示例11: Parse_InterleaveDeclaration
void Parse_InterleaveDeclaration(Context& ctx)
{
if (ctx.Token() == TKKeywordInterleave)
{
//InterleaveDeclaration => KeywordInterleave Identifier EqualsCharacter TokenExpression SemicolonCharacter
ctx.Match(TKKeywordInterleave);
ctx.Match(TKIdentifier);
ctx.Match(TKEqualsCharacter);
Parse_TokenExpression(ctx);
ctx.Match(TKSemicolonCharacter);
}
else
{
throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
}
}
开发者ID:thradams,项目名称:tklgen,代码行数:16,代码来源:Sample1Parser.cpp
示例12: Parse_LanguageBody
void Parse_LanguageBody(Context& ctx)
{
if (ctx.Token() == TKKeywordLanguage)
{
//LanguageBody => KeywordLanguage Identifier LeftCurlyBracketCharacter Declarations RightCurlyBracketCharacter
ctx.Match(TKKeywordLanguage);
ctx.Match(TKIdentifier);
ctx.Action_LanguageName();
ctx.Match(TKLeftCurlyBracketCharacter);
Parse_Declarations(ctx);
ctx.Match(TKRightCurlyBracketCharacter);
}
else
{
throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
}
}
开发者ID:thradams,项目名称:tklgen,代码行数:17,代码来源:Sample1Parser.cpp
示例13: InitDeclarator
Node* Parser::InitDeclaratorList(Symbol *type) {
Node *first = InitDeclarator(type);
if(oper == COMMA) {
Next();
Node *second = InitDeclaratorList(type);
if(second == NULL)
throw ParserException(currentToken, "Expected expression after ','");
return new NodeSafeStmt(first, second);
}
if(first != NULL)
return new NodeSafeStmt(first);
return NULL;
}
开发者ID:forsaken1,项目名称:compiler,代码行数:17,代码来源:parser.cpp
示例14: Parse_F
void Parse_F(Context& ctx)
{
if (ctx.Token() == TKKeywordAny ||
ctx.Token() == TKLiteralChar ||
ctx.Token() == TKIdentifier ||
ctx.Token() == TKLeftParenthesisCharacter ||
ctx.Token() == TKStringLiteral)
{
//F => P OptOperator
Parse_P(ctx);
Parse_OptOperator(ctx);
}
else
{
throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
}
}
开发者ID:thradams,项目名称:tklgen,代码行数:17,代码来源:Sample1Parser.cpp
示例15: Parse_T
void Parse_T(Context& ctx)
{
if (ctx.Token() == TKKeywordAny ||
ctx.Token() == TKLiteralChar ||
ctx.Token() == TKIdentifier ||
ctx.Token() == TKLeftParenthesisCharacter ||
ctx.Token() == TKStringLiteral)
{
//T => F ZeroOrMoreOrF
Parse_F(ctx);
Parse_ZeroOrMoreOrF(ctx);
}
else
{
throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
}
}
开发者ID:thradams,项目名称:tklgen,代码行数:17,代码来源:Sample1Parser.cpp
示例16: Parse_SyntaxExpression
void Parse_SyntaxExpression(Context& ctx)
{
if (ctx.Token() == TKKeywordEmpty ||
ctx.Token() == TKLiteralChar ||
ctx.Token() == TKIdentifier ||
ctx.Token() == TKLeftCurlyBracketCharacter ||
ctx.Token() == TKStringLiteral)
{
//SyntaxExpression => SyntaxExpressionSingle SyntaxExpressionMoreSingle
Parse_SyntaxExpressionSingle(ctx);
Parse_SyntaxExpressionMoreSingle(ctx);
}
else
{
throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
}
}
开发者ID:thradams,项目名称:tklgen,代码行数:17,代码来源:Sample1Parser.cpp
示例17: switch
QVariant Parser::fromFile(const QString &fileName, FileFormat format) {
switch (format) {
case FileFormat::BCON:
case FileFormat::BSON:
case FileFormat::JSON: {
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
throw IOException(file.errorString());
}
DataStream stream(&file);
return Parser(stream, format).parse();
}
case FileFormat::IDL:
return idlparser::Driver::parse(fileName);
}
throw ParserException();
}
开发者ID:mbedsys,项目名称:NodeBus,代码行数:17,代码来源:parser.cpp
示例18: ConstListNode
sptr<Node> Parser::ParseConstList()
{
sptr<Node> list;
if (Match(INTEGER, REAL, STRING, IDENT, -1))
{
list = sptr<ConstListNode>
(new ConstListNode(sptr<ConstNode>(new ConstNode(currToken)), "Const List"));
NextToken();
}
else throw ParserException(GetPos() + "unexpected symbol, expected constant");
while (MatchSkip(COMMA, -1))
{
list->PushChild(sptr<ConstNode>(new ConstNode(currToken)));
NextToken();
}
return list;
}
开发者ID:Arkm4n,项目名称:Syntaxer,代码行数:17,代码来源:Parser.cpp
示例19: wordExtractor
CommandBase* ParserUndo::tryParse(string userCommand) {
// Extract single keyword, while eliminating leading and trailing spaces
stringstream wordExtractor(userCommand);
string command;
wordExtractor >> command;
if (!boost::iequals(command, undoKeyword)) {
return NULL;
}
wordExtractor >> ws;
if (!wordExtractor.eof()) {
throw (ParserException(ERROR_FORMAT_BAD));
}
return new CommandUndo(CommandUndo::UNDO_ACTION);
}
开发者ID:sudarsangp,项目名称:todomanager,代码行数:17,代码来源:ParserUndo.cpp
示例20: ParserException
// Key
void Scanner::ScanKey() {
// handle keys diffently in the block context (and manage indents)
if (InBlockContext()) {
if (!m_simpleKeyAllowed)
throw ParserException(INPUT.mark(), ErrorMsg::MAP_KEY);
PushIndentTo(INPUT.column(), IndentMarker::MAP);
}
// can only put a simple key here if we're in block context
m_simpleKeyAllowed = InBlockContext();
// eat
Mark mark = INPUT.mark();
INPUT.eat(1);
m_tokens.push(Token(Token::KEY, mark));
}
开发者ID:alisw,项目名称:rivet,代码行数:18,代码来源:scantoken.cpp
注:本文中的ParserException函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论