import parse-define.patch
[nedit-bw.git] / macroSemicolons.diff
blobb8c136c91f15c31c7a7fac84e9f54dfc49fdfa45
1 [INACTIVE] Optional semicolons for statement termination
3 Derived from N8 Gray's patch:
5 http://sourceforge.net/tracker/?func=detail&atid=311005&aid=1185506&group_id=11005
6 [ 1185506 ] Optional semicolons for statement termination
8 The Enhancements to NEdit macro parsing patch includes this change.
10 ---
12 source/parse.y | 14 +++++++++-----
13 1 file changed, 9 insertions(+), 5 deletions(-)
15 diff --quilt old/source/parse.y new/source/parse.y
16 --- old/source/parse.y
17 +++ new/source/parse.y
18 @@ -98,10 +98,11 @@ static int nextSymIsField = 0;
19 %type <sym> evalsym
21 %nonassoc IF_NO_ELSE
22 %nonassoc ELSE
24 +%nonassoc ';'
25 %nonassoc SYMBOL ARG_LOOKUP
26 %right '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ
27 %left CONCAT
28 %left OR
29 %left AND
30 @@ -175,11 +176,14 @@ define: DEFINE {
32 $4->type = MACRO_FUNCTION_SYM;
33 $4->value.val.prog = prog;
36 -stmt: simpstmt '\n' blank
37 +stmtend: '\n' | ';'
38 + ;
39 +stmt: ';' blank
40 + | simpstmt stmtend blank
41 | IF '(' cond ')' blank block %prec IF_NO_ELSE {
42 SET_BR_OFF($3, GetPC());
44 | IF '(' cond ')' blank block else blank block %prec ELSE {
45 SET_BR_OFF($3, ($7+1)); SET_BR_OFF($7, GetPC());
46 @@ -201,26 +205,26 @@ stmt: simpstmt '\n' blank
47 blank block {
48 ADD_OP(OP_BRANCH); ADD_BR_OFF($5+2);
49 SET_BR_OFF($5+5, GetPC());
50 FillLoopAddrs(GetPC(), $5+2);
52 - | BREAK '\n' blank {
53 + | BREAK stmtend blank {
54 ADD_OP(OP_BRANCH); ADD_BR_OFF(0);
55 if (AddBreakAddr(GetPC()-1)) {
56 yyerror("break outside loop"); YYERROR;
59 - | CONTINUE '\n' blank {
60 + | CONTINUE stmtend blank {
61 ADD_OP(OP_BRANCH); ADD_BR_OFF(0);
62 if (AddContinueAddr(GetPC()-1)) {
63 yyerror("continue outside loop"); YYERROR;
66 - | RETURN expr '\n' blank {
67 + | RETURN expr stmtend blank {
68 ADD_OP(OP_RETURN);
70 - | RETURN '\n' blank {
71 + | RETURN stmtend blank {
72 ADD_OP(OP_RETURN_NO_VAL);
75 simpstmt: SYMBOL '=' expr {
76 ADD_OP(OP_ASSIGN); ADD_SYM($1);