From d5e7191c75eb2479930d8ee6790772c71de32edb Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 16 Jun 2019 09:20:30 +1000 Subject: [PATCH] ident_test: declare precedence for 'else' By declaring precedence for 'else', we suppress conflict warnings Normally newlines and indents will resolve any conflict, but if not, else associates to the right - it should be shifted, not cause a reduce (which is the default anyway) Signed-off-by: NeilBrown --- csrc/indent_test.mdc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/csrc/indent_test.mdc b/csrc/indent_test.mdc index d8e945e..983d223 100644 --- a/csrc/indent_test.mdc +++ b/csrc/indent_test.mdc @@ -187,12 +187,14 @@ $*statement | IfStatement ${ $0 = $<1; }$ | Statement NEWLINE ${ $0 = $<1; }$ - IfStatement -> if Expression Block OptNL ${ + $RIGHT else + + IfStatement -> if Expression Block OptNL $$else ${ $0 = calloc(1, sizeof(struct statement)); $0->expr = $<2; $0->thenpart = $<3; }$ - | if Expression : SimpleStatements ${ + | if Expression : SimpleStatements $$else ${ $0 = calloc(1, sizeof(struct statement)); $0->expr = $<2; $0->thenpart = $<4; -- 2.43.0