Java Code Examples for org.stringtemplate.v4.compiler.FormalArgument

The following examples show how to use org.stringtemplate.v4.compiler.FormalArgument. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 2
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 3
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName,
							 Token nameT,
                                   List<FormalArgument> args,
							 String template,
							 Token templateToken)
  {
if ( verbose ) System.out.println("defineTemplate("+fullyQualifiedTemplateName+")");
if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
	throw new IllegalArgumentException("empty template name");
}
if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
	throw new IllegalArgumentException("cannot have '.' in template names");
}
      template = Misc.trimOneStartingNewline(template);
      template = Misc.trimOneTrailingNewline(template);
// compile, passing in templateName as enclosing name for any embedded regions
      CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
      code.name = fullyQualifiedTemplateName;
      rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
code.defineArgDefaultValueTemplates(this);
      code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates

      return code;
  }
 
Example 4
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName,
                                 Token nameT,
                                 List<FormalArgument> args,
                                 String template, Token templateToken) {
    if ( verbose ) System.out.println("defineTemplate("+fullyQualifiedTemplateName+")");
    if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
        throw new IllegalArgumentException("empty template name");
    }
    if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
        throw new IllegalArgumentException("cannot have '.' in template names");
    }
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    // compile, passing in templateName as enclosing name for any embedded regions
    CompiledST code = compile(getFileName(),
                              fullyQualifiedTemplateName,
                              args,
                              template,
                              templateToken);
    code.name = fullyQualifiedTemplateName;
    rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
    return code;
}
 
Example 5
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 6
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void defineTemplateOrRegion(String fullyQualifiedTemplateName, String regionSurroundingTemplateName, Token templateToken, String template, Token nameToken, List<FormalArgument> args) {
    try {
        if ( regionSurroundingTemplateName!=null ) {
            defineRegion(regionSurroundingTemplateName,
                         nameToken,
                         template,
                         templateToken);
        }
        else {
            defineTemplate(fullyQualifiedTemplateName,
                           nameToken,
                           args,
                           template,
                           templateToken);
        }
    }
    catch (STException e) {
        // after getting syntax error in a template, we emit msg
        // and throw exception to blast all the way out to here.
    }
}
 
Example 7
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 8
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName, Token nameT, List<FormalArgument> args, String template, Token templateToken) {
        if ( verbose ) System.out.println("defineTemplate("+
fullyQualifiedTemplateName+")");
        if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
            throw new IllegalArgumentException("empty template name");
        }
        if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
            throw new IllegalArgumentException("cannot have '.' in template names");
        }
        template = Misc.trimOneStartingNewline(template);
        template = Misc.trimOneTrailingNewline(template);
        // compile, passing in templateName as enclosing name for any embedded regions
        CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
        code.name = fullyQualifiedTemplateName;
        rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
        code.defineArgDefaultValueTemplates(this);
        code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
        return code;
    }
 
Example 9
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 10
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName,
                                 Token nameT,
                                 List<FormalArgument> args,
                                 String template, Token templateToken) {
    if ( verbose ) System.out.println("defineTemplate("+fullyQualifiedTemplateName+")");
    if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
        throw new IllegalArgumentException("empty template name");
    }
    if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
        throw new IllegalArgumentException("cannot have '.' in template names");
    }
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    // compile, passing in templateName as enclosing name for any embedded regions
    CompiledST code = compile(getFileName(),
                              fullyQualifiedTemplateName,
                              args,
                              template,
                              templateToken);
    code.name = fullyQualifiedTemplateName;
    rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
    return code;
}
 
Example 11
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void defineTemplateOrRegion(String fullyQualifiedTemplateName, String regionSurroundingTemplateName, Token templateToken, String template, Token nameToken, List<FormalArgument> args) {
    try {
        if ( regionSurroundingTemplateName!=null ) {
            defineRegion(regionSurroundingTemplateName,
                         nameToken,
                         template,
                         templateToken);
        }
        else {
            defineTemplate(fullyQualifiedTemplateName,
                           nameToken,
                           args,
                           template,
                           templateToken);
        }
    }
    catch (STException e) {
        // after getting syntax error in a template, we emit msg
        // and throw exception to blast all the way out to here.
    }
}
 
Example 12
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 13
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName, Token nameT, List<FormalArgument> args, String template, Token templateToken) {
        if ( verbose ) System.out.println("defineTemplate(" +
fullyQualifiedTemplateName+")");
        if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
            throw new IllegalArgumentException("empty template name");
        }
        if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
            throw new IllegalArgumentException("cannot have '.' in template names");
        }
        template = Misc.trimOneStartingNewline(template);
        template = Misc.trimOneTrailingNewline(template);
        // compile, passing in templateName as enclosing name for any embedded regions
        CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
        code.name = fullyQualifiedTemplateName;
        rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
        code.defineArgDefaultValueTemplates(this);
        code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
        return code;
    }
 
Example 14
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName, Token nameT, List<FormalArgument> args, String template, Token templateToken) {
    if ( verbose ) System.out.println("defineTemplate("+fullyQualifiedTemplateName+")");
    if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
        throw new IllegalArgumentException("empty template name");
    }
    if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
        throw new IllegalArgumentException("cannot have '.' in template names");
    }
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    // compile, passing in templateName as enclosing name for any embedded regions
    CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
    code.name = fullyQualifiedTemplateName;
    rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
    return code;
}
 
Example 15
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 16
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName,
                                 Token nameT,
                                 List<FormalArgument> args,
                                 String template, Token templateToken) {
    if ( verbose ) System.out.println("defineTemplate("+fullyQualifiedTemplateName+")");
    if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
        throw new IllegalArgumentException("empty template name");
    }
    if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
        throw new IllegalArgumentException("cannot have '.' in template names");
    }
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    // compile, passing in templateName as enclosing name for any embedded regions
    CompiledST code = compile(getFileName(),
                              fullyQualifiedTemplateName,
                              args,
                              template,
                              templateToken);
    code.name = fullyQualifiedTemplateName;
    rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
    return code;
}
 
Example 17
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 18
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName, Token nameT, List<FormalArgument> args, String template, Token templateToken) {
        if ( verbose ) System.out.println("defineTemplate(" +
fullyQualifiedTemplateName+")");
        if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
            throw new IllegalArgumentException("empty template name");
        }
        if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
            throw new IllegalArgumentException("cannot have '.' in template names");
        }
        template = Misc.trimOneStartingNewline(template);
        template = Misc.trimOneTrailingNewline(template);
        // compile, passing in templateName as enclosing name for any embedded regions
        CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
        code.name = fullyQualifiedTemplateName;
        rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
        code.defineArgDefaultValueTemplates(this);
        code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
        return code;
    }
 
Example 19
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName, Token nameT, List<FormalArgument> args, String template, Token templateToken) {
        if ( verbose ) System.out.println("defineTemplate("+
fullyQualifiedTemplateName+")");
        if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
            throw new IllegalArgumentException("empty template name");
        }
        if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
            throw new IllegalArgumentException("cannot have '.' in template names");
        }
        template = Misc.trimOneStartingNewline(template);
        template = Misc.trimOneTrailingNewline(template);
        // compile, passing in templateName as enclosing name for any embedded regions
        CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
        code.name = fullyQualifiedTemplateName;
        rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
        code.defineArgDefaultValueTemplates(this);
        code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
        return code;
    }
 
Example 20
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompiledST defineTemplate(String fullyQualifiedTemplateName, Token nameT, List<FormalArgument> args, String template, Token templateToken) {
        if ( verbose ) System.out.println("defineTemplate(" +
fullyQualifiedTemplateName+")");
        if ( fullyQualifiedTemplateName==null || fullyQualifiedTemplateName.length()==0 ) {
            throw new IllegalArgumentException("empty template name");
        }
        if ( fullyQualifiedTemplateName.indexOf('.')>=0 ) {
            throw new IllegalArgumentException("cannot have '.' in template names");
        }
        template = Misc.trimOneStartingNewline(template);
        template = Misc.trimOneTrailingNewline(template);
        // compile, passing in templateName as enclosing name for any embedded regions
        CompiledST code = compile(getFileName(), fullyQualifiedTemplateName, args, template, templateToken);
        code.name = fullyQualifiedTemplateName;
        rawDefineTemplate(fullyQualifiedTemplateName, code, nameT);
        code.defineArgDefaultValueTemplates(this);
        code.defineImplicitlyDefinedTemplates(this); // define any anonymous subtemplates
        return code;
    }
 
Example 21
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void defineTemplateOrRegion(String fullyQualifiedTemplateName, String regionSurroundingTemplateName, Token templateToken, String template, Token nameToken, List<FormalArgument> args) {
    try {
        if ( regionSurroundingTemplateName!=null ) {
            defineRegion(regionSurroundingTemplateName,
                         nameToken,
                         template,
                         templateToken);
        }
        else {
            defineTemplate(fullyQualifiedTemplateName,
                           nameToken,
                           args,
                           template,
                           templateToken);
        }
    }
    catch (STException e) {
        // after getting syntax error in a template, we emit msg
        // and throw exception to blast all the way out to here.
    }
}
 
Example 22
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Remove an attribute value entirely (can't remove attribute definitions). */

    public void remove(String name) {
        if ( impl.formalArguments==null ) {
            if ( impl.hasFormalArgs ) {
                throw new IllegalArgumentException("no such attribute: "+name);
            }
            return;
        }

        FormalArgument arg = impl.formalArguments.get(name);
        if ( arg==null ) {
            throw new IllegalArgumentException("no such attribute: "+name);
        }
        locals[arg.index] = EMPTY_ATTR; // reset value
    }
 
Example 23
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** for testing */

    public CompiledST defineTemplate(String name, String argsS, String template) {
        if ( name.charAt(0) !='/' ) name = "/"+name;
        String[] args = argsS.split(",");
        List<FormalArgument> a = new ArrayList<FormalArgument>();
        for (String arg : args) {
            a.add(
                new FormalArgument(arg)
            );
        }
        return defineTemplate(name, new CommonToken(GroupParser.ID, name), a, template, null);
    }
 
Example 24
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Compile a template. */

    public CompiledST compile(String srcName,
                              String name,
                              List<FormalArgument> args,
                              String template,
                              Token templateToken) // for error location {
        //System.out.println("STGroup.compile: "+enclosingTemplateName);
        Compiler c = new Compiler(this);
        return c.compile(srcName, name, args, template, templateToken);
    }
 
Example 25
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** for testing */

    public CompiledST defineTemplate(String name, String argsS, String template) {
        if ( name.charAt(0)!='/' ) name = "/"+name;
        String[] args = argsS.split(",");
        List<FormalArgument> a = new ArrayList<FormalArgument>();
        for (String arg : args) {
            a.add(new FormalArgument(arg));
        }
        return defineTemplate(name, new CommonToken(GroupParser.ID, name), a, template, null);
    }
 
Example 26
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Set {@code locals} attribute value when you only know the name, not the
 *  index. This is ultimately invoked by calling {@code ST#add} from
 *  outside so toss an exception to notify them.
 */

protected void rawSetAttribute(String name, Object value) {
    if ( impl.formalArguments==null ) {
        throw new IllegalArgumentException("no such attribute: "+name);
    }

    FormalArgument arg = impl.formalArguments.get(name);
    if ( arg==null ) {
        throw new IllegalArgumentException("no such attribute: "+name);
    }
    locals[arg.index] = value;
}
 
Example 27
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Set {@code locals} attribute value when you only know the name, not the
 *  index. This is ultimately invoked by calling {@code ST#add} from
 *  outside so toss an exception to notify them.
 */

protected void rawSetAttribute(String name, Object value) {
    if ( impl.formalArguments==null ) {
        throw new IllegalArgumentException("no such attribute: "+name);
    }

    FormalArgument arg = impl.formalArguments.get(name);
    if ( arg==null ) {
        throw new IllegalArgumentException("no such attribute: "+name);
    }
    locals[arg.index] = value;
}
 
Example 28
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Compile a template. */

    public CompiledST compile(String srcName,
                              String name,
                              List<FormalArgument> args,
                              String template,
                              Token templateToken) // for error location {
        //System.out.println("STGroup.compile: "+enclosingTemplateName);
        Compiler c = new Compiler(this);
        return c.compile(srcName, name, args, template, templateToken);
    }
 
Example 29
Source Project: codebuff   Source File: ST.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Map<String, Object> getAttributes() {
    if ( impl.formalArguments==null ) return null;
    Map<String, Object> attributes = new HashMap<String, Object>();
    for (FormalArgument a : impl.formalArguments.values()) {
        Object o = locals[a.index];
        if ( o== ST.EMPTY_ATTR ) o = null;
        attributes.put(a.name, o);
    }
    return attributes;
}
 
Example 30
Source Project: codebuff   Source File: STGroup.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** for testing */

    public CompiledST defineTemplate(String name, String argsS, String template) {
        if ( name.charAt(0)!='/' ) name = "/"+name;
        String[] args = argsS.split(",");
        List<FormalArgument> a = new ArrayList<FormalArgument>();
        for (String arg : args) {
            a.add(
                new FormalArgument(arg)
            );
        }
        return defineTemplate(name, new CommonToken(GroupParser.ID, name), a, template, null);
    }