From: <an...@us...> - 2008-07-18 13:14:59
|
Revision: 6827 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=6827&view=rev Author: anfarr Date: 2008-07-18 13:14:57 +0000 (Fri, 18 Jul 2008) Log Message: ----------- SFOS-922: Parsing for VARs Modified Paths: -------------- trunk/core/smartfrog/src/org/smartfrog/sfcore/languages/sf/DefaultParser.jj Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/languages/sf/DefaultParser.jj =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/languages/sf/DefaultParser.jj 2008-07-18 13:13:59 UTC (rev 6826) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/languages/sf/DefaultParser.jj 2008-07-18 13:14:57 UTC (rev 6827) @@ -14,7 +14,7 @@ import org.smartfrog.sfcore.languages.sf.sfreference.SFReference; import org.smartfrog.sfcore.languages.sf.sfreference.SFAssertReference; import org.smartfrog.sfcore.languages.sf.sfreference.SFTBDReference; - +import org.smartfrog.sfcore.languages.sf.constraints.FreeVar; import org.smartfrog.sfcore.languages.sf.IncludeHandler; import org.smartfrog.sfcore.reference.ReferencePart; @@ -43,7 +43,7 @@ public class DefaultParser { protected IncludeHandler includeHandler; - static int nextId = 0; + public static int nextId = 0; static final String appendOp = "org.smartfrog.sfcore.languages.sf.functions.Append"; static final String concatOp = "org.smartfrog.sfcore.languages.sf.functions.Concatenate"; @@ -276,7 +276,7 @@ | <FI: "FI"> | <SWITCH: "SWITCH"> | <ENDSWITCH: "ENDSWITCH"> - + | <VAR: "VAR"> } TOKEN : @@ -563,6 +563,21 @@ } +Object Var() : +{ + Object ran = null; + Object val = null; +} +{ + <VAR> + ( + (ran = ReferenceNoEOF() | ran = String()) + (val = String() | val = Number())? + {return new FreeVar(ran, val); } + | + {return new FreeVar(); } + ) +} @@ -932,6 +947,7 @@ <VECTOREND>) | <DATA> res = BaseReference() {((SFReference)res).setData(true);} | <TBD> {res = new SFTBDReference();} + | res=Var() ) { return res; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |