Package lombok.ast

Examples of lombok.ast.Position


    id.setPosition(pos);
    return id;
  }
 
  private Position toPosition(int start, int end) {
    return new Position(start, end + 1);
  }
View Full Code Here


  private Position toPosition(int start, int end) {
    return new Position(start, end + 1);
  }
 
  private Position toPosition(long pos) {
    return new Position((int) (pos >> 32), (int) (pos & 0xFFFFFFFFL) + 1);
  }
View Full Code Here

 
  private lombok.ast.Modifiers toModifiers(int modifiers, Annotation[] annotations, int start, int end) {
    lombok.ast.Modifiers m = new lombok.ast.Modifiers();
    for (KeywordModifier mod : KeywordModifier.fromReflectModifiers(modifiers)) m.astKeywords().addToEnd(mod);
    fillList(annotations, m.rawAnnotations());
    m.setPosition(new Position(start, end));
    return m;
  }
View Full Code Here

  }
 
  Identifier createIdentifierIfNeeded(Node identifier, int pos) {
    if (identifier instanceof Identifier) return (Identifier)identifier;
    Identifier i = new Identifier();
    i.setPosition(new Position(pos, pos));
    DanglingNodes.addDanglingNode(i, identifier);
    return i;
  }
View Full Code Here

  }
 
  Modifiers createModifiersIfNeeded(Node modifiers, int pos) {
    if (modifiers instanceof Modifiers) return (Modifiers)modifiers;
    Modifiers m = new Modifiers();
    m.setPosition(new Position(pos, pos));
    DanglingNodes.addDanglingNode(m, modifiers);
    return m;
  }
View Full Code Here

  }
 
  <T extends Node> T posify(T node) {
    int start = startPos();
    int end = Math.max(start, currentPos());
    node.setPosition(new Position(start, end));
    return node;
  }
View Full Code Here

    return getContext().getCurrentIndex();
  }
 
  void positionSpan(Node target, org.parboiled.Node<Node> start, org.parboiled.Node<Node> end) {
    if (target == null || start == null || end == null) return;
    target.setPosition(new Position(start.getStartIndex(), end.getEndIndex()));
  }
View Full Code Here

    if (labelNames != null) {
      labelNames = Lists.newArrayList(labelNames);
      Collections.reverse(labelNames);
      for (Node n : labelNames) {
        if (n != null) {
          Position pos = current == null ? null : new Position(n.getPosition().getStart(), current.getPosition().getEnd());
          current = new LabelledStatement().astLabel(createIdentifierIfNeeded(n, currentPos())).rawStatement(current);
          current.setPosition(pos);
        }
      }
    }
View Full Code Here

  public Node createCatch(Node modifiers, Node type, Node varName, Node body) {
    VariableDefinitionEntry varNameEntry = new VariableDefinitionEntry().astName(createIdentifierIfNeeded(varName, currentPos()));
    if (varName != null) varNameEntry.setPosition(varName.getPosition());
    VariableDefinition decl = new VariableDefinition().rawTypeReference(type).rawVariables().addToEnd(
        varNameEntry);
    if (type != null && varName != null) decl.setPosition(new Position(type.getPosition().getStart(), varName.getPosition().getEnd()));
    if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos()));
    return posify(new Catch().rawExceptionDeclaration(decl).rawBody(body));
  }
View Full Code Here

    Identifier id = new Identifier();
    if (text != null) id.astValue(text);
   
    int start = rawIdentifier.getStartIndex();
    int end = Math.max(start, rawIdentifier.getEndIndex());
    id.setPosition(new Position(start, end));
    return id;
  }
View Full Code Here

TOP

Related Classes of lombok.ast.Position

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.