- public static <T> Forest<T> create(Input.Region loc, T tag, Forest<T>[] tokens, boolean unwrap) {
- return new Body<T>(loc, tag, tokens, unwrap);
+ /** returns the input Region which this Forest was parsed from */
+ public abstract Input.Region getRegion();
+
+ // Package-Private //////////////////////////////////////////////////////////////////////////////
+
+ public static <NodeType> Forest<NodeType> create(Input.Region region, NodeType head, Forest<NodeType>[] children) {
+ return create(region, head, children, new boolean[children==null ? 0 : children.length]); }
+ public static <NodeType> Forest<NodeType> create(Input.Region region, NodeType head, Forest<NodeType>[] children, boolean[] lifts) {
+ if (region == null) throw new RuntimeException("invoked Forest.create(region=null) -- this should never happen");
+ return new One<NodeType>(region, head, children, lifts);