From 6a3a36e63c18501aa5a37c6af49f419beaa82759 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 13 Jul 2006 21:06:56 -0400 Subject: [PATCH 1/1] checkpoint darcs-hash:20060714010656-5007d-4e5f9865089c6f559dbb936b6b2fbf416a010005.gz --- src/edu/berkeley/sbp/Tree.java | 12 +++++++++++- src/edu/berkeley/sbp/meta/MetaGrammar.java | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/edu/berkeley/sbp/Tree.java b/src/edu/berkeley/sbp/Tree.java index 086a9bb..8e3020d 100644 --- a/src/edu/berkeley/sbp/Tree.java +++ b/src/edu/berkeley/sbp/Tree.java @@ -1,7 +1,7 @@ package edu.berkeley.sbp; import edu.berkeley.sbp.*; -import edu.berkeley.sbp.*; import edu.berkeley.sbp.util.*; +import edu.berkeley.sbp.bind.*; import java.io.*; import java.util.*; import java.lang.reflect.*; @@ -84,4 +84,14 @@ public class Tree } } + public static class BindingFunctor implements TreeFunctor/*, ToJava*/ { + private Binding _binding; + public BindingFunctor(Binding binding) { + this._binding = binding; + } + public Object invoke(Iterable> t) { + return _binding.invoke(new Object[] { t }); + } + } + } diff --git a/src/edu/berkeley/sbp/meta/MetaGrammar.java b/src/edu/berkeley/sbp/meta/MetaGrammar.java index 91fd42f..32cac8a 100644 --- a/src/edu/berkeley/sbp/meta/MetaGrammar.java +++ b/src/edu/berkeley/sbp/meta/MetaGrammar.java @@ -135,6 +135,10 @@ public class MetaGrammar { p.drops); } + if (isRaw()) + return Sequence.rewritingSequence(new Tree.BindingFunctor(_bindable.createBinding()), + p.elements, + p.drops); return Sequence.rewritingSequence(new TreeBindableReducer(buildSequence(p), _bindable, isRaw()), -- 1.7.10.4