From 323cd27db5fd8eb65d3a6a2e71198812116ee8eb Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 27 Oct 2018 08:59:55 +0200 Subject: [PATCH 1/2] submodules: remove bison We use the releases of Bison. --- .gitmodules | 3 --- bison | 1 - 2 files changed, 4 deletions(-) delete mode 160000 bison diff --git a/.gitmodules b/.gitmodules index 2a11ee2199..cf45e93730 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "bison"] - path = bison - url = ssh://git@git.aldebaran.lan/urbi-sdk/bison.git [submodule "fsm"] path = fsm url = ssh://git@git.aldebaran.lan/urbi-sdk/fsm.git diff --git a/bison b/bison deleted file mode 160000 index d4b2ae8ca5..0000000000 --- a/bison +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d4b2ae8ca5ed5ac24a7cf571395d328e5b7c48e6 From d143e898417468d6cedc3e67229627978fdfa515 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 27 Oct 2018 09:40:14 +0200 Subject: [PATCH 2/2] style: use %empty in the parser * src/parser/ugrammar.y: Use an explicit %empty rather than a comment. --- src/parser/ugrammar.y | 90 +++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/parser/ugrammar.y b/src/parser/ugrammar.y index c73a311d23..dbaa617c4b 100644 --- a/src/parser/ugrammar.y +++ b/src/parser/ugrammar.y @@ -365,9 +365,9 @@ stmts: // Optional composite statement: separated with "|" and "&", possibly // terminated by one "|". cstmt.opt: - /* empty */ { $$ = MAKE(noop, @$); } -| cstmt { std::swap($$, $1); } -| cstmt "|" { $$ = MAKE(bin, @$, $2, $1, MAKE(noop, @2)); } + %empty { $$ = MAKE(noop, @$); } +| cstmt { std::swap($$, $1); } +| cstmt "|" { $$ = MAKE(bin, @$, $2, $1, MAKE(noop, @2)); } ; // Composite statement: separated with "|" and "&". @@ -384,8 +384,8 @@ cstmt: // non-empty-statement: A statement that triggers a warning if empty. %type stmt.opt; stmt.opt: - /* empty */ %prec EMPTY { $$ = MAKE(noop, @$); } -| stmt { std::swap($$, $1); } + %empty %prec EMPTY { $$ = MAKE(noop, @$); } +| stmt { std::swap($$, $1); } ; @@ -424,7 +424,7 @@ block: // A useless optional visibility. visibility: - /* empty */ + %empty | "private" | "protected" | "public" @@ -444,8 +444,8 @@ protos.1: // A list of parents to derive from. protos: - /* empty */ { $$ = 0; } -| ":" protos.1 { std::swap($$, $2); } + %empty { $$ = 0; } +| ":" protos.1 { std::swap($$, $2); } ; %token CLASS "class"; @@ -475,7 +475,7 @@ exp: %type id.0 id.1; id.0: - /* empty */ {} + %empty {} | id.1 comma.opt { std::swap($$, $1); } ; @@ -838,21 +838,21 @@ stmt: %type default.opt; default.opt: - /* empty */ %prec EMPTY { $$ = 0; } -| "default" ":" stmts { std::swap($$, $3); } + %empty %prec EMPTY { $$ = 0; } +| "default" ":" stmts { std::swap($$, $3); } ; %type else.opt; else.opt: - /* empty */ %prec EMPTY { $$ = 0; } -| "else" stmt { std::swap($$, $2); } + %empty %prec EMPTY { $$ = 0; } +| "else" stmt { std::swap($$, $2); } ; // An optional onleave clause. %type onleave.opt; onleave.opt: - /* empty */ %prec EMPTY { $$ = 0; } -| "onleave" stmt { std::swap($$, $2); } + %empty %prec EMPTY { $$ = 0; } +| "onleave" stmt { std::swap($$, $2); } ; /*--------. @@ -862,7 +862,7 @@ onleave.opt: %type cases; cases: - /* empty */ {} + %empty {} | cases case { std::swap($$, $1); $$ << $2; } ; @@ -888,7 +888,7 @@ match: | exp "if" exp { $$ = new ast::Match(@$, $1, $3); } match.opt: - /* empty */ { $$ = 0; } + %empty { $$ = 0; } | "(" match ")" { std::swap($$, $2); } %type catch; @@ -900,15 +900,15 @@ catch: // BEWARE: return the body of the clause, not a Catch AST node. %type catch.opt; catch.opt: - /* empty */ %prec EMPTY { $$ = 0; } -| "catch" block { $$ = $block; } + %empty %prec EMPTY { $$ = 0; } +| "catch" block { $$ = $block; } ; %type finally.opt; finally.opt: - /* empty */ %prec EMPTY { $$ = 0; } -| "finally" block { $$ = $2; } + %empty %prec EMPTY { $$ = 0; } +| "finally" block { $$ = $2; } ; stmt: @@ -1162,7 +1162,7 @@ dictionary: // %type tuple tuple.exps; tuple.exps: - /* empty */ { $$ = new ast::exps_type; } + %empty { $$ = new ast::exps_type; } | exps.1 "," { std::swap($$, $1); } | exps.2 { std::swap($$, $1); } ; @@ -1182,12 +1182,12 @@ tuple: %type bitor-exps bitor-exps.1; bitor-exps: - /* */ { $$ = new ast::exps_type; } + %empty { $$ = new ast::exps_type; } | bitor-exps.1 comma.opt { std::swap($$, $1); } ; bitor-exps.1: - bitor-exp { $$ = new ast::exps_type(1, $1); } + bitor-exp { $$ = new ast::exps_type(1, $1); } | bitor-exps.1 "," bitor-exp { std::swap($$, $1); *$$ << $3;} ; @@ -1236,14 +1236,14 @@ event_match: %type guard.opt; guard.opt: - /* empty */ { $$ = 0; } -| "if" exp { std::swap($$, $2); } + %empty { $$ = 0; } +| "if" exp { std::swap($$, $2); } ; %type tilda.opt; tilda.opt: - /* empty */ { $$ = 0; } -| "~" exp { std::swap($$, $2); } + %empty { $$ = 0; } +| "~" exp { std::swap($$, $2); } ; @@ -1366,7 +1366,7 @@ rel-exp: %type rel-ops; rel-ops: - /* empty */ { /* empty */ } + %empty { /* empty */ } | rel-ops rel-op bitor-exp { std::swap($$, MAKE(relation, $1, $2, $3)); } ; @@ -1393,8 +1393,8 @@ exp: ; exp.opt: - /* empty */ %prec EMPTY { $$ = 0; } -| exp { std::swap($$, $1); } + %empty %prec EMPTY { $$ = 0; } +| exp { std::swap($$, $1); } ; @@ -1470,7 +1470,7 @@ primary-exp: // claims: a list of "exp"s separated/terminated with semicolons. claims: - /* empty */ { $$ = new ast::exps_type; } + %empty { $$ = new ast::exps_type; } | claims.1 semi.opt { std::swap($$, $1); } ; @@ -1482,7 +1482,7 @@ claims.1: // exps: a list of "exp"s separated/terminated with colons. exps: - /* empty */ { $$ = new ast::exps_type; } + %empty { $$ = new ast::exps_type; } | exps.1 comma.opt { std::swap($$, $1); } ; @@ -1501,8 +1501,8 @@ args: ; args.opt: - /* empty */ { $$ = 0; } -| args { std::swap($$, $1); } + %empty { $$ = 0; } +| args { std::swap($$, $1); } ; @@ -1512,7 +1512,7 @@ args.opt: %type identifiers; identifiers: - /* empty */ { /* empty */ } + %empty {} | identifiers "identifier" { std::swap($$, $1); $$.push_back($2); } ; @@ -1523,15 +1523,15 @@ typespec: %type typespec.opt; typespec.opt: - /* empty */ { $$=0;} -| typespec { std::swap($$, $1);} + %empty { $$ = 0; } +| typespec { std::swap($$, $1); } ; %type formal; formal: - var.opt "identifier" typespec.opt { $$ = ast::Formal($2, 0, $3); } + var.opt "identifier" typespec.opt { $$ = ast::Formal($2, 0, $3); } | var.opt "identifier" "=" exp typespec.opt { $$ = ast::Formal($2, $4, $5); } -| var.opt "identifier" "[" "]" { $$ = ast::Formal($2, true); } +| var.opt "identifier" "[" "]" { $$ = ast::Formal($2, true); } ; // One or several comma-separated identifiers. @@ -1543,19 +1543,19 @@ formals.1: // Zero or several comma-separated identifiers. formals.0: - /* empty */ { $$ = new ast::Formals; } + %empty { $$ = new ast::Formals; } | formals.1 comma.opt { std::swap($$, $1); } ; // Function formal arguments. formals: - /* empty */ { $$ = 0; } + %empty { $$ = 0; } | "(" formals.0 ")" { std::swap($$, $2); } ; -comma.opt: /* empty */ | ","; -semi.opt: /* empty */ | ";"; -var.opt: /* empty */ | "var"; +comma.opt: %empty | ","; +semi.opt: %empty | ";"; +var.opt: %empty | "var"; %%