Beispiel #1
0
  /**
   * Visszaadja a típust
   *
   * @param sp
   * @return
   * @throws NoSuchAlgorithmException
   * @throws ParseException
   */
  public Type typeParser(StringProcessor sp) throws NoSuchAlgorithmException, ParseException {
    // A -> B -> C esetén A, (A -> B) -> C esetén A -> B
    //     *                         *
    //   A   *                    *     C
    //      B  C                A   B
    //
    //
    // legbaloldalibb ág meghatározása
    Type typeT = determineNextType(sp);
    // a típuskifejezés folytatódik?
    if (sp.hasNext() && sp.getNext().equals(" ")) {
      if (sp.eatNext().equals(" ")
          && sp.eatNext().equals("-")
          && sp.eatNext().equals(">")
          && sp.eatNext().equals(" ")) {
        // A típussal és 'B -> C' vagy '(B -> C)-vel hívódik'
        Type typeF = this.typeParser(sp);
        typeT = new TypeExpression(typeT, typeF);
      } else {
        throw new ParseException("Típus nem határozható meg, ' -> 'nek kellene következni ", 0);
      }
    }

    return typeT;
  }