Package org.eclipse.assemblyformatter.ir.lowlevel

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


        }
      } else {
        // TODO Review symbol format (__ is permitted)
        if (Character.isLetter(character) || (character == '_')) {
          // SYMBOL BRANCH
          section = new Symbol();
          section.setOffset(position);
          boolean flag = true;
          while (flag) {
            moveForward();
            if (moveSuccess) {
View Full Code Here


   * @throws BadLocationException
   *
   */
  private Section identifyAnyLabel() throws BadLocationException {
    Section section = base;
    Symbol symbolSection = null;
    Section i = null; // section before symbol section

    int state = 1; // initial state must not be RESET

    while (section != null) {
      // final String content = section.getContent(document); // for
      // debugging
      Section nextSection = section.getNextSection();

      switch (state) {
      case RESET:
        // TODO: Two LINE_SEPARATOR sections case
        if (section instanceof LineSeparator) {
          i = section;
          state = 1;
        }/* else { // Stay in current state. } */
        break;
      case 1: // The initial state
        if (section instanceof LineSeparator) {
          break; // Stay in current state.
        }
        if (section instanceof Symbol) {
          symbolSection = (Symbol) section;
          state = 2;
        } else {
          if (section instanceof WhiteSpace) {
            i = section;
            state = 3;
          } else {
            state = RESET;
          }
        }
        break;
      case 2:
        if ((section instanceof WhiteSpace)
            || (section instanceof LineSeparator)) {
          state = MATCH;
        } else {
          if (section instanceof CharacterLiteral) {
            if (document.getChar(section.getOffset()) == ':') {
              state = MATCH;
            } else {
              state = RESET;
            }
          } else {
            state = RESET;
          }
        }
        break;
      case 3:
        if (section instanceof Symbol) {
          symbolSection = (Symbol) section;
          state = 4;
        } else {
          state = RESET;
        }
        break;
      case 4:
        if (section instanceof CharacterLiteral) {
          final char c = document.getChar(section.getOffset());
          if (c == ':') {
            state = MATCH;
          } else {
            state = RESET;
          }
        } else {
          state = RESET;
        }
        break;
      case MATCH:
        // NOP here
        // TODO Review
        break;
      default:
        state = RESET;
      }

      if (state == MATCH) {
        // Replace SYMBOL with LABEL.
        Section label = new Label();
        label.copyPosition(symbolSection);
        label.setNextSection(symbolSection.getNextSection());
        i.setNextSection(label);
        state = RESET;
      }

      section = nextSection;
View Full Code Here

    while (section != null) {
      Section nextSection = section.getNextSection();

      if (section instanceof LineSeparator) {
        if (section.nextIs(WhiteSpace.class, Symbol.class)) {
          Symbol symbolSection = (Symbol) Section
              .getNextIs__staticData(1);
          // Replace SYMBOL with INSTRUCTION.
          Section instructionSection = new Instruction();
          instructionSection.copyPosition(symbolSection);
          instructionSection.setNextSection(symbolSection
              .getNextSection());
          nextSection.setNextSection(instructionSection);

          // Jump.
          nextSection = symbolSection.getNextSection();
        }
      }
      section = nextSection;
    }
    return base;
View Full Code Here

TOP

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

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.