Package org.antlr.stringtemplate

Examples of org.antlr.stringtemplate.StringTemplateGroup


      new ActionTranslatorLexer(generator,
                    "a",
                    new antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);

    int expectedMsgID = ErrorManager.MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE;
View Full Code Here


      new ActionTranslatorLexer(generator,
                    "b",
                    new antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);

    int expectedMsgID = ErrorManager.MSG_UNKNOWN_SIMPLE_ATTRIBUTE;
View Full Code Here

      new ActionTranslatorLexer(generator,
                    "a",
                    new antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
View Full Code Here

        }
      }
    }
    InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/myfaces/tobago/apt/renderer.stg");
    Reader reader = new InputStreamReader(stream);
    rendererStringTemplateGroup = new StringTemplateGroup(reader);
    stream = getClass().getClassLoader().getResourceAsStream("org/apache/myfaces/tobago/apt/tag" + tagVersion + ".stg");
    reader = new InputStreamReader(stream);
    tagStringTemplateGroup = new StringTemplateGroup(reader);
    stream = getClass().getClassLoader().getResourceAsStream("org/apache/myfaces/tobago/apt/tagAbstract"
        + tagVersion + ".stg");
    reader = new InputStreamReader(stream);
    tagAbstractStringTemplateGroup = new StringTemplateGroup(reader);

    stream = getClass().getClassLoader().getResourceAsStream("org/apache/myfaces/tobago/apt/component"
        + jsfVersion + ".stg");
    reader = new InputStreamReader(stream);
    componentStringTemplateGroup = new StringTemplateGroup(reader);
    ignoredProperties = new HashSet<String>();
    ignoredProperties.add("id");
    ignoredProperties.add("rendered");
    ignoredProperties.add("binding");
View Full Code Here

  public StringTemplate getTemplateInclude(StringTemplate enclosing,
                       String templateName,
                       StringTemplateAST argumentsAST)
    {
    //System.out.println("getTemplateInclude: look up "+enclosing.getGroup().getName()+"::"+templateName);
        StringTemplateGroup group = enclosing.getGroup();
        StringTemplate embedded = group.getEmbeddedInstanceOf(enclosing, templateName);
        if ( embedded==null ) {
            enclosing.error("cannot make embedded instance of "+templateName+
                    " in template "+enclosing.getName());
            return null;
        }
View Full Code Here

            case 0 :
              return root.getFirstChild().getNextSibling().toStringList();
            case 1 :
              String templateName = root.getFirstChild().getText();
              StringTemplate enclosingST = expr.getEnclosingTemplate();
              StringTemplateGroup group = enclosingST.getGroup();
              StringTemplate embedded =
                  group.getEmbeddedInstanceOf(enclosingST,
                                templateName);
              return new StringTemplateWrapper(embedded);
          }
        }
      }
View Full Code Here

        }
        if(path.endsWith(".st")) {
            path = path.substring(0, path.length() - 3);
        }

        StringTemplateGroup templateGroup = new StringTemplateGroup(path);
        templateGroup.setFileCharEncoding(encoding);
        template = templateGroup.getInstanceOf(path);
        payloadProxy = new MessagePayloadProxy(config);
        payloadProxy.setNullGetPayloadHandling(MessagePayloadProxy.NullPayloadHandling.LOG);
    }
View Full Code Here

  public String toSource(){
    FileReader reader;
    String output = "";
    try {
      reader = new FileReader(toolTemplate());
      StringTemplateGroup templates = new StringTemplateGroup(reader);
      StringTemplate cdfTemplate = templates.lookupTemplate("cdfFile");
      cdfTemplate.setAttribute("cls", this);
      output = cdfTemplate.toString();
    } catch (FileNotFoundException e) {
      ToolPlugin.showError("Error generating Tool source", e);
    }
View Full Code Here

   
  }

  public void writePrxFile(String templateFileName) throws IOException, CoreException{
    FileReader reader = new FileReader(templateFileName);
    StringTemplateGroup templates = new StringTemplateGroup(reader);
    StringTemplate prxTemplate = templates.lookupTemplate("prxFile");
    prxTemplate.setAttribute("plan", this);
    String output = prxTemplate.toString();
    if (this.document != null && this.provider != null){
      this.document.set(output);
      this.provider.saveDocument(new NullProgressMonitor(), this.file, this.document, true);
View Full Code Here

 
  protected static StringTemplateGroup templates = null;
  @BeforeClass
  public static void setup() throws FileNotFoundException{
    FileReader reader = new FileReader("StringTemplates/Java/JavaProxy.stg");
    templates = new StringTemplateGroup(reader);
  }
View Full Code Here

TOP

Related Classes of org.antlr.stringtemplate.StringTemplateGroup

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.