public static Sequence create(Element e) { return create(new Element[] { e }, 0); }
/** create a sequence which drops the result of all but one of its element */
- public static Sequence create(Element[] e, int idx) { return new Singleton(e, idx); }
-
- /** after matching the sequence, insert a constant into the output tree */
- public static Sequence newConstantSequence(Element[] e, Object o) { return new Constant(e, o); }
+ public static Sequence create(Element[] e, int which) { return new Singleton(e, which); }
+ /** create a sequence which always evaluates to a constant result */
+ public static Sequence create(Element[] e, Object result) { return new Constant(e, result); }
/**
- * after matching the sequence, create the specified output tree
- * @param tag the tag for the output tree
+ * create a sequence (general form)
+ * @param head the head of the output tree
* @param e the elements to match
- * @param drops only elements of <tt>e</tt> whose corresponding <tt>boolean</tt> in <tt>drops</tt>
+ * @param drop only elements of <tt>e</tt> whose corresponding <tt>boolean</tt> in <tt>drops</tt>
* is <i>false</i> will be included in the output tree
- * @param unwrap if true, all children of the last child (ie
- * grandchildren) are promoted to children of this node; this is very useful for matching repetitions
+ * @param foster if true, all children of the last child (ie
+ * grandchildren) are promoted to children of this
+ * node; this is very useful for matching repetitions
**/
- public static Sequence create(Object tag, Element[] e, boolean[] drops, boolean unwrap) {
- return unwrap
- ? new Unwrap(e, tag, drops)
- : new RewritingSequence(tag, e, drops);
+ public static Sequence create(Object head, Element[] e, boolean[] drop, boolean foster) {
+ return foster
+ ? new Unwrap(e, head, drop)
+ : new RewritingSequence(head, e, drop);
}
////////////////////////////////////////////////////////////////////////////////