Package org.eclipse.assemblyformatter.ir.lowlevel

Examples of org.eclipse.assemblyformatter.ir.lowlevel.WhiteSpace


    int i;
    switch (character) {
    case ' ':
    case '\t':
      section = new WhiteSpace();
      section.setOffset(position);
      { // WSPACE branch
        boolean flag = true;
        while (flag) {
          moveForward();
View Full Code Here


              resize(nextSection, null, distance);
            }
          }
        } else {
          if (section.nextIs(WhiteSpace.class, Instruction.class)) {
            WhiteSpace whiteSpaceSection = (WhiteSpace) Section
                .getNextIs__staticData(0);
            whiteSpaceSection.setVirtualLength(distance);
          }
        }

        // Go forward.
        section = nextSection;
        continue;
      }

      if (section instanceof Instruction) {
        // Parameter aligning
        if (section.nextIs(WhiteSpace.class)) {
          if (nextSection.nextIs(Parameter.class)) {
            resize(section, (WhiteSpace) nextSection,
                parameterDistance + reserve);
          } else {
            // Comment aligning
            if (nextSection.nextIs(Comment.class)) {
              resize(section, (WhiteSpace) nextSection,
                  parameterDistance + reserve
                      + commentDistance + reserve);
            }
          }
        }

        // Go forward.
        section = nextSection;
        continue;

      }

      if (section instanceof Parameter) {
        // Comment aligning
        final int distance = commentDistance + reserve;
        if (section.nextIs(WhiteSpace.class, Comment.class)) {
          resize(section, (WhiteSpace) nextSection, distance);
        }
      }

      section = nextSection;
    }

    // Connect position objects to document.
    section = base;
    while (section != null) {
      Section nextSection = section.getNextSection();
      try {
        document.addPosition(section.getPosition());
      } catch (BadLocationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      section = nextSection;
    }

    // Rewrite white-space sections.
    section = base;
    while (section != null) {
      Section nextSection = section.getNextSection();
      if (section instanceof WhiteSpace) {
        WhiteSpace whiteSpace = (WhiteSpace) section;
        if (whiteSpace.getVirtualLength() >= 0) {
          int offset = whiteSpace.getOffset();
          int length = whiteSpace.getLength();
          String text = whiteSpace.getVirtualString();
          try {
            document.replace(offset, length, text);
          } catch (BadLocationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

      int whiteSpaceLength) {
    final int sectionLength = section.getLength();

    // Null WHITE_SPACE section case.
    if (whiteSpace == null) {
      whiteSpace = new WhiteSpace();
      whiteSpace.setOffset(section.getOffset() + sectionLength);
      whiteSpace.setLength(0);
      whiteSpace.setNextSection(section.getNextSection());
      section.setNextSection(whiteSpace);
    }
View Full Code Here

            Integer.toString(section.getOffset()));
        elementSection.setAttribute("length",
            Integer.toString(section.getLength()));

        if (section instanceof WhiteSpace) {
          WhiteSpace whiteSpace = (WhiteSpace) section;
          if (whiteSpace.getVirtualLength() >= 0) {
            elementSection
                .setAttribute("virtualLength",
                    Integer.toString(whiteSpace
                        .getVirtualLength()));
          }
        }

        elementSection.appendChild(cdata);
View Full Code Here

TOP

Related Classes of org.eclipse.assemblyformatter.ir.lowlevel.WhiteSpace

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.