[Commit] nickle ChangeLog,1.88,1.89 gram.y,1.141,1.142

Keith Packard commit at keithp.com
Sat Oct 9 15:49:10 PDT 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv14710

Modified Files:
	ChangeLog gram.y 
Log Message:
2004-10-09  Keith Packard  <keithp at keithp.com>

	* gram.y:
	Permit multiple namespaces in import statements


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- ChangeLog	9 Oct 2004 22:38:28 -0000	1.88
+++ ChangeLog	9 Oct 2004 22:49:07 -0000	1.89
@@ -1,5 +1,10 @@
 2004-10-09  Keith Packard  <keithp at keithp.com>
 
+	* gram.y:
+	Permit multiple namespaces in import statements
+
+2004-10-09  Keith Packard  <keithp at keithp.com>
+
 	* value.c: (ShiftL), (ShiftR):
 	Optimize shifts of small ints by small ints
 

Index: gram.y
===================================================================
RCS file: /local/src/CVS/nickle/gram.y,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- gram.y	22 Sep 2004 16:51:31 -0000	1.141
+++ gram.y	9 Oct 2004 22:49:07 -0000	1.142
@@ -90,7 +90,7 @@
     FuncDecl	    funcDecl;
 }
 
-%type  <expr>	    fullname
+%type  <expr>	    fullname fullnames
 %type  <expr>	    opt_rawnames rawname rawnames rawnamespace
 %type  <atom>	    rawatom
 %type  <expr>	    block opt_func_body func_body func_right catches catch
@@ -382,6 +382,15 @@
 			LexNamespace = 0;
 		    }
 		;
+fullnames	: fullname
+		    {
+			$$ = $1;
+		    }
+		| fullname COMMA fullnames
+		    {
+			$$ = NewExprTree (COMMA, $1, $3);
+		    }
+		;
 namespace	: namespace NAMESPACENAME COLONCOLON
 		    { 
 			ExprPtr	    e;
@@ -604,27 +613,40 @@
 			CurrentNamespace = $2;
 			$$ = NewExprTree (NAMESPACE, NewExprAtom ($4, 0, False), $7);
 		    }
-		| opt_publish IMPORT ignorenl fullname SEMI attendnl
+		| opt_publish IMPORT ignorenl fullnames SEMI attendnl
 		    {
 			SymbolPtr	symbol;
-			ExprPtr		e;
+			ExprPtr		p, e, n;
 
-			e = $4;
-			if ($4->base.tag == COLONCOLON)
-			    e = e->tree.right;
-			symbol = e->atom.symbol;
-			if (!symbol)
-			{
-			    ParseError ("non-existant namespace %A", e->atom.atom);
-			    YYERROR;
-			}
-			else if (symbol->symbol.class != class_namespace)
+			p = $4;
+			for (p = $4; p; p = n)
 			{
-			    ParseError ("%A is not a namespace", e->atom.atom);
-			    YYERROR;
+			    if (p->base.tag == COMMA)
+			    {
+				e = p->tree.left;
+				n = p->tree.right;
+			    }
+			    else
+			    {
+				e = p;
+				n = 0;
+			    }
+			    if (e->base.tag == COLONCOLON)
+				e = e->tree.right;
+			    symbol = e->atom.symbol;
+			    if (!symbol)
+			    {
+				ParseError ("non-existant namespace %A", e->atom.atom);
+				YYERROR;
+			    }
+			    else if (symbol->symbol.class != class_namespace)
+			    {
+				ParseError ("%A is not a namespace", e->atom.atom);
+				YYERROR;
+			    }
+			    NamespaceImport (CurrentNamespace, 
+					     symbol->namespace.namespace, $1);
 			}
-			NamespaceImport (CurrentNamespace, 
-					 symbol->namespace.namespace, $1);
 			$$ = NewExprTree (IMPORT, $4, NewExprDecl (IMPORT,
 								   0, 
 								   class_undef,




More information about the Commit mailing list