On Tue, Jan 21, 2003 at 09:50:36AM +0100, Armand A. Verstappen wrote:

> working:
> 
> &(array.one); &(array[one]); &(object.one); &(object->one);
> 
> not working:
> 
> &(array.one.two); &(array[one][two]); &(object.one.two);
> &(object->one->two); &(array.object.one); &(array[object]->one);
> &(object.array.one); &(object->array[one]);
> 
> So, the newer syntax supports the same scope of variables the old syntax
> does.
> 
> I personally think it is a shame that neither syntax supports
> multi-dimensional variables, but that is a different issue.

Adding multi-dimension wouldn't be all that hard. The attached patch
(not even compiled, I'll leave it as an exercise for the reader how much
testing this has seen) should enable it.

Emile
Index: preparse.l
===================================================================
RCS file: /home/cvsmgd/midgard/lib/src/preparse.l,v
retrieving revision 1.19
diff -u -r1.19 preparse.l
--- preparse.l  17 May 2002 15:00:52 -0000      1.19
+++ preparse.l  21 Jan 2003 18:42:36 -0000
@@ -122,7 +122,9 @@
 MIDGARD_ARRINDEX ({MIDGARD_VARPART}|[0-9]+|{dqstring}|{qstring})
 MIDGARD_VARSPEC_ATTR ((("."|"->"){MIDGARD_VARPART})|("["{MIDGARD_ARRINDEX}"]"))
 MIDGARD_VARSPEC_FMT ":"{MIDGARD_FMTSPEC}
-MIDGARD_VARSPEC {MIDGARD_VARPART}{MIDGARD_VARSPEC_ATTR}?{MIDGARD_VARSPEC_FMT}?
+
+MIDGARD_FMTEXPR ([^()]*("("[^()]+")")*)
+MIDGARD_VARSPEC {MIDGARD_FMTEXPR}{MIDGARD_VARSPEC_FMT}?
 
 %%
 
@@ -160,13 +162,14 @@
 #if MIDGARD_PARSER_DEBUG
    mgd_parser_log_other(); fprintf(stderr, "MidgardParser: varformat &(%s);\n", 
mgdlibtext);
 #endif
-   if ((fmt = strchr(mgdlibtext, ':')) != NULL) {
+   if ((fmt = strrchr(mgdlibtext, ':')) != NULL) {
       *fmt = '\0';
       fmt++;
    } else {
       fmt = "";
    }
 
+#if KEEP_DOT_SYNTAX
    if ((attr = strchr(mgdlibtext, '.')) != NULL) {
       *attr = '\0';
       attr++;
@@ -202,7 +205,9 @@
       mgd_parser_output_const(" }");
 #endif
       mgd_parser_output_const(" ?>");
-   } else {
+   } else
+#endif
+   {
       mgd_parser_output_const("<?php ");
 
       mgd_fmt_start(fmt);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to