Skip to content

Commit

Permalink
🎨 Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Mar 10, 2024
1 parent f5b426b commit a6e7b8a
Show file tree
Hide file tree
Showing 9 changed files with 1,668 additions and 1,844 deletions.
14 changes: 6 additions & 8 deletions include/absyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ enum fbflag {
fbflag_locale = 1 << 8,
} __attribute__((packed));

struct ParserArg {
union {
Arg arg;
Arg_List args;
};
enum fbflag flag;
};

/** a dot expression. @code object.member @endcode */
typedef struct {
Exp* base;
Expand Down Expand Up @@ -270,6 +262,11 @@ typedef struct Tmpl_ {
ANN ANEW AST_NEW(Tmpl *, tmpl, const Specialized_List);
ANN ANEW AST_NEW(Tmpl *, tmpl_call, TmplArg_List);
ANN void free_tmpl(MemPool p, Tmpl *);
ANN static inline bool is_spread_tmpl(const Tmpl *tmpl) {
const Specialized *spec = mp_vector_at(tmpl->list, Specialized, tmpl->list->len - 1);
return !strcmp(s_name(spec->tag.sym), "...");
}


static inline bool tmpl_base(const Tmpl *a) {
if (a && !a->call) return true;
Expand Down Expand Up @@ -453,6 +450,7 @@ ANEW ANN2(1,2,3) AST_NEW(Exp*, exp_unary2, const Symbol, Type_Decl *,
Exp* exp, const loc_t);
ANEW ANN AST_NEW(Exp*, exp_unary3, const Symbol, const Stmt_List,
const loc_t);
ANN void free_stmt_list(MemPool, Stmt_List);
ANEW ANN AST_NEW(Exp*, exp_td, Type_Decl *, const loc_t);

static inline Exp* take_exp(Exp* exp, const uint32_t n) {
Expand Down
3 changes: 1 addition & 2 deletions include/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ union YYSTYPE
Arg_List arg_list;
Capture capture;
Capture_List captures;
struct ParserArg default_args;
Arg arg;
Func_Def func_def;
EnumValue enum_value;
Expand All @@ -367,7 +366,7 @@ union YYSTYPE
Prim_Def prim_def;
Ast ast;

#line 371 "include/parser.h"
#line 370 "include/parser.h"

};
typedef union YYSTYPE YYSTYPE;
Expand Down
3 changes: 1 addition & 2 deletions include/scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ typedef struct Scanner_ {
struct pos_t old;
short int interp_state;
short int spread_state;
bool error;
bool handling;
// bool error;
bool locale; // handle \n in the lexer
} Scanner;

Expand Down
2 changes: 1 addition & 1 deletion pass/xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ ANN static void xxx_stmt_for(XXX *a, Stmt_For b) {
}

ANN static void xxx_stmt_each(XXX *a, Stmt_Each b) {
xxx_tag(a, &b->tag);
xxx_var_decl(a, &b->var);
xxx_exp(a, b->exp);
xxx_stmt(a, b->body);
}
Expand Down
1 change: 1 addition & 0 deletions src/gwion.l
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ static bool is_macro(void* data, const m_str s, YY_BUFFER_STATE handle, bool *in
gwpp_stack(scan, handle, e->base, str, pptype_arg);
scan->pos = e->pos;
yy_scan_string(e->text->str, data);
*in_macro = true;
return true;
}
}
Expand Down
Loading

0 comments on commit a6e7b8a

Please sign in to comment.