Package org.stringtemplate.v4.compiler

Examples of org.stringtemplate.v4.compiler.Compiler


    locals[arg.index] = value;
  }

  /** Find an attr in this template only. */
  public Object getAttribute(String name) {
    FormalArgument localArg = null;
    if ( impl.formalArguments!=null ) localArg = impl.formalArguments.get(name);
    if ( localArg!=null ) {
      Object o = locals[localArg.index];
      if ( o==ST.EMPTY_ATTR ) o = null;
      return o;
View Full Code Here


            throw new IllegalArgumentException("cannot have '.' in attribute names");
        }

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

  /** Used by group creation routine, not by users */
    protected ST() {
    if ( STGroup.trackCreationEvents ) {
      if ( debugState==null ) debugState = new ST.DebugState();
      debugState.newSTEvent = new ConstructionEvent();
    }
  }
View Full Code Here

    wr.setLineWidth(lineWidth);
    Interpreter interp =
      new Interpreter(groupThatCreatedThisInstance, locale, true);
    interp.exec(wr, this); // render and track events
    List<InterpEvent> events = interp.getEvents();
    EvalTemplateEvent overallTemplateEval =
      (EvalTemplateEvent)events.get(events.size()-1);
    STViz viz = new STViz(errMgr, overallTemplateEval, out.toString(), interp,
                interp.getExecutionTrace(), errors.errors);
    viz.open();
    return viz;
View Full Code Here

    viewFrame.ast.setModel(astModel);

    // highlight output text and, if {...} subtemplate, region in ST src
    // get last event for currentScope.st; it's the event that captures ST eval
    List<InterpEvent> events = currentScope.events;
    EvalTemplateEvent e = (EvalTemplateEvent)events.get(events.size() - 1);
    //m.output.moveCaretPosition(e.outputStartChar);
    highlight(m.output, e.outputStartChar, e.outputStopChar);
    try {
    m.output.scrollRectToVisible(m.output.modelToView(e.outputStartChar));
    }
View Full Code Here

    this.interp = interp;
    this.root = new Wrapper(root);
  }

  public Object getChild(Object parent, int index) {
    EvalTemplateEvent e = ((Wrapper)parent).event;
    return new Wrapper(e.scope.childEvalTemplateEvents.get(index));
  }
View Full Code Here

    EvalTemplateEvent e = ((Wrapper)parent).event;
    return new Wrapper(e.scope.childEvalTemplateEvents.get(index));
  }

  public int getChildCount(Object parent) {
    EvalTemplateEvent e = ((Wrapper)parent).event;
    return e.scope.childEvalTemplateEvents.size();
  }
View Full Code Here

    EvalTemplateEvent e = ((Wrapper)parent).event;
    return e.scope.childEvalTemplateEvents.size();
  }

  public int getIndexOfChild(Object parent, Object child) {
    EvalTemplateEvent p = ((Wrapper)parent).event;
    EvalTemplateEvent c = ((Wrapper)parent).event;
        int i = 0;
        for (EvalTemplateEvent e : p.scope.childEvalTemplateEvents) {
            if ( e.scope.st == c.scope.st ) {
//        System.out.println(i);
//        System.out.println("found "+e.self+" as child of "+parentST);
View Full Code Here

        viewFrame.trace.setText(Misc.join(trace.iterator(), "\n"));

        CaretListener caretListenerLabel = new CaretListener() {
            public void caretUpdate(CaretEvent e) {
                int dot = e.getDot();
                InterpEvent de = findEventAtOutputLocation(allEvents, dot);
                if ( de==null ) currentScope = tmodel.root.event.scope;
        else currentScope = de.scope;

        // update tree view of template hierarchy
        // compute path from root to currentST, create TreePath for tree widget
View Full Code Here

      new Interpreter(groupThatCreatedThisInstance, locale, true);
    interp.exec(wr, this); // render and track events
    List<InterpEvent> events = interp.getEvents();
    EvalTemplateEvent overallTemplateEval =
      (EvalTemplateEvent)events.get(events.size()-1);
    STViz viz = new STViz(errMgr, overallTemplateEval, out.toString(), interp,
                interp.getExecutionTrace(), errors.errors);
    viz.open();
    return viz;
  }
View Full Code Here

TOP

Related Classes of org.stringtemplate.v4.compiler.Compiler

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.