[Nickle] nickle: Branch 'master'

Keith Packard keithp at keithp.com
Sun Nov 25 21:14:56 PST 2007


 gram.y |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 96c5c70c8226c3f60419fa2eee981d259efb07f2
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Nov 25 21:13:25 2007 -0800

    Allow . in struct initializers.
    
    C places a '.' before the structure member name in initializers, which
    would eliminate a shift/reduce conflict in the grammar. Nickle has not
    allowed the dot in the past, so instead of requiring it, we'll just make it
    optional, which doesn't eliminate the conflict, but at least works.

diff --git a/gram.y b/gram.y
index 7c2e559..0f2970a 100644
--- a/gram.y
+++ b/gram.y
@@ -1594,8 +1594,11 @@ structelt	: NAME ASSIGN simpleexpr
 		    { $$ = NewExprTree (ASSIGN, NewExprAtom ($1, 0, False), $3); }
 		| NAME ASSIGN init
 		    { $$ = NewExprTree (ASSIGN, NewExprAtom ($1, 0, False), $3); }
+		| DOT NAME ASSIGN simpleexpr
+		    { $$ = NewExprTree (ASSIGN, NewExprAtom ($2, 0, False), $4); }
+		| DOT NAME ASSIGN init
+		    { $$ = NewExprTree (ASSIGN, NewExprAtom ($2, 0, False), $4); }
 		;
-
 init		: arrayinit
 		| structinit
 		| hashinit


More information about the Nickle mailing list