Package org.stringtemplate.v4.benchmark

Examples of org.stringtemplate.v4.benchmark.Attributes$User


    setFileName(fileName);
    // ensure we have the composite set to something
    if ( composite.delegateGrammarTreeRoot==null ) {
      composite.setDelegationRoot(this);
    }
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String) getOption("language"));
  }
View Full Code Here


  public Grammar(Tool tool) {
    setTool(tool);
    builtFromString = true;
    composite = new CompositeGrammar(this);
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String)getOption("language"));
  }
View Full Code Here

  public static void setLocale(Locale locale) {
    ErrorManager.locale = locale;
    String language = locale.getLanguage();
    String fileName = "org/antlr/tool/templates/messages/languages/"+language+".stg";
    try {
      messages = new STGroupFile(fileName);
    }
    catch (IllegalArgumentException iae) {
      if ( language.equals(Locale.US.getLanguage()) ) {
        rawError("ANTLR installation corrupted; cannot find English messages file "+fileName);
        panic();
View Full Code Here

   *  Otherwise we just use the default "antlr".
   */
  public static void setFormat(String formatName) {
    ErrorManager.formatName = formatName;
    String fileName = "org/antlr/tool/templates/messages/formats/"+formatName+".stg";
    format = new STGroupFile(fileName);
    format.setListener(initSTListener);
    if ( !format.isDefined("message") ) { // pick random msg to load
      if ( formatName.equals("antlr") ) {
        rawError("no such message format file "+fileName+" retrying with default ANTLR format");
        setFormat("antlr"); // recurse on this rule, trying the default message format
View Full Code Here

    setFileName(fileName);
    // ensure we have the composite set to something
    if ( composite.delegateGrammarTreeRoot==null ) {
      composite.setDelegationRoot(this);
    }
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String) getOption("language"));
  }
View Full Code Here

  public Grammar(Tool tool) {
    setTool(tool);
    builtFromString = true;
    composite = new CompositeGrammar(this);
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String)getOption("language"));
  }
View Full Code Here

                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);
  }
View Full Code Here

    if ( STGroup.trackCreationEvents ) {
      if ( debugState==null ) debugState = new ST.DebugState();
      debugState.addAttrEvents.map(name, new AddAttributeEvent(name, value));
    }

    FormalArgument arg = null;
    if ( impl.hasFormalArgs ) {
      if ( impl.formalArguments!=null ) arg = impl.formalArguments.get(name);
      if ( arg==null ) {
        throw new IllegalArgumentException("no such attribute: "+name);
      }
    }
    else {
      // define and make room in locals (a hack to make new ST("simple template") work.)
      if ( impl.formalArguments!=null ) {
        arg = impl.formalArguments.get(name);
      }
      if ( arg==null ) { // not defined
        arg = new FormalArgument(name);
        impl.addArg(arg);
        if ( locals==null ) locals = new Object[1];
        //else locals = Arrays.copyOf(locals, impl.formalArguments.size());
        else {
          Object[] copy = new Object[impl.formalArguments.size()];
View Full Code Here

      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
  }
View Full Code Here

   */
    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;
  }
View Full Code Here

TOP

Related Classes of org.stringtemplate.v4.benchmark.Attributes$User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.