frontend/frontend.cpp
// parse either a block, or a single statement
parse either a block, or a single statement
parse either a block or a single statement
Block *parseBlockOrStmt(Parser &in) {
  Loc lbegin = in.getCurrentLoc();
  if (in.parseOptionalOpenCurly()) {
    vector<Stmt *> stmts;
    while (!in.parseOptionalCloseCurly()) {
      stmts.push_back(parseStmt(in));
      in.parseSemicolon();
    }
    return new Block(Span(lbegin, in.getCurrentLoc()), stmts);
  } else {
    vector<Stmt *> stmts = {parseStmt(in)};
    in.parseSemicolon();
    return new Block(Span(lbegin, in.getCurrentLoc()), stmts);
  }
}
Block * parseBlockOrStmt ( Parser & in ) { Loc lbegin = in . getCurrentLoc ( ) ; if ( in . parseOptionalOpenCurly ( ) ) { vector < Stmt * > stmts ; while ( ! in . parseOptionalCloseCurly ( ) ) { stmts . push_back ( parseStmt ( in ) ) ; in . parseSemicolon ( ) ; } return new Block ( Span ( lbegin , in . getCurrentLoc ( ) ) , stmts ) ; } else { vector < Stmt * > stmts = { parseStmt ( in ) } ; in . parseSemicolon ( ) ; return new Block ( Span ( lbegin , in . getCurrentLoc ( ) ) , stmts ) ; } }
parse either a block, or a single statement
parse either a block or a single statement