break/continue to outer loops, !!booleanize
[nedit-bw.git] / macroSemicolons.diff
blob06ed6d9bd2f8f15c3b65bbd038f328d3e9891867
1 From: Tony Balinski <ajbj@free.fr>
2 Subject: Optional semicolons for statement termination
4 Derived from N8 Gray's patch:
6 http://sourceforge.net/tracker/?func=detail&atid=311005&aid=1185506&group_id=11005
7 [ 1185506 ] Optional semicolons for statement termination
9 The Enhancements to NEdit macro parsing patch includes this change.
11 ---
13 source/parse.y | 14 +++++++++-----
14 1 file changed, 9 insertions(+), 5 deletions(-)
16 diff --quilt old/source/parse.y new/source/parse.y
17 --- old/source/parse.y
18 +++ new/source/parse.y
19 @@ -104,6 +104,7 @@ static int nextSymIsField = 0;
20 %nonassoc IF_NO_ELSE
21 %nonassoc ELSE
23 +%nonassoc ';'
24 %nonassoc SYMBOL ARG_LOOKUP
25 %right '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ
26 %left CONCAT
27 @@ -191,7 +192,10 @@ define: definekw blank definesym bla
31 -stmt: simpstmt '\n' blank
32 +stmtend: '\n' | ';'
33 + ;
34 +stmt: ';' blank
35 + | simpstmt stmtend blank
36 | IF '(' cond ')' blank block %prec IF_NO_ELSE {
37 SET_BR_OFF($3, GetPC());
39 @@ -217,22 +221,22 @@ stmt: simpstmt '\n' blank
40 SET_BR_OFF($5+5, GetPC());
41 FillLoopAddrs(GetPC(), $5+2);
43 - | BREAK '\n' blank {
44 + | BREAK stmtend blank {
45 ADD_OP(OP_BRANCH); ADD_BR_OFF(0);
46 if (AddBreakAddr(GetPC()-1)) {
47 yyerror("break outside loop"); YYERROR;
50 - | CONTINUE '\n' blank {
51 + | CONTINUE stmtend blank {
52 ADD_OP(OP_BRANCH); ADD_BR_OFF(0);
53 if (AddContinueAddr(GetPC()-1)) {
54 yyerror("continue outside loop"); YYERROR;
57 - | RETURN expr '\n' blank {
58 + | RETURN expr stmtend blank {
59 ADD_OP(OP_RETURN);
61 - | RETURN '\n' blank {
62 + | RETURN stmtend blank {
63 ADD_OP(OP_RETURN_NO_VAL);