Package org.apache.uima.ruta.ide.parser.ast

Examples of org.apache.uima.ruta.ide.parser.ast.RutaRule


      // Rules always just consists of RuleElements: whitespace separation
      if (s.sourceEnd() - s.sourceStart() > 2 * maxLineLength) {
        inLargeRule = 1;
        indentLevel++;
      }
      RutaRule rule = (RutaRule) s;
      List<Expression> expressions = rule.getExpressions();
      if (expressions != null && !expressions.isEmpty()) {
        append(expressions.get(0));
        append(" " + THEN + " ");
        if (expressions.size() > 1) {
          for (int i = 1; i < expressions.size(); i++) {
            Expression expression = expressions.get(i);
            if (expression.getKind() == RutaTypeConstants.RUTA_TYPE_N && i < expressions.size() - 1) {
              append(expression);
              append(EQUALS);
              append(expressions.get(++i));
            } else {
              append(expression);
            }
            if (i < expressions.size() - 1) {
              append(COMMA + " ");
            }
          }
        }
      }
      if (!inBlockDeclaration) {
        appendStatementEnd();
      }
      if (inLargeRule > 0) {
        indentLevel--;
        inLargeRule = 0;
      }
      return false;
    }

    if (s instanceof RutaRule) {
      // traverse into container RutaRule to format RuleElements
      if (!inBlockDeclaration) {
        appendNewLine();
      }
      // Rules always just consists of RuleElements: whitespace separation
      if (s.sourceEnd() - s.sourceStart() > 2 * maxLineLength) {
        inLargeRule = 1;
        indentLevel++;
      }
      RutaRule rule = (RutaRule) s;
      List<Expression> expressions = rule.getExpressions();
      String sep = "";
      traverseAstNodes(expressions, sep);
      if (!inBlockDeclaration) {
        appendStatementEnd();
      }
View Full Code Here


  public boolean visit(Statement s) throws Exception {
    if (result != null) {
      return false;
    }
    if (s instanceof RutaRule) {
      RutaRule rule = (RutaRule) s;
      if (id == rule.getId()) {
        result = rule;
      }
    }
    return true;
  }
View Full Code Here

    RutaRuleIdVisitor visitor = new RutaRuleIdVisitor(id);
    try {
      parsed.traverse(visitor);
    } catch (Exception e) {
    }
    RutaRule rule = visitor.getResult();
    myAnnotations = new HashMap<Annotation, Position>();
    if (rule != null) {
      Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
      int sourceStart = rule.sourceStart();
      int sourceEnd = rule.sourceEnd();
      Position position = new Position(sourceStart, sourceEnd - sourceStart);
      getSourceViewer().revealRange(sourceStart, sourceEnd - sourceStart);
      myAnnotations.put(annotation, position);
    }
    addAnnotations(myAnnotations);
View Full Code Here

  public boolean visit(Statement s) throws Exception {
    if (result != null) {
      return false;
    }
    if (s instanceof RutaRule) {
      RutaRule rule = (RutaRule) s;
      if (id == rule.getId()) {
        result = rule;
      }
    }
    return true;
  }
View Full Code Here

    RutaRuleIdVisitor visitor = new RutaRuleIdVisitor(id);
    try {
      parsed.traverse(visitor);
    } catch (Exception e) {
    }
    RutaRule rule = visitor.getResult();
    myAnnotations = new HashMap<Annotation, Position>();
    if (rule != null) {
      Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
      int sourceStart = rule.sourceStart();
      int sourceEnd = rule.sourceEnd();
      Position position = new Position(sourceStart, sourceEnd - sourceStart);
      getSourceViewer().revealRange(sourceStart, sourceEnd - sourceStart);
      myAnnotations.put(annotation, position);
    }
    addAnnotations(myAnnotations);
View Full Code Here

      // Rules always just consists of RuleElements: whitespace separation
      if (s.sourceEnd() - s.sourceStart() > 2 * maxLineLength) {
        inLargeRule = 1;
        indentLevel++;
      }
      RutaRule rule = (RutaRule) s;
      List<Expression> expressions = rule.getExpressions();
      traverseAstNodes(expressions, "");
      if (!inBlockDeclaration) {
        appendStatementEnd();
      }
      if (inLargeRule > 0) {
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.ide.parser.ast.RutaRule

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.