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

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


  }

  public boolean checkSyntax(Expression element, IRutaCheckerProblemFactory problemFactory,
          IProblemReporter rep) throws RecognitionException {
    if (element instanceof RutaAction) {
      RutaAction a = (RutaAction) element;
      String name = a.getName();
      if (!name.equals(strings[0])) {
        IProblem problem = problemFactory.createUnknownActionProblem(a);
        rep.reportProblem(problem);
        return false;
      }
      boolean ok = true;
      List<Expression> childs = a.getChilds();
      for (Expression expression : childs) {
        if (expression.getKind() != RutaTypeConstants.RUTA_TYPE_N) {
          IProblem problem = problemFactory.createWrongArgumentTypeProblem(expression,
                  "NumberExpression");
          rep.reportProblem(problem);
View Full Code Here


      appendRuleElement(ruleEl);
      return false;
    }
    // special format for actions
    if (s instanceof RutaAction) {
      RutaAction a = (RutaAction) s;
      String name = document.get(a.getNameStart(), a.getNameEnd());
      append(name);
      List<? extends ASTNode> childs = a.getChilds();
      if (childs != null && !childs.isEmpty()) {
        boolean addPar = !a.getName().equals(ActionFactory.IMPLICIT);
        if (addPar) {
          append(PAR_OPEN);
        }
        // special format for create
        if (a instanceof RutaStructureAction) {
View Full Code Here

    }

    @Override
    public boolean visit(Expression s) throws Exception {
      if (s instanceof RutaAction) {
        RutaAction action = (RutaAction) s;
        if (action.getKind() == RutaActionConstants.A_CALL || action.getKind() == RutaActionConstants.A_EXEC) {
          // TODO see antlr grammar: no viable child defined!
          if (action.getChilds().size() > 0) {
            SimpleReference ref = (SimpleReference) action.getChilds().get(0);
            if (ref != null && !engines.contains(ref.getName())) {
              String required = ref.getName();
              for (String script : scripts) {
                // check direct script-call
                boolean a = script.endsWith(required);
View Full Code Here

      checkTypeOfVariable(ref);
      return false;
    }
    // check assign types
    if (s instanceof RutaAction) {
      RutaAction tma = (RutaAction) s;

      String actionName = sourceModule.getSource().substring(tma.getNameStart(), tma.getNameEnd());
      String[] keywords = RutaKeywordsManager.getKeywords(IRutaKeywords.ACTION);
      List<String> asList = Arrays.asList(keywords);
      if (!StringUtils.isEmpty(actionName) && !"-".equals(actionName)
              && !asList.contains(actionName) && !implicitString.equals(tma.getName())) {
        IProblem problem = problemFactory.createUnknownActionProblem(tma);
        pr.reportProblem(problem);
      }

      IRutaExtension extension = actionExtensions.get(actionName);
      if (extension != null) {
        extension.checkSyntax(tma, problemFactory, pr);
      }

      if (tma.getName().equals("GETFEATURE") || tma.getName().equals("SETFEATURE")) {
        List<?> childs = tma.getChilds();
        RutaStringExpression stringExpr = (RutaStringExpression) childs.get(0);
        String feat = stringExpr.toString();
        feat = getFeatureName(stringExpr, feat);
        boolean featureFound = findFeature(matchedType, feat, -1);
        if (!featureFound) {
          IProblem problem = problemFactory.createUnknownFeatureProblem(stringExpr, matchedType);
          pr.reportProblem(problem);
        }
      }

      if (tma.getKind() == RutaActionConstants.A_ASSIGN) {
        List<?> childs = tma.getChilds();
        try {
          RutaVariableReference ref = (RutaVariableReference) childs.get(0);
          RutaExpression expr = (RutaExpression) childs.get(1);
          int type = expr.getKind();
          if (ref.getType() == RutaTypeConstants.RUTA_TYPE_G) {
View Full Code Here

    this.node = getRealNode(node);
  }

  private ASTNode getRealNode(ASTNode node) {
    if (node instanceof RutaAction) {
      RutaAction a = (RutaAction) node;
      if (ActionFactory.IMPLICIT.equals(a.getName()) && !a.getChilds().isEmpty()) {
        Expression expression = a.getChilds().get(0);
        if (expression != null && !expression.getChilds().isEmpty()) {
          return (ASTNode) expression.getChilds().get(0);
        }
      }
    }
View Full Code Here

      ComponentReference cr2 = (ComponentReference) s;
      if (cr1.getName().equals(cr2.getName())) {
        result.add(s);
      }
    } else if (s instanceof RutaAction && node instanceof RutaAction) {
      RutaAction a1 = (RutaAction) node;
      RutaAction a2 = (RutaAction) s;
      if (a1.getName().equals(a2.getName())) {
        result.add(s);
      }
    } else if (s instanceof RutaCondition && node instanceof RutaCondition) {
      RutaCondition c1 = (RutaCondition) node;
      RutaCondition c2 = (RutaCondition) s;
View Full Code Here

        Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
        Position position = null;
        int sourceStart = each.sourceStart();
        int sourceEnd = each.sourceEnd();
        if (each instanceof RutaAction) {
          RutaAction e = (RutaAction) each;
          sourceStart = e.getNameStart();
          sourceEnd = e.getNameEnd();
        } else if (each instanceof RutaCondition) {
          RutaCondition e = (RutaCondition) each;
          sourceStart = e.getNameStart();
          sourceEnd = e.getNameEnd();
        }
        position = new Position(sourceStart, sourceEnd - sourceStart);
        myAnnotations.put(annotation, position);
      }
      addAnnotations(myAnnotations);
View Full Code Here

      ComponentReference cr2 = (ComponentReference) s;
      if (cr1.getName().equals(cr2.getName())) {
        result.add(s);
      }
    } else if (s instanceof RutaAction && node instanceof RutaAction) {
      RutaAction a1 = (RutaAction) node;
      RutaAction a2 = (RutaAction) s;
      if (a1.getName().equals(a2.getName())) {
        result.add(s);
      }
    } else if (s instanceof RutaCondition && node instanceof RutaCondition) {
      RutaCondition c1 = (RutaCondition) node;
      RutaCondition c2 = (RutaCondition) s;
View Full Code Here

  }

  public boolean checkSyntax(Expression element, RutaCheckerProblemFactory problemFactory,
          IProblemReporter rep) throws RecognitionException {
    if (element instanceof RutaAction) {
      RutaAction a = (RutaAction) element;
      String name = a.getName();
      if (!name.equals(strings[0])) {
        IProblem problem = problemFactory.createUnknownActionProblem(a);
        rep.reportProblem(problem);
        return false;
      }
      boolean ok = true;
      List<Expression> childs = a.getChilds();
      for (Expression expression : childs) {
        if (expression.getKind() != RutaTypeConstants.RUTA_TYPE_N) {
          IProblem problem = problemFactory.createWrongArgumentTypeProblem(expression, "NumberExpression");
          rep.reportProblem(problem);
          ok = false;
View Full Code Here

    }

    @Override
    public boolean visit(Expression s) throws Exception {
      if (s instanceof RutaAction) {
        RutaAction action = (RutaAction) s;
        if (action.getKind() == RutaActionConstants.A_CALL) {
          // TODO see antlr grammar: no viable child defined!
          if (action.getChilds().size() > 0) {
            SimpleReference ref = (SimpleReference) action.getChilds().get(0);
            if (ref != null && !engines.contains(ref.getName())) {
              String required = ref.getName();
              for (String script : scripts) {
                // check direct script-call
                boolean a = script.endsWith(required);
View Full Code Here

TOP

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

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.