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.
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 @@ -99,10 +99,11 @@ static int nextSymIsField = 0;
26 %nonassoc SYMBOL ARG_LOOKUP
27 %right '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ
31 @@ -185,11 +186,14 @@ define: DEFINE {
32 $4->type = MACRO_FUNCTION_SYM;
33 $4->value.tag = NO_TAG;
34 $4->value.val.prog = prog;
37 -stmt: simpstmt '\n' blank
41 + | simpstmt stmtend blank
42 | IF '(' cond ')' blank block %prec IF_NO_ELSE {
43 SET_BR_OFF($3, GetPC());
45 | IF '(' cond ')' blank block else blank block %prec ELSE {
46 SET_BR_OFF($3, ($7+1)); SET_BR_OFF($7, GetPC());
47 @@ -211,26 +215,26 @@ stmt: simpstmt '\n' blank
49 ADD_OP(OP_BRANCH); ADD_BR_OFF($5+2);
50 SET_BR_OFF($5+5, GetPC());
51 FillLoopAddrs(GetPC(), $5+2);
53 - | BREAK '\n' blank {
54 + | BREAK stmtend blank {
55 ADD_OP(OP_BRANCH); ADD_BR_OFF(0);
56 if (AddBreakAddr(GetPC()-1)) {
57 yyerror("break outside loop"); YYERROR;
60 - | CONTINUE '\n' blank {
61 + | CONTINUE stmtend blank {
62 ADD_OP(OP_BRANCH); ADD_BR_OFF(0);
63 if (AddContinueAddr(GetPC()-1)) {
64 yyerror("continue outside loop"); YYERROR;
67 - | RETURN expr '\n' blank {
68 + | RETURN expr stmtend blank {
71 - | RETURN '\n' blank {
72 + | RETURN stmtend blank {
73 ADD_OP(OP_RETURN_NO_VAL);
76 simpstmt: SYMBOL '=' expr {
77 ADD_OP(OP_ASSIGN); ADD_SYM($1);