예제 #1
0
파일: parser.cpp 프로젝트: Jenny-fa/beaker
// Parse a primary expression.
//
//    primary-expr -> literal | identifier | '(' expr ')'
//
//    literal -> integer-literal
//             | boolean-literal
//             | character-literal
//             | string-literal
Expr*
Parser::primary_expr()
{
  // identifier
  if (Token tok = match_if(identifier_tok))
    return on_id(tok);

  // boolean-literal
  if (Token tok = match_if(boolean_tok))
    return on_bool(tok);

  // integer-literal
  if (Token tok = match_if(integer_tok))
    return on_int(tok);

  // floating-point-literal
  if (Token tok = match_if(floating_tok))
    return on_float(tok);

  // character-literal
  if (Token tok = match_if(character_tok))
    return on_char(tok);

  // string-literal
  if (Token tok = match_if(string_tok))
    return on_str(tok);

  // NOTE NOTE NOTE
  // Lambda additions
  if (lookahead() == bslash_tok)
    return lambda_expr();

  // paren-expr
  if (match_if(lparen_tok)) {
    Expr* e = expr();
    match(rparen_tok);
    return e;
  }

  // FIXME: Is this definitely an error? Or can we
  // actually return nullptr and continue?
  error("expected primary expression");
}
예제 #2
-1
파일: sqlite.cpp 프로젝트: liveralmask/ease
 virtual void on_start(){
   ease_assert( m_db.create(), "%d => %s", m_db.code(), m_db.msg().p() );
   
   on_bool();
   on_int8();
   on_uint8();
   on_int16();
   on_uint16();
   on_int32();
   on_uint32();
   on_int64();
   on_uint64();
   on_float();
   on_double();
   on_string();
   
   on_rollback();
   on_commit();
 }