[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [gmt-dev] parsing array definition in xText grammar
|
I just checked it in.
thanks,
Sven
Michal Ceresna schrieb:
On Monday 17 July 2006 11:54, Sven Efftinge wrote:
It's a bug. (Thanks for finding it ;-))
In the meantime I think you could alternatively write:
Program:
ArrayLiteral ";"
SimpleExpression :
"true" | "false";
ArrayLiteral :
"[" ((elements+=SimpleExpression ",")* elements+=SimpleExpression)? "]";
Unfortunately, I had more of such rules and not all of them could be replaced
that way. So, here is the fix.
regards,
Michal
------------------------------------------------------------------------
Index: xtext.core/main/src/org/openarchitectureware/xtext/parser/EcoreModelFactory.java
===================================================================
RCS file: /cvsroot/architecturware/oaw_v4/xtext/xtext.core/main/src/org/openarchitectureware/xtext/parser/EcoreModelFactory.java,v
retrieving revision 1.3
diff -u -b -r1.3 EcoreModelFactory.java
--- xtext.core/main/src/org/openarchitectureware/xtext/parser/EcoreModelFactory.java 21 Jun 2006 18:44:16 -0000 1.3
+++ xtext.core/main/src/org/openarchitectureware/xtext/parser/EcoreModelFactory.java 18 Jul 2006 09:17:51 -0000
@@ -75,6 +75,14 @@
Object object = args[i];
if (object instanceof Token)
object = ((Token) object).getText();
+ if (object instanceof List) {
+ List larg = (List) object;
+ Iterator it = larg.iterator();
+ while (it.hasNext()) {
+ Object elem = it.next();
+ if (elem==null) it.remove();
+ }
+ }
ef = ef.cloneWithVariable(new Variable("arg" + (i + 1), object));
}
Object o = ef.evaluate(expr1);
------------------------------------------------------------------------
_______________________________________________
gmt-dev mailing list
gmt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gmt-dev
--
Sven Efftinge
Am Sophienhof 33
24941 Flensburg
mail : sven@xxxxxxxxxxx
fon : +49 176 21769757