/** * Statement = Let | Expr */ static ast* parseStatement (parserCtx* ctx) { if (see(ctx, "let")) return parseLet(ctx); else return parseExpr(ctx); }
static boolean parseVimLine (const unsigned char *line, int infunction) { boolean readNextLine = TRUE; if (wordMatchLen (line, "command", 3)) { readNextLine = parseCommand(line); /* TODO - Handle parseCommand returning FALSE */ } else if (isMap(line)) { parseMap(skipWord(line)); } else if (wordMatchLen (line, "function", 2)) { parseFunction(skipWord(line)); } else if (wordMatchLen (line, "augroup", 3)) { parseAutogroup(skipWord(line)); } else if (wordMatchLen (line, "let", 3)) { parseLet(skipWord(line), infunction); } return readNextLine; }
static boolean parseVimLine (const unsigned char *line) { boolean readNextLine = TRUE; if ( (!strncmp ((const char*) line, "comp", (size_t) 4) == 0) && (!strncmp ((const char*) line, "comc", (size_t) 4) == 0) && (strncmp ((const char*) line, "com", (size_t) 3) == 0) ) { readNextLine = parseCommand(line); /* TODO - Handle parseCommand returning FALSE */ } if (isMap(line)) { parseMap(line); } if (strncmp ((const char*) line, "fu", (size_t) 2) == 0) { parseFunction(line); } if (strncmp ((const char*) line, "aug", (size_t) 3) == 0) { parseAutogroup(line); } if ( strncmp ((const char*) line, "let", (size_t) 3) == 0 ) { parseLet(line); } return readNextLine; }
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; } }