本文整理汇总了C++中parseBlock函数的典型用法代码示例。如果您正苦于以下问题:C++ parseBlock函数的具体用法?C++ parseBlock怎么用?C++ parseBlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseBlock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parseSwitch
static void parseSwitch (tokenInfo *const token)
{
/*
* switch (expression) {
* case value1:
* statement;
* break;
* case value2:
* statement;
* break;
* default : statement;
* }
*/
readToken (token);
if (isType (token, TOKEN_OPEN_PAREN))
{
/*
* Handle nameless functions, these will only
* be considered methods.
*/
skipArgumentList(token, FALSE, NULL);
}
if (isType (token, TOKEN_OPEN_CURLY))
{
parseBlock (token, token);
}
}
开发者ID:shunlir,项目名称:ctags,代码行数:30,代码来源:jscript.c
示例2: nextToken
void UnwrappedLineParser::parseObjCInterfaceOrImplementation() {
nextToken();
nextToken(); // interface name
// @interface can be followed by either a base class, or a category.
if (FormatTok->Tok.is(tok::colon)) {
nextToken();
nextToken(); // base class name
} else if (FormatTok->Tok.is(tok::l_paren))
// Skip category, if present.
parseParens();
if (FormatTok->Tok.is(tok::less))
parseObjCProtocolList();
// If instance variables are present, keep the '{' on the first line too.
if (FormatTok->Tok.is(tok::l_brace))
parseBlock(/*MustBeDeclaration=*/true);
// With instance variables, this puts '}' on its own line. Without instance
// variables, this ends the @interface line.
addUnwrappedLine();
parseObjCUntilAtEnd();
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_clang,代码行数:25,代码来源:UnwrappedLineParser.cpp
示例3: parseStatement
static PSmmAstNode parseStatement(PSmmParser parser) {
switch (parser->curToken->kind) {
case tkSmmReturn:
return parseReturnStmt(parser);
case '{':
return (PSmmAstNode)parseBlock(parser, parser->curScope->returnType, false);
case tkSmmIdent: case '(': case '-': case '+': case tkSmmNot:
case tkSmmInt: case tkSmmFloat: case tkSmmBool:
return parseExpressionStmt(parser);
case tkSmmIf: case tkSmmWhile: return parseIfWhileStmt(parser);
case tkSmmErr:
if (findToken(parser, ';')) getNextToken(parser);
return NULL;
case ';':
return NULL; // Just skip empty statements
default:
if (parser->lastErrorLine != parser->curToken->filePos.lineNumber) {
char gotBuf[4];
const char* got = smmTokenToString(parser->curToken, gotBuf);
smmPostMessage(parser->msgs, errSmmGotUnexpectedToken, parser->curToken->filePos, "valid statement", got);
}
getNextToken(parser); // Skip the bad character
if (findToken(parser, ';')) getNextToken(parser);
return &errorNode;
}
}
开发者ID:igor84,项目名称:summus,代码行数:26,代码来源:smmparser.c
示例4: parseSwitch
static void parseSwitch (tokenInfo *const token)
{
/*
* switch (expression) {
* case value1:
* statement;
* break;
* case value2:
* statement;
* break;
* default : statement;
* }
*/
readToken (token);
if (isType (token, TOKEN_OPEN_PAREN))
{
skipArgumentList(token, FALSE, NULL);
}
if (isType (token, TOKEN_OPEN_CURLY))
{
parseBlock (token, token);
}
}
开发者ID:amosbird,项目名称:ctags,代码行数:26,代码来源:jscript.c
示例5: parseFor
ExpPtr parseFor (Lexer& lex)
{
Span spStart, spEnd;
ExpPtr val1, val2, body;
spStart = lex.eat(tFor).span;
auto var = lex.eat(tIdent).str;
lex.eat(tColon);
val1 = parseExp(lex);
if (lex.current() == tArrow)
{
lex.advance();
val2 = parseExp(lex);
}
else
val2 = nullptr;
body = parseBlock(lex);
spEnd = body->span;
if (val2 == nullptr)
return Exp::make(eForEach, var,
{ val1, body }, spStart + spEnd);
else
return Exp::make(eForRange, var,
{ val1, val2, body }, spStart + spEnd);
}
开发者ID:iitalics,项目名称:Jupiter,代码行数:29,代码来源:Parser.cpp
示例6: findCmdTerm
static boolean findCmdTerm (tokenInfo *const token, boolean include_newlines,
boolean include_commas)
{
/*
* Read until we find either a semicolon or closing brace.
* Any nested braces will be handled within.
*/
while (! isType (token, TOKEN_SEMICOLON) &&
! isType (token, TOKEN_CLOSE_CURLY) &&
! (include_commas && isType (token, TOKEN_COMMA)) &&
! isType (token, TOKEN_EOF))
{
/* Handle nested blocks */
if ( isType (token, TOKEN_OPEN_CURLY))
{
parseBlock (token, token);
readTokenFull (token, include_newlines, NULL);
}
else if ( isType (token, TOKEN_OPEN_PAREN) )
{
skipArgumentList(token, include_newlines, NULL);
}
else if ( isType (token, TOKEN_OPEN_SQUARE) )
{
skipArrayList(token, include_newlines);
}
else
{
readTokenFull (token, include_newlines, NULL);
}
}
return isType (token, TOKEN_SEMICOLON);
}
开发者ID:amosbird,项目名称:ctags,代码行数:34,代码来源:jscript.c
示例7: match
void Parser::parseProgram()
{
if (it->tag == PROGRAM)
{
it++;
//根节点生成
shared_ptr<Node> beginNode = make_shared<Node>();
beginNode->value = *it;
root = beginNode;
currNode = root;
it++;
match(SEMI);
parseBlock();
}
else
{
//unexpected symbol error
Error err("unexpected symbol error", *it);
errList.push_back(err);
}
if (it->tag != FINISH)
{
//missing the finish symbol
Error err("missing the finish symbol", *it);
errList.push_back(err);
}
}
开发者ID:cocoyimasa,项目名称:compiler2014,代码行数:27,代码来源:parser.cpp
示例8: parseLambda
ExpPtr parseLambda (Lexer& lex)
{
Span spStart, spEnd;
SigPtr sig;
ExpPtr body;
spStart = lex.current().span;
if (lex.current() == tFunc)
{
lex.advance();
sig = parseSigParens(lex);
body = parseBlock(lex);
}
else
{
lex.eat(tLambda);
sig = parseSig(lex, true);
lex.eat(tArrow);
body = parseExp(lex);
}
spEnd = body->span;
return Exp::make(eLambda, sig->toSigType(), "", { body }, spStart + spEnd);
}
开发者ID:iitalics,项目名称:Jupiter,代码行数:25,代码来源:Parser.cpp
示例9: parseBlockExp
void parseBlockExp (Lexer& lex, ExpList& list)
{
switch (lex.current().tok)
{
case tSemicolon:
lex.advance();
break;
case tLet:
list.push_back(parseLet(lex));
lex.eat(tSemicolon);
break;
case tLCurl:
list.push_back(parseBlock(lex));
break;
case tIf:
list.push_back(parseCond(lex));
break;
case tLoop:
list.push_back(parseLoop(lex));
break;
case tFor:
list.push_back(parseFor(lex));
break;
// everthing else does
default:
list.push_back(parseAssign(lex, parseExp(lex)));
if (lex.current() != tSemicolon)
lex.expect(tRCurl);
else
lex.eat(tSemicolon);
break;
}
}
开发者ID:iitalics,项目名称:Jupiter,代码行数:34,代码来源:Parser.cpp
示例10: switch
bool UnwrappedLineParser::parseLevel() {
bool Error = false;
do {
switch (FormatTok.Tok.getKind()) {
case tok::hash:
parsePPDirective();
break;
case tok::comment:
nextToken();
addUnwrappedLine();
break;
case tok::l_brace:
Error |= parseBlock();
addUnwrappedLine();
break;
case tok::r_brace:
// Stray '}' is an error.
return true;
default:
parseStatement();
break;
}
} while (!eof());
return Error;
}
开发者ID:boostpro,项目名称:clang,代码行数:25,代码来源:UnwrappedLineParser.cpp
示例11: strlen
void GLECSVData::readBuffer(const char* buffer) {
unsigned int size = strlen(buffer);
m_buffer.resize(size + 1);
memcpy(&m_buffer[0], buffer, size);
m_buffer[size] = 0;
parseBlock();
}
开发者ID:pnkfelix,项目名称:glx-gle,代码行数:7,代码来源:glearray.cpp
示例12: switch
void UnwrappedLineParser::parseLevel(bool HasOpeningBrace) {
bool SwitchLabelEncountered = false;
do {
switch (FormatTok->Tok.getKind()) {
case tok::comment:
nextToken();
addUnwrappedLine();
break;
case tok::l_brace:
// FIXME: Add parameter whether this can happen - if this happens, we must
// be in a non-declaration context.
parseBlock(/*MustBeDeclaration=*/false);
addUnwrappedLine();
break;
case tok::r_brace:
if (HasOpeningBrace)
return;
StructuralError = true;
nextToken();
addUnwrappedLine();
break;
case tok::kw_default:
case tok::kw_case:
if (!SwitchLabelEncountered)
Line->Level += Style.IndentCaseLabels;
SwitchLabelEncountered = true;
parseStructuralElement();
break;
default:
parseStructuralElement();
break;
}
} while (!eof());
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_clang,代码行数:34,代码来源:UnwrappedLineParser.cpp
示例13: beforeUpdateNewLanguages
void NewLanguagesController::updateNewLanguages()
{
emit beforeUpdateNewLanguages();
// remove prev. new languages
clearAllNewLanguages();
// fill with new languages
parseBlock(copyBetween(newLanguagesFile, "#COMMON{", "}"));
}
开发者ID:JoeyPinilla,项目名称:xVideoServiceThief,代码行数:8,代码来源:newlanguages.cpp
示例14: expect
Node* Parser::parseWhileStmt()
{
expect(Token::TYPE::WHILE);
nextToken();
auto _condition = parseBinaryExpr();
auto _block = parseBlock();
return make_node<WhileStmtNode>(_condition, _block);
}
开发者ID:ChannelOne,项目名称:CalculatorParser,代码行数:8,代码来源:parser.cpp
示例15: parseImportDecl
ImportDecl parseImportDecl (Lexer& lex)
{
Span spStart, spEnd;
spStart = lex.eat(tImport).span;
auto nameTok = lex.eat(tIdent, tString);
auto name = nameTok.str;
spEnd = nameTok.span;
return ImportDecl
{
.isPublic = false,
.name = name,
.span = spStart + spEnd
};
}
FuncDecl parseFuncDecl (Lexer& lex)
{
Span spStart, spEnd;
spStart = lex.eat(tFunc).span;
auto name = lex.eat(tIdent).str;
auto sig = parseSigParens(lex);
ExpPtr body;
/* if (lex.current() == tEqual)
{
lex.advance();
body = parseExp(lex);
}
else */
body = parseBlock(lex);
spEnd = sig->span;
return FuncDecl
{
.isPublic = false,
.name = name,
.signature = sig,
.body = body,
.span = spStart + spEnd
};
}
static FuncDecl parseConstructor (Lexer& lex)
{
Span spStart, spEnd;
FuncDecl result;
result.name = lex.current().str;
spStart = lex.eat(tIdent).span;
result.signature = parseSigParens(lex);
spEnd = result.signature->span;
result.span = spStart + spEnd;
result.body = nullptr;
return result;
}
开发者ID:iitalics,项目名称:Jupiter,代码行数:58,代码来源:Parser.cpp
示例16: parseLongestChain
static void parseLongestChain()
{
Block *blk = gNullBlock->next;
start(blk, gMaxBlock);
while(likely(0!=blk)) {
parseBlock(blk);
blk = blk->next;
}
}
开发者ID:lionzeye,项目名称:rddblockparser,代码行数:10,代码来源:parser.cpp
示例17: while
void TGen::PropertyTreeParser::parseBlock(TGen::PropertyTree & node) {
std::vector<std::string> line; // stack
while (currentToken != endIter) {
// std::cout << "loop '" << currentToken->second << "'" << std::endl;
if (currentToken->first == TGen::PropertyTokenBlockStart) {
step();
TGen::PropertyTree newNode(line.at(0));
// std::cout << "parsing block " << line.at(0) << std::endl;
for (int i = 1; i < line.size(); ++i)
newNode.addAttribute(line[i]);
line.clear();
parseBlock(newNode);
node.addNode(newNode);
}
else if (currentToken->first == TGen::PropertyTokenBlockEnd) {
if (!line.empty()) {
addLine(line, node);
line.clear();
}
step();
// std::cout << "leaving block" << std::endl;
break;
}
else if (currentToken->first == PropertyTokenNodeEnd) {
TGen::PropertyTree newNode(line.at(0));
for (int i = 1; i < line.size(); ++i)
newNode.addAttribute(line[i]);
line.clear();
node.addNode(newNode);
}
else if (currentToken->first == TGen::PropertyTokenEOL) {
if (!line.empty()) {
// std::cout << "finishing line " << line.size() << std::endl;
addLine(line, node);
line.clear();
}
}
else {
line.push_back(currentToken->second);
//std::cout << "adding param " << currentToken->second << std::endl;
}
if (currentToken != endIter)
step();
}
if (!line.empty())
addLine(line, node);
}
开发者ID:peteb,项目名称:TGen,代码行数:55,代码来源:propertytreeparser.cpp
示例18: parseLongestChain
static void parseLongestChain() {
info(
"pass 4 -- full blockchain analysis (with%s index)...",
gNeedUpstream ? "" : "out"
);
auto startTime = Timer::usecs();
gCallback->startLC();
uint64_t bytesSoFar = 0;
auto blk = gNullBlock->next;
start(blk, gMaxBlock);
while(likely(0!=blk)) {
if(0==(blk->height % 10)) {
auto now = Timer::usecs();
static auto last = -1.0;
auto elapsedSinceLastTime = now - last;
auto elapsedSinceStart = now - startTime;
auto progress = bytesSoFar/(double)gChainSize;
auto bytesPerSec = bytesSoFar / (elapsedSinceStart*1e-6);
auto bytesLeft = gChainSize - bytesSoFar;
auto secsLeft = bytesLeft / bytesPerSec;
if((1.0 * 1000 * 1000)<elapsedSinceLastTime) {
fprintf(
stderr,
"block %6d/%6d, %.2f%% done, ETA = %.2fsecs, mem = %.3f Gig \r",
(int)blk->height,
(int)gMaxHeight,
progress*100.0,
secsLeft,
getMem()
);
fflush(stderr);
last = now;
}
}
if(parseBlock(blk)) {
break;
}
bytesSoFar += blk->chunk->getSize();
blk = blk->next;
}
fprintf(stderr, " \r");
gCallback->wrapup();
info("pass 4 -- done.");
}
开发者ID:martexcoin,项目名称:blockparser,代码行数:54,代码来源:parser.cpp
示例19: findRustTags
static void findRustTags (void)
{
lexerState lexer;
vString* scope = vStringNew();
initLexer(&lexer);
parseBlock(&lexer, FALSE, K_NONE, scope);
vStringDelete(scope);
deInitLexer(&lexer);
}
开发者ID:relaxdiego,项目名称:ctags,代码行数:11,代码来源:rust.c
示例20: assert
void UnwrappedLineParser::parseNamespace() {
assert(FormatTok.Tok.is(tok::kw_namespace) && "'namespace' expected");
nextToken();
if (FormatTok.Tok.is(tok::identifier))
nextToken();
if (FormatTok.Tok.is(tok::l_brace)) {
parseBlock(0);
addUnwrappedLine();
}
// FIXME: Add error handling.
}
开发者ID:boostpro,项目名称:clang,代码行数:11,代码来源:UnwrappedLineParser.cpp
注:本文中的parseBlock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论