Package org.rascalmpl.interpreter.types

Examples of org.rascalmpl.interpreter.types.NonTerminalType


    return TF.abstractDataType(typeStore, name, parameters);
  }
 
  @Override
  public Type concreteSyntaxType(String name, IConstructor symbol) {
    NonTerminalType sort = (NonTerminalType) RascalTypeFactory.getInstance().nonTerminalType(symbol);
    concreteSyntaxTypes.put(name, sort);
    return sort;
  }
View Full Code Here


      }
      return;
//      throw new ImplementationError("Cannot handle ambiguous subject");
    }
     
    NonTerminalType ctype = (NonTerminalType) RascalTypeFactory.getInstance().nonTerminalType(tree);
    if(debug)System.err.println("ctype.getSymbol=" + ctype.getSymbol());
    IConstructor sym = ctype.getSymbol();
        if(SymbolAdapter.isAnyList(sym)){
          sym = SymbolAdapter.getSymbol(sym);
         
          int delta = 1;          // distance between "real" list elements, e.g. non-layout and non-separator
          IList listElems = (IList) tree.get(1);
View Full Code Here

          return new QualifiedNamePattern(eval, this, name);
        }

        Type type = r.getType();
        if (type instanceof NonTerminalType) {
          NonTerminalType cType = (NonTerminalType) type;
          if (cType.isConcreteListType()) {
            return new ConcreteListVariablePattern(eval, this, type, ((Default) name).lastName());
          }
        }

        return new QualifiedNamePattern(eval, this, name);
View Full Code Here

    if (declaredType instanceof NonTerminalType) {
      Type subjectType = subject.getValue().getType();
      if (subjectType.isSubtypeOf(Factory.Tree) && ((IConstructor)subject.getValue()).getConstructorType() == Factory.Tree_Appl) {
        IConstructor tree = (IConstructor)subject.getValue();

        NonTerminalType nt = (NonTerminalType)declaredType;
       
        IConstructor declaredSymbol = nt.getSymbol();
        Type subjectNT = RascalTypeFactory.getInstance().nonTerminalType(tree);
       
        if(subjectNT.isSubtypeOf(nt)) {
          if(TreeAdapter.isList(tree)) {
            if(TreeAdapter.getArgs(tree).isEmpty()) {
View Full Code Here

      actuals[1] = flatten(prod, args);
    }

    IConstructor newAppl = getValueFactory().constructor(Factory.Tree_Appl, actuals);

    NonTerminalType concreteType = (NonTerminalType) RascalTypeFactory.getInstance().nonTerminalType(newAppl);

    return makeResult(concreteType, newAppl, ctx);
  }
View Full Code Here

      type = Opt.NotExist;
      optArg = null;
    }
    else if (list.size() == 1) {
      optArg = list.get(0);
      NonTerminalType nont = (NonTerminalType) optArg.getType(ctx.getCurrentEnvt(), null);
      if (SymbolAdapter.isOpt(nont.getSymbol())) {
        // I think this can only happen when a variable of type opt is there
        type = Opt.MayExist;
      }
      else {
        type = Opt.Exist;
View Full Code Here

    else if (subjectType.isMap()){       
      return subjectType.getKeyType();
    }
    else if (subjectType.isExternalType()){
      if (subjectType instanceof NonTerminalType){
        NonTerminalType nt = (NonTerminalType) subjectType;

        if (nt.isConcreteListType() || nt.isOptionalType()){
          IConstructor listSymbol = nt.getSymbol();
          return RascalTypeFactory.getInstance().nonTerminalType(SymbolAdapter.getSymbol(listSymbol));
        }
      }

      throw new NotEnumerable(subjectType.toString(), ctx.getCurrentAST());
View Full Code Here

      return new DescendantReader(subjectValue, false);
    } else if (subjectType.isExternalType()) {
      if (subjectType instanceof NonTerminalType) {
        // NonTerminal (both pattern and subject are non-terminals, so we can skip layout and stuff)
        IConstructor tree = (IConstructor) subjectValue;
        NonTerminalType nt = (NonTerminalType) subjectType;

        if (!shallow) {
          return new DescendantReader(tree, patType instanceof NonTerminalType);
        }
        else {
          if (nt.isConcreteListType()){
            checkMayOccur(patType, subjectType, ctx);
            IConstructor ls = nt.getSymbol();

            int delta = SymbolAdapter.isSepList(ls) ?
                (SymbolAdapter.getSeparators(ls).length() + 1) : 1;

            return new CFListIterator(TreeAdapter.getArgs(tree), delta);
          }
          else if (nt.isOptionalType()) {
            checkMayOccur(patType, subjectType, ctx);
            return new CFListIterator(TreeAdapter.getArgs(tree), 1);
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.types.NonTerminalType

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.