Пример #1
0
// Parse a prefix expr.
//
//    prefix-expr ::= if-expr | succ-epxr | pred-expr | iszero-expr
//                  | print-expr | typeof-expr
Tree*
parse_prefix_expr(Parser& p) {
  if (Tree* t = parse_if_expr(p))
    return t;
  if (Tree* t = parse_succ_expr(p))
    return t;
  if (Tree* t = parse_pred_expr(p))
    return t;
  if (Tree* t = parse_iszero_expr(p))
    return t;
  if (Tree* t = parse_print_expr(p))
    return t;
  if (Tree* t = parse_typeof_expr(p))
    return t;
  if (Tree* t = parse_ls(p))
    return t;
  if (Tree* t = parse_mkdir(p))
    return t;
  if (Tree* t = parse_rmdir(p))
    return t;
  if (Tree* t = parse_cd(p))
    return t;
  if (Tree* t = parse_mv(p))
    return t;
  return parse_postfix_expr(p);
}
Пример #2
0
// Parse a prefix expr.
//
//    prefix-expr ::= if-expr | succ-epxr | pred-expr | iszero-expr
//                    | not-expr | print-expr | typeof-expr
Tree*
parse_prefix_expr(Parser& p) {
  if (Tree* t = parse_if_expr(p))
    return t;
  if (Tree* t = parse_select_expr(p))
    return t;
  if (Tree* t = parse_succ_expr(p))
    return t;
  if (Tree* t = parse_pred_expr(p))
    return t;
  if (Tree* t = parse_iszero_expr(p))
    return t;
  if (Tree* t = parse_print_expr(p))
    return t;
  if (Tree* t = parse_typeof_expr(p))
    return t;
  if (Tree* t = parse_not_expr(p))
    return t;
  return parse_postfix_expr(p);
}