diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc index 1f2f3564282..88bdb54e5fb 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc @@ -100,7 +100,7 @@ void addCommonKeywordFields(Solver s){ fieldName = ""; fieldType = s.getType(kwf); fieldType.alabel = fieldName; - moduleName = getRascalModuleName(kwf.expression@\loc, s.getConfig().typepalPathConfig); + moduleName = getRascalModuleName(kwf.expression.src, s.getConfig().typepalPathConfig); commonKeywordFields += ; //commonKeywordFieldNames += ; // TODO: reconsider this diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc index 98ec75730d4..a6363b66e7c 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc @@ -318,14 +318,14 @@ ModuleStatus rascalTModelForLocs( = getModuleParseTree(m, ms); if(success){ if(compilerConfig.infoModuleChecked){ - imsgs += [info("Checked ", pt.header.name@\loc)]; + imsgs += [info("Checked ", pt.header.name.src)]; } check_imports: for(imod <- pt.header.imports, imod has \module){ iname = unescape(""); inameId = moduleName2moduleId(iname); if(hasProperty(inameId, ms, tpl_version_error(), rsc_not_found())){ - imsgs += error("Rascal TPL version error for ``, no source found", imod@\loc); + imsgs += error("Rascal TPL version error for ``, no source found", imod.src); } if(inameId notin usedModules){ if(iname == "ParseTree" && implicitlyUsesParseTree(ms.moduleLocs[m].path, tm)){ @@ -339,7 +339,7 @@ ModuleStatus rascalTModelForLocs( } if((inameId in component || hasProperty(inameId, ms, checked())) && hasNotProperty(inameId, ms, rsc_not_found())){ if(imod is \default){ - imsgs += warning("Unused import of ``", imod@\loc); + imsgs += warning("Unused import of ``", imod.src); } //else { //TODO: maybe add option to turn off info messages? //imsgs += info("Extended module `` is unused in the current module", imod@\loc); //} @@ -469,7 +469,7 @@ tuple[TModel, ModuleStatus] rascalTModelComponent(set[MODID] moduleIds, ModuleSt tagsMap = getTags(pt.header.tags); if(hasIgnoreCompilerTag(tagsMap)) { - ms.messages[mid] ? {} += { Message::info("Ignoring module ", pt.header.name@\loc) }; + ms.messages[mid] ? {} += { Message::info("Ignoring module ", pt.header.name.src) }; ms = addProperty(mid, ms, ModuleProperty::ignored()); } idTrees[mid] = pt; diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc index 6e1f3894d83..122983e1d82 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc @@ -411,7 +411,7 @@ void checkOverloading(map[str,Tree] namedTrees, Solver s){ set[Define] defines = s.getAllDefines(); facts = s.getFacts(); - moduleScopes = { t@\loc | t <- range(namedTrees) }; + moduleScopes = { t.src | t <- range(namedTrees) }; funDefs = { | define <- defines, define.idRole == functionId() }; funIds = domain(funDefs); @@ -516,7 +516,7 @@ void reportConstructorOverload(Expression current, overloadedAType(rel[loc def, qualifyHint = size(adtNames) > 1 ? " you may use as qualifier" : ""; argHint = "make argument type(s) more precise"; msg = error("Constructor `` is overloaded, maybe", - current@\loc); + current.src); s.addMessages([msg]); } } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc index b08093c2d77..df71ace585e 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc @@ -204,21 +204,21 @@ bool validateUseDefs(str moduleName, map[str, tuple[int, set[int]]] defuses, Mod map[loc, str] loc2name = (); top-down-break visit(pt){ case Name nm: { - names[""] ? [] += [nm@\loc]; - loc2name[nm@\loc] = ""; + names[""] ? [] += [nm.src]; + loc2name[nm.src] = ""; } case QualifiedName nm: { - names[""] ? [] += [nm@\loc]; - loc2name[nm@\loc] = ""; + names[""] ? [] += [nm.src]; + loc2name[nm.src] = ""; } case Nonterminal nm: { - names[""] ? [] += [nm@\loc]; - loc2name[nm@\loc] = ""; + names[""] ? [] += [nm.src]; + loc2name[nm.src] = ""; } case NonterminalLabel nm: { - names[""] ? [] += [nm@\loc]; - loc2name[nm@\loc] = ""; + names[""] ? [] += [nm.src]; + loc2name[nm.src] = ""; } } println("names:"); iprintln(names); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/ConcreteSyntax.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/ConcreteSyntax.rsc index 09976df45c5..44a96bc7f94 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/ConcreteSyntax.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/ConcreteSyntax.rsc @@ -55,25 +55,25 @@ tuple[Tree, TModel] parseConcreteFragments(Tree M, TModel tm, AGrammar gr) { @doc{parse fragment or store parse error in the TModel} Tree parseFragment(t:appl(prod(label("typed",lex("Concrete")), _, _),[_,_,Tree varsym,_,_,_,_, parts,_])) { try { - sym = atype2symbol(getType(varsym@\loc)); + sym = atype2symbol(getType(varsym.src)); return appl(prod(label("parsed",Symbol::lex("Concrete")), [sym], {}), [ doParseFragment(sym, parts.args, rules) - ])[@\loc=t@\loc]; + ])[src=t.src]; } catch ParseError(_) : { - throw CompileTimeError(error("Parse error in concrete syntax fragment `

<}>`", t@\loc)); + throw CompileTimeError(error("Parse error in concrete syntax fragment `

<}>`", t.src)); } catch Ambiguity(loc _location, str nonterminal, str sentence): { - throw CompileTimeError(error("Ambiguity in concrete syntax fragment for : ``", /*location*/ t@\loc)); + throw CompileTimeError(error("Ambiguity in concrete syntax fragment for : ``", /*location*/ t.src)); } } - ignoredFunctionLocs = {fd@\loc | /FunctionDeclaration fd := M, hasIgnoreCompilerTag(getTags(fd.tags)) }; + ignoredFunctionLocs = {fd.src | /FunctionDeclaration fd := M, hasIgnoreCompilerTag(getTags(fd.tags)) }; M = top-down-break visit(M) { case Tree t:appl(p:prod(label("concrete",sort(/Expression|Pattern/)), _, _),[Tree concrete]) - => appl(p, [parseFragment(concrete)])[@\loc=t@\loc] - when !any(loc ign <- ignoredFunctionLocs, isContainedIn(t@\loc, ign, tm.logical2physical)) + => appl(p, [parseFragment(concrete)])[src=t.src] + when !any(loc ign <- ignoredFunctionLocs, isContainedIn(t.src, ign, tm.logical2physical)) } return ; @@ -96,7 +96,7 @@ Tree doParseFragment(Symbol sym, list[Tree] parts, map[Symbol, Production] rules // here we weave in a unique and indexed sub-string for which a special rule // was added by the parser generator: - holeType = atype2symbol(getType(hole.args[2]@\loc)); + holeType = atype2symbol(getType(hole.args[2].src)); return "\u0000:\u0000"; } @@ -106,9 +106,9 @@ Tree doParseFragment(Symbol sym, list[Tree] parts, map[Symbol, Production] rules // now parse the input to get a Tree (or a ParseError is thrown) if(type[Tree] tp := type(sym, rules)){ Tree tree = ParseTree::parse(tp, input, |todo:///|); - return isEmpty(parts) ? tree : restoreHoles(tree, holes, parts[0]@\loc); + return isEmpty(parts) ? tree : restoreHoles(tree, holes, parts[0].src); } else { - throw InternalCompilerError(error("Illegal type in concrete syntax fragment `

<}>`", parts[0]@\loc)); + throw InternalCompilerError(error("Illegal type in concrete syntax fragment `

<}>`", parts[0].src)); } } @@ -147,10 +147,10 @@ RestoreState restoreHoles(t:char(int c), map[int, Tree] _, loc _, int offset, in RestoreState restoreHoles(Tree v:appl(prod(Symbol::label("$MetaHole", Symbol varType), _, {\tag("holeType"(Symbol ht))}), [char(0),_,_,Tree i,char(0)]), map[int, Tree] holes, loc _, int _, int _, int _) { Tree typedVar = holes[toInt("")]; - return ; } @@ -165,7 +165,7 @@ default RestoreState restoreHoles(Tree v:appl(Production p, list[Tree] args), ma append a; } - return , )], + return , )], curOffset, curLine, curColumn>; } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalDeclaration.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalDeclaration.rsc index 7a92a6cf657..3b0b3e885c6 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalDeclaration.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalDeclaration.rsc @@ -139,7 +139,7 @@ private void generateGettersForAdt(AType adtType, loc module_scope, set[AType] c */ consName = consType.alabel; - for(kw <- consType.kwFields, kw has defaultExp, isContainedIn(kw.defaultExp@\loc, module_scope, l2p)){ + for(kw <- consType.kwFields, kw has defaultExp, isContainedIn(kw.defaultExp.src, module_scope, l2p)){ kwType = kw.fieldType; defaultExp = kw.defaultExp; str kwFieldName = kwType.alabel; @@ -176,7 +176,7 @@ private void generateGettersForAdt(AType adtType, loc module_scope, set[AType] c getterType = afunc(returnType, [adtType], []); adtVar = muVar(adtName, getterName, 0, adtType, dataId()); failCode = muFailReturn(returnType); - for(Keyword kw <- common_keyword_fields, kw has defaultExp, isContainedIn(kw.defaultExp@\loc, module_scope, l2p)){ + for(Keyword kw <- common_keyword_fields, kw has defaultExp, isContainedIn(kw.defaultExp.src, module_scope, l2p)){ kwType = kw.fieldType; str commonKwFieldName = unescape(kwType.alabel); if(commonKwFieldName == kwFieldName){ @@ -198,7 +198,7 @@ private void generateGettersForAdt(AType adtType, loc module_scope, set[AType] c * Create getters for common keyword fields of this data type */ seen = {}; - for(Keyword kw <- common_keyword_fields, kw has defaultExp, kw.fieldType notin seen, isContainedIn(kw.defaultExp@\loc, module_scope, l2p)){ + for(Keyword kw <- common_keyword_fields, kw has defaultExp, kw.fieldType notin seen, isContainedIn(kw.defaultExp.src, module_scope, l2p)){ kwType = kw.fieldType; defaultExp = kw.defaultExp; seen += kwType; @@ -491,8 +491,8 @@ public tuple[list[MuExp] formalVars, MuExp funBody] translateFunction(str fname, formalVars = for(i <- index(formalsList)){ pname = getParameterName(formalsList, i); ndummies += size(dummyFormalsInType(getType(formalsList[i]))); - if(hasParameterName(formalsList, i) && !isUse(formalsList[i]@\loc)){ - pos = getPositionInScope(pname, getParameterNameAsTree(formalsList, i)@\loc); + if(hasParameterName(formalsList, i) && !isUse(formalsList[i].src)){ + pos = getPositionInScope(pname, getParameterNameAsTree(formalsList, i).src); //println(": pos = , ndummies = , pos - ndummies = "); //if(pos - ndummies > 0) pos -= ndummies; append muVar(pname, fuid, pos, unsetRec(getType(formalsList[i]), "alabel"), formalId()); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc index 962ad8c0c30..1305424ad38 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc @@ -74,10 +74,10 @@ import lang::rascalcore::compile::Rascal2muRascal::RascalConstantCall; // Generate code for completely type-resolved operators private MuExp infix(str op, Expression e) { - return muPrim(op, getType(e), [getType(e.lhs), getType(e.rhs)], [translate(e.lhs), translate(e.rhs)], e@\loc); + return muPrim(op, getType(e), [getType(e.lhs), getType(e.rhs)], [translate(e.lhs), translate(e.rhs)], e.src); } private MuExp unary(str op, Expression e, Expression arg) = - muPrim(op, getType(e), [getType(arg)], [translate(arg)], e@\loc); + muPrim(op, getType(e), [getType(arg)], [translate(arg)], e.src); // ----------- compose: exp o exp ---------------- @@ -129,7 +129,7 @@ private MuExp translateAddFunction(Expression e){ // Generate and add a function ADD<...> str scopeId = topFunctionScope(); - str add_name = "$ADDAL"; + str add_name = "$ADDAL"; str add_fuid = scopeId + "_" + add_name; MuExp lhsReceiver = translate(e.lhs); @@ -139,21 +139,21 @@ private MuExp translateAddFunction(Expression e){ lhsFormals = getFormals(lhsType); nargs = size(lhsFormals); lactuals = [muVar("$", add_fuid, j, lhsFormals[j], formalId()) | int j <- [0 .. nargs]]; - lhsCall = muOCall(lhsReceiver, lhsType, lactuals, [], e.lhs@\loc); + lhsCall = muOCall(lhsReceiver, lhsType, lactuals, [], e.lhs.src); rhsFormals = getFormals(rhsType); nargs = size(rhsFormals); ractuals = [muVar("$" , add_fuid, j, rhsFormals[j], formalId()) | int j <- [0 .. nargs]]; - rhsCall = muOCall(rhsReceiver, rhsType, ractuals, [], e.rhs@\loc); + rhsCall = muOCall(rhsReceiver, rhsType, ractuals, [], e.rhs.src); body = muReturnFirstSucceeds(["$" | int i <- [0 .. nargs]], [muReturn1(resType, lhsCall), muReturn1(resType, rhsCall)]); leaveFunctionScope(); funType = afunc(resType, lhsFormals, []); - fun = muFunction(add_name, add_name, funType, lactuals, [], [], scopeId, false, false, false, getExternalRefs(body, add_fuid, []), {}, {}, e@\loc, [], (), body); - loc uid = declareGeneratedFunction(add_name, add_fuid, funType, e@\loc); + fun = muFunction(add_name, add_name, funType, lactuals, [], [], scopeId, false, false, false, getExternalRefs(body, add_fuid, []), {}, {}, e.src, [], (), body); + loc uid = declareGeneratedFunction(add_name, add_fuid, funType, e.src); addFunctionToModule(fun); - addDefineAndType(, funType); // TODO: replace arbitrary number + addDefineAndType(, funType); // TODO: replace arbitrary number return muOFun([uid], funType); } @@ -425,7 +425,7 @@ private MuExp toIString(MuExp e, loc src) private MuExp translateToIString(Expression e) = isStrAType(getType(e)) ? translate(e) - : muPrim("toIString", astr(), [avalue()], [translate(e)], e@\loc); + : muPrim("toIString", astr(), [avalue()], [translate(e)], e.src); private MuExp translateLocationLiteral(l: (LocationLiteral) ` `) = muPrim("create_loc", aloc(), [astr()], @@ -433,27 +433,27 @@ private MuExp translateLocationLiteral(l: (LocationLiteral) ``) = muCon(""[1..]); private MuExp translateProtocolPart(p: (ProtocolPart) ` `) = - muPrim("add", astr(), [astr(), astr(), astr()], [muCon("

"[1..-1]), translateToIString(expression), translateProtocolTail(tail)], p@\loc);
+    muPrim("add", astr(), [astr(), astr(), astr()], [muCon("
"[1..-1]), translateToIString(expression), translateProtocolTail(tail)], p.src);
 
 private MuExp  translateProtocolTail(p: (ProtocolTail) `  `) =
-   muPrim("add", astr(), [astr(), astr(), astr()], [muCon(""[1..-1]), translateToIString(expression), translateProtocolTail(tail)], p@\loc);
+   muPrim("add", astr(), [astr(), astr(), astr()], [muCon(""[1..-1]), translateToIString(expression), translateProtocolTail(tail)], p.src);
 
 private MuExp translateProtocolTail((ProtocolTail) ``) = muCon(""[1 ..]);
 
 private MuExp translatePathPart((PathPart) ``) = muCon(""[..-1]);
 
 private MuExp translatePathPart(p: (PathPart) `  `) =
-   muPrim("add", astr(), [astr(), astr(), astr()], [ muCon("
"[..-1]), translateToIString(expression), translatePathTail(tail)], p@\loc);
+   muPrim("add", astr(), [astr(), astr(), astr()], [ muCon("
"[..-1]), translateToIString(expression), translatePathTail(tail)], p.src);
 
 private MuExp translatePathTail(p: (PathTail) `  `) =
-   muPrim("add", astr(), [astr(), astr(), astr()], [ muCon(""[1..-1]), translateToIString(expression), translatePathTail(tail)], p@\loc);
+   muPrim("add", astr(), [astr(), astr(), astr()], [ muCon(""[1..-1]), translateToIString(expression), translatePathTail(tail)], p.src);
 
 private MuExp translatePathTail((PathTail) ``) = muCon(""[1..-1]);
 
@@ -463,7 +463,7 @@ default MuExp translateLiteral((Literal) ``) {
     try {
         return muCon(readTextValueString(""));
     } catch e: {
-        throw CompileTimeError(error("", s@\loc));
+        throw CompileTimeError(error("", s.src));
     }
 }
 
@@ -489,7 +489,7 @@ MuExp translate(e:appl(prod(Symbol::label("parsed",Symbol::lex("Concrete")), [_]
 
 // this detects that a parse error has occurred earlier and we generate an exception here:
 MuExp translate(e:appl(prod(label("typed",lex("Concrete")), [_],_),_))
-  = muValueBlock(avalue(), [muThrow(muCon("(compile-time) parse error in concrete syntax"), e@\loc)]);
+  = muValueBlock(avalue(), [muThrow(muCon("(compile-time) parse error in concrete syntax"), e.src)]);
 
 // these three constant parts of trees are directly mapped to constants:
 private MuExp translateConcreteExpression(t:appl(prod(lit(_),_, _), _)) = muCon(t);
@@ -500,29 +500,29 @@ private MuExp translateConcreteExpression(t:appl(prod(layouts(_),_, _), _)) = mu
 private MuExp translateConcreteExpression(t:appl(prod(Symbol::label("$MetaHole", Symbol _),[_], _), [ConcreteHole hole])) {
      = getVariableScope("", getConcreteHoleVarLoc(t));
 
-    return mkVar(unescape(""), hole.name@\loc);
+    return mkVar(unescape(""), hole.name.src);
     //return muVar("", fuid, pos, getType(hole.symbol@\loc));
 }
 
 // Four cases of lists are detected to be able to implement splicing
 // splicing is different for separated lists from normal lists
 private MuExp translateConcreteExpression(t:appl(p:Production::regular(s:Symbol::iter(Symbol elem)), list[Tree] args))
-  = muTreeAppl(muCon(p), translateConcreteExpressionList(elem, args, t@\loc), t@\loc);
+  = muTreeAppl(muCon(p), translateConcreteExpressionList(elem, args, t.src), t.src);
 
 private MuExp translateConcreteExpression(t:appl(p:Production::regular(s:Symbol::\iter-star(Symbol elem)), list[Tree] args))
-  = muTreeAppl(muCon(p), translateConcreteExpressionList(elem, args, t@\loc), t@\loc);
+  = muTreeAppl(muCon(p), translateConcreteExpressionList(elem, args, t.src), t.src);
 
 private MuExp translateConcreteExpression(t:appl(p:Production::regular(s:Symbol::\iter-seps(Symbol elem, list[Symbol] seps)), list[Tree] args))
-  = muTreeAppl(muCon(p), translateConcreteExpressionSeparatedList(elem, seps, args, t@\loc), t@\loc);
+  = muTreeAppl(muCon(p), translateConcreteExpressionSeparatedList(elem, seps, args, t.src), t.src);
 
 private MuExp translateConcreteExpression(t:appl(p:Production::regular(s:Symbol::\iter-star-seps(Symbol elem, list[Symbol] seps)), list[Tree] args))
-  = muTreeAppl(muCon(p), translateConcreteExpressionSeparatedList(elem, seps, args, t@\loc), t@\loc);
+  = muTreeAppl(muCon(p), translateConcreteExpressionSeparatedList(elem, seps, args, t.src), t.src);
 
 private MuExp translateConcreteExpression(char(int i)) =  muTreeChar(i);
 
 // this is a normal parse tree node:
 private default MuExp translateConcreteExpression(t:appl(Production p, list[Tree] args))
-  = muTreeAppl(muCon(p), [translateConcreteExpression(a) | a <- args], (t@\loc?) ? t@\loc : |unknown:///|); // TODO: t@\loc does not work here, why?????
+  = muTreeAppl(muCon(p), [translateConcreteExpression(a) | a <- args], (t.src?) ? t.src : |unknown:///|); // TODO: t@\loc does not work here, why?????
 
 
 bool isListPlusVar(Symbol elem, appl(prod(label("$MetaHole", _),[sort("ConcreteHole")], {\tag("holeType"(Symbol::\iter(elem)))}), [_])) = true;
@@ -599,13 +599,13 @@ private MuExp translateConcreteExpressionSeparatedList(Symbol eltType, list[Symb
 
       // first we splice or add the first element:
       if (isListVar(eltType, first)) {
-        code += [muPrim("splice_list", avoid(), [avalue(), treeType], [writer, muTreeGetArgs(varExp)], first@\loc?|unknown:///|)];
+        code += [muPrim("splice_list", avoid(), [avalue(), treeType], [writer, muTreeGetArgs(varExp)], first.src)];
       }
       else {
-        code += [muPrim("add_list_writer", avoid(), [avalue(), treeType], [writer, varExp], first@\loc?|unknown:///|)];
+        code += [muPrim("add_list_writer", avoid(), [avalue(), treeType], [writer, varExp], first.src)];
       }
 
-      sepCode    = [muPrim("add_list_writer", avoid(), [avalue(), treeType], [writer, muCon(e)], e@\loc?|unknown:///|) | e <- sepTrees];
+      sepCode    = [muPrim("add_list_writer", avoid(), [avalue(), treeType], [writer, muCon(e)], e.src) | e <- sepTrees];
       secondVarExp = translateConcreteExpression(second);
 
       // then separators are optionally added:
@@ -638,10 +638,10 @@ private MuExp translateConcreteExpressionSeparatedList(Symbol eltType, list[Symb
       if (more == []) {
         // the last element must be printed, or sliced now:
         if (isListVar(eltType, second)) {
-          code += [muPrim("splice_list", avoid(), [avalue(), treeType], [writer, muTreeGetArgs(secondVarExp)], second@\loc?|unknown:///|)];
+          code += [muPrim("splice_list", avoid(), [avalue(), treeType], [writer, muTreeGetArgs(secondVarExp)], second.src)];
         }
         else {
-          code += [muPrim("add_list_writer", avoid(), [avalue(), treeType], [writer, secondVarExp], second@\loc?|unknown:///|)];
+          code += [muPrim("add_list_writer", avoid(), [avalue(), treeType], [writer, secondVarExp], second.src)];
         }
       }
       elems = [second, *more];
@@ -684,11 +684,11 @@ MuExp translate (e:(Expression) ` {  {  ..  ]`) {
 
   return
     muValueBlock(resultType,
-                 [ muConInit(writer, muPrim("open_list_writer", avalue(), [], [], e@\loc)),
-                   muForRange("", elem, translate(first), muCon(0), translate(last), muPrim("add_list_writer", avoid(), [resultType, elemType], [writer, elem], e@\loc), muBlock([])),
-                   muPrim("close_list_writer", resultType, [avalue()], [writer], e@\loc)
+                 [ muConInit(writer, muPrim("open_list_writer", avalue(), [], [], e.src)),
+                   muForRange("", elem, translate(first), muCon(0), translate(last), muPrim("add_list_writer", avoid(), [resultType, elemType], [writer, elem], e.src), muBlock([])),
+                   muPrim("close_list_writer", resultType, [avalue()], [writer], e.src)
                  ]);
 }
 
@@ -756,9 +756,9 @@ MuExp translate (e:(Expression) `[  ,  .. <
 
   return
     muValueBlock(getType(e),
-                 [ muConInit(writer, muPrim("open_list_writer", alist(elemType), [], [], e@\loc)),
-                   muForRange("", elem, translate(first), translate(second), translate(last), muPrim("add_list_writer", avoid(), [elemType], [writer, elem], e@\loc), muBlock([])),
-                   muPrim("close_list_writer", avoid(), [avalue()], [writer], e@\loc)
+                 [ muConInit(writer, muPrim("open_list_writer", alist(elemType), [], [], e.src)),
+                   muForRange("", elem, translate(first), translate(second), translate(last), muPrim("add_list_writer", avoid(), [elemType], [writer, elem], e.src), muBlock([])),
+                   muPrim("close_list_writer", avoid(), [avalue()], [writer], e.src)
                  ]);
 }
 
@@ -891,7 +891,7 @@ private MuExp translateReducer(Expression e){
 // -- reified type expression ---------------------------------------
 
 MuExp translate (e:(Expression) `type (  , )`) {
-    return muPrim("create_reifiedType", avalue(), [avalue(), avalue()], [translate(symbol), translate(definitions)], e@\loc);
+    return muPrim("create_reifiedType", avalue(), [avalue(), avalue()], [translate(symbol), translate(definitions)], e.src);
 }
 
 // -- call expression -----------------------------------------------
@@ -903,14 +903,14 @@ MuExp translate(e:(Expression) ` ( <{Expression ","}* arg
    list[MuExp] args = [ translate(a) | Expression a <- arguments ];
    exp_type = getOuterType(expression);
    if(exp_type == "astr"){
-   		return muPrim("create_node", getType(e), [ getType(arg) | arg <- arguments ], [receiver, *args, muKwpActuals(kwargs)], e@\loc);
+   		return muPrim("create_node", getType(e), [ getType(arg) | arg <- arguments ], [receiver, *args, muKwpActuals(kwargs)], e.src);
    }
 
    if(exp_type == "aloc"){
        if(size(args) == 2){
-            return muPrim("create_loc_with_offset", aloc(), [aloc(), aint(), aint()], [receiver, *args], e@\loc);
+            return muPrim("create_loc_with_offset", aloc(), [aloc(), aint(), aint()], [receiver, *args], e.src);
        } else {
-         return muPrim("create_loc_with_offset_and_begin_end", aloc(), [aloc(),aint(), aint(), atuple(atypeList([aint(), aint()])), atuple(atypeList([aint(), aint()]))], [receiver, *args], e@\loc);
+         return muPrim("create_loc_with_offset_and_begin_end", aloc(), [aloc(),aint(), aint(), atuple(atypeList([aint(), aint()])), atuple(atypeList([aint(), aint()]))], [receiver, *args], e.src);
        }
    }
    str fname = unescape("");
@@ -921,7 +921,7 @@ MuExp translate(e:(Expression) ` ( <{Expression ","}* arg
    		}
    		catch "NotConstant":  /* not a constant, generate an ordinary call instead */;
    }
-   return muOCall(receiver, ftype, args, kwargs, e@\loc);
+   return muOCall(receiver, ftype, args, kwargs, e.src);
 }
 
 private lrel[str,MuExp] translateKeywordArguments((KeywordArguments[Expression]) ``) {
@@ -1075,9 +1075,9 @@ private list[MuExp] translateComprehensionContribution(str kind, AType resultTyp
   return
 	  for( r <- results){
 	    if((Expression) `* ` := r){
-	       append muPrim("splice_", resultType, [avalue(), getType(r)], [writer, translate(exp)], exp@\loc);
+	       append muPrim("splice_", resultType, [avalue(), getType(r)], [writer, translate(exp)], exp.src);
 	    } else {
-	      append muPrim("add__writer", resultType, [avalue(), getType(r)], [writer, translate(r)], r@\loc);
+	      append muPrim("add__writer", resultType, [avalue(), getType(r)], [writer, translate(r)], r.src);
 	    }
 	  }
 }
@@ -1092,9 +1092,9 @@ private MuExp translateComprehension(c: (Comprehension) `[ <{Expression ","}+ re
     //iprintln(btscopes);
     return
         muValueBlock(resultType,
-                     [ muConInit(writer, muPrim("open_list_writer", avalue(), [], [], c@\loc)),
+                     [ muConInit(writer, muPrim("open_list_writer", avalue(), [], [], c.src)),
                        translateAndConds(btscopes, conds, muBlock(translateComprehensionContribution("list", resultType, writer, [r | r <- results])), muBlock([])),
-                       muPrim("close_list_writer", getType(c), [avalue()], [writer], c@\loc)
+                       muPrim("close_list_writer", getType(c), [avalue()], [writer], c.src)
                      ]);
 }
 
@@ -1108,9 +1108,9 @@ private MuExp translateComprehension(c: (Comprehension) `{ <{Expression ","}+ re
     //iprintln(btscopes);
     return
         muValueBlock(resultType,
-                     [ muConInit(writer, muPrim("open_set_writer", avalue(), [], [], c@\loc)),
+                     [ muConInit(writer, muPrim("open_set_writer", avalue(), [], [], c.src)),
                       translateAndConds(btscopes, conds, muBlock(translateComprehensionContribution("set", resultType, writer, [r | r <- results])), muBlock([])),
-                      muPrim("close_set_writer", getType(c), [avalue()], [writer], c@\loc)
+                      muPrim("close_set_writer", getType(c), [avalue()], [writer], c.src)
                     ]);
 }
 
@@ -1123,9 +1123,9 @@ private MuExp translateComprehension(c: (Comprehension) `( : _writer", avalue(), [], [], e@\loc);
+       kindwriter_open_code = muPrim("open__writer", avalue(), [], [], e.src);
 
        enterWriter(writer.name);
        code = [ muConInit(writer, kindwriter_open_code) ];
        for(elem <- es){
            if(elem is splice){
-              code += muPrim("splice_", avoid(), [avalue(), getType(elem)], [writer, translate(elem.argument)], elem.argument@\loc);
+              code += muPrim("splice_", avoid(), [avalue(), getType(elem)], [writer, translate(elem.argument)], elem.argument.src);
             } else {
-              code += muPrim("add__writer", avoid(), [avalue(), elmType], [writer, translate(elem)], elem@\loc);
+              code += muPrim("add__writer", avoid(), [avalue(), elmType], [writer, translate(elem)], elem.src);
            }
        }
-       code += [ muPrim("close__writer", getType(e), [avalue()], [ writer ], e@\loc) ];
+       code += [ muPrim("close__writer", getType(e), [avalue()], [ writer ], e.src) ];
        leaveWriter();
        return muValueBlock(getType(e), code);
     } else {
       //if(size(es) == 0 || all(elm <- es, isConstant(elm))){
       //   return kind == "list" ? muCon([getConstantValue(elm) | elm <- es]) : muCon({getConstantValue(elm) | elm <- es});
       //} else
-        return muPrim("create_", getType(e), [elmType], [ translate(elem) | Expression elem <- es ], e@\loc);
+        return muPrim("create_", getType(e), [elmType], [ translate(elem) | Expression elem <- es ], e.src);
     }
 }
 
@@ -1188,7 +1188,7 @@ MuExp translate (e:(Expression) `\< <{Expression ","}+ elements> \>`) {
     //if(isConstant(e)){
     //  return muCon(readTextValueString(""));
     //} else
-        return muPrim("create_tuple", getType(e), [ getType(elem) | Expression elem <- elements], [ translate(elem) | Expression elem <- elements ], e@\loc);
+        return muPrim("create_tuple", getType(e), [ getType(elem) | Expression elem <- elements], [ translate(elem) | Expression elem <- elements ], e.src);
 }
 
 // -- map expression ------------------------------------------------
@@ -1198,7 +1198,7 @@ MuExp translate (e:(Expression) `( <{Mapping[Expression] ","}* mappings> )`) {
    //  return muCon(readTextValueString(""));
    //} else
    mapType = getType(e);
-   return muPrim("create_map", mapType, [mapType.keyType, mapType.valType], [ translate(m.from), translate(m.to) | m <- mappings ], e@\loc);
+   return muPrim("create_map", mapType, [mapType.keyType, mapType.valType], [ translate(m.from), translate(m.to) | m <- mappings ], e.src);
 }
 
 // -- it expression (in reducer) ------------------------------------
@@ -1218,15 +1218,15 @@ MuExp translateBool((Expression) ``, BTSCOPES btscopes, MuExp t
     translateBool(v, btscopes, trueCont, falseCont);
 
 MuExp translate((QualifiedName) ``) =
-    mkVar(prettyPrintName(v), v@\loc);
+    mkVar(prettyPrintName(v), v.src);
 
 MuExp translateBool((QualifiedName) ``, BTSCOPES _btscopes, MuExp trueCont, MuExp falseCont) =
-    muIfExp(mkVar(prettyPrintName(v), v@\loc), trueCont, falseCont);
+    muIfExp(mkVar(prettyPrintName(v), v.src), trueCont, falseCont);
 
 // For the benefit of names in regular expressions
 
 MuExp translate((Name) ``) =
-    mkVar(unescape(""), name@\loc);
+    mkVar(unescape(""), name.src);
 
 // -- subscript expression ------------------------------------------
 // Comes in 2 flavours:
@@ -1240,7 +1240,7 @@ MuExp translate(Expression e:(Expression) ` [ <{Expression ","}+
 private MuExp translateSubscript(Expression e:(Expression) ` [ <{Expression ","}+ subscripts> ]`, bool isGuarded){
    op = isGuarded ? "guarded_subscript" : "subscript";
    access = muPrim(op, avalue() /*getType(e)*/, getType(exp) + [getType(s) | s <- subscripts],
-                       translate(exp) + [isWildCard("") ? muCon("_") : translate(s) | Expression s <- subscripts], e@\loc);
+                       translate(exp) + [isWildCard("") ? muCon("_") : translate(s) | Expression s <- subscripts], e.src);
 
    return access;
 }
@@ -1261,7 +1261,7 @@ MuExp translate ((Expression) ` [  . `) {
    ufield = unescape("");
 
    if(isTupleAType(tp) || isRelAType(tp) || isListRelAType(tp) || isMapAType(tp)) {
-       return translateProject(e, expression, [(Field)``], e@\loc, false);
+       return translateProject(e, expression, [(Field)``], e.src, false);
    }
 
    if(isADTAType(tp)){
@@ -1333,7 +1333,7 @@ MuExp translate ((Expression) ` [  =  \< <{Field ","}+ fields> \>`) =
-  translateProject(e, expression, [f | f <- fields], e@\loc, false);
+  translateProject(e, expression, [f | f <- fields], e.src, false);
 
 MuExp translateProject(Expression e, Expression base, list[Field] fields, loc src, bool isGuarded){
     tp = getType(base);
@@ -1413,7 +1413,7 @@ MuExp translate (e:(Expression) `@`) {
 // -- is expression --------------------------------------------------
 
 MuExp translate (e:(Expression) ` is `) =
-    muPrim("is", abool(), [getType(expression)], [translate(expression), muCon(unescape(""))], e@\loc);
+    muPrim("is", abool(), [getType(expression)], [translate(expression), muCon(unescape(""))], e.src);
 
 MuExp translateBool(e:(Expression) ` is `, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont)
     = muIfExp(translate(e),  trueCont, falseCont);
@@ -1490,7 +1490,7 @@ MuExp translateGuarded(exp: (Expression) ` [ <{Expression ","}+
     = translateSubscript(exp, true);
 
 MuExp translateGuarded(exp: (Expression) ` \< <{Field ","}+ fields> \>`)
-    = translateProject(exp, expression, [f | f <- fields], exp@\loc, true);
+    = translateProject(exp, expression, [f | f <- fields], exp.src, true);
 
 MuExp translateGuarded(exp: (Expression) `@`){
    tp = getType(expression);
@@ -1503,11 +1503,11 @@ MuExp translateGuarded(exp: (Expression) `@`){
 }
 
 MuExp translateGuarded(exp: (Expression) ` . `)
-    = translateProject(exp, expression, [(Field)``], exp@\loc, true);
+    = translateProject(exp, expression, [(Field)``], exp.src, true);
     //= muGuardedGetField(getType(exp), getType(expression), translate(expression),  unescape(""));
 
 MuExp translateGuarded(exp: (Expression) ``)
-    = muIsVarKwpDefined(mkVar("", name@\loc));
+    = muIsVarKwpDefined(mkVar("", name.src));
 
 
 // -- isDefinedOtherwise expression ---------------------------------
@@ -1522,7 +1522,7 @@ MuExp translate(e: (Expression) ` ? `) {
 }
 
 MuExp translateBool(e:(Expression) ` ? `, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont)
-    = translateIfDefinedOtherwise(muBlock([translate(lhs), trueCont]), muBlock([translate(rhs), falseCont]), e@\loc);
+    = translateIfDefinedOtherwise(muBlock([translate(lhs), trueCont]), muBlock([translate(rhs), falseCont]), e.src);
 
 
 public MuExp translateIfDefinedOtherwise(MuExp muLHS, MuExp muRHS, loc _src) {
@@ -1632,7 +1632,7 @@ MuExp translate(e:(Expression) `-`)
 // -- splice expression ---------------------------------------------
 
 MuExp translate(e:(Expression) `*`) {
-    throw "Splice `` cannot occur outside set or list at ";
+    throw "Splice `` cannot occur outside set or list at ";
 }
 
 // -- asType expression ---------------------------------------------
@@ -1643,9 +1643,9 @@ MuExp translate(e:(Expression) `[  ] `)  {
                                 [ avalue(), astr(), aloc()],
                                 [ muATypeCon(resultType, collectNeededDefs(resultType)),
    					              translate(argument),
-   					              muCon(argument@\loc)
+   					              muCon(argument.src)
    					            ],
-   					            argument@\loc);
+   					            argument.src);
 }
 
 // -- composition expression ----------------------------------------
@@ -2291,7 +2291,7 @@ MuExp translate(e:(Expression) ` \<==\> `, BTSCO
         return muValueBlock(abool(), [ muConInit(rhs_val, translate(rhs)),
                                        muIfExp(translate(lhs),
                                                rhs_val,
-                                               muPrim("not", abool(), [abool()], [rhs_val], e@\loc))
+                                               muPrim("not", abool(), [abool()], [rhs_val], e.src))
                                      ]);
    }
 
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc
index 207ebe134fc..01cb0aa9f79 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc
@@ -80,9 +80,9 @@ tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmo
       mtags = translateTags(M.header.tags);
       setModuleTags(mtags);
       if(hasIgnoreCompilerTag(mtags)){
-            e = info("Ignore tag suppressed compilation", M.header.name@\loc);
+            e = info("Ignore tag suppressed compilation", M.header.name.src);
             tmodel.messages += [e];
-            return ;
+            return ;
       }
      
       //if(verbose) println("r2mu: entering ... , enableAsserts: ");
@@ -115,7 +115,7 @@ tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmo
    	  				  getVariableInitializationsInModule(),   
    	  				  getCommonKeywordFieldsNameAndType(),
    	  				  getGrammar(),
-   	  				  M@\loc) /*,   
+   	  				  M.src) /*,   
    	  				  reloc,
    	  				  pcfg.srcs)*/
    	  	      >;
@@ -125,11 +125,11 @@ tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmo
         if (compilerConfig.verbose) { println("Parse error in concrete syntax ; returning error module"); }
         msg = error("Parse error in concrete syntax fragment", l);
         tmodel.messages += [msg];
-        return ;
+        return ;
    }
    catch CompileTimeError(Message m): {
         tmodel.messages += [m];
-        return ;
+        return ;
    }
    //catch value e: {
    //     return ", M@\loc)}, M@\loc)>;
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc
index 76d20620cb7..c7304fdcd44 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc
@@ -262,7 +262,7 @@ MuExp translateLitPat(Literal lit, AType _subjectType, MuExp subject, BTSCOPES _
 MuExp translatePat(p:(Pattern) `-`, AType subjectType, MuExp subject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, bool subjectAssigned=false, MuExp restore = muBlock([])) {
     if(pat is literal){
         if(Literal lit := pat.literal && (lit is integer || lit is \real || lit is \rational)){
-            code = muPrim("negative", getType(pat), [getType(lit)], [translate(lit)], p@\loc);
+            code = muPrim("negative", getType(pat), [getType(lit)], [translate(lit)], p.src);
             return muIfElse(muEqual(code, subject), trueCont, falseCont);
         }
     }
@@ -383,7 +383,7 @@ tuple[MuExp exp, list[MuExp] vars] processRegExpLiteral(e: (RegExpLiteral) `/:\>`: {
@@ -408,9 +408,9 @@ tuple[MuExp exp, list[MuExp] vars] processRegExpLiteral(e: (RegExpLiteral) `/; 
    }  
 }
@@ -439,7 +439,7 @@ tuple[MuExp var, list[MuExp] exps] extractNamedRegExp((RegExp) `\<: = getVariableScope("", name@\loc);
+    = getVariableScope("", name.src);
    return ", fuid, pos, astr(), patternVariableId()), exps>;
 }
 
@@ -539,7 +539,7 @@ MuExp translateConcretePattern(e:appl(prod(Symbol::label("parsed",Symbol::lex("C
 // Concrete pattern was not parsed correctly  
 MuExp translateConcretePattern(e:appl(prod(Symbol::label("typed",Symbol::lex("Concrete")), [_],_),[Tree concrete]), 
                    AType _, MuExp subject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, MuExp restore = muBlock([])) 
-  = muValueBlock(avalue(),[muThrow(muCon("(compile-time) parse error in concrete syntax"), e@\loc)]);   
+  = muValueBlock(avalue(),[muThrow(muCon("(compile-time) parse error in concrete syntax"), e.src)]);   
 
 // Parsed Concrete pattern
 
@@ -561,7 +561,7 @@ MuExp translateParsedConcretePattern(appl(prod(Symbol::layouts(_),_,_), _), ATyp
 MuExp translateParsedConcretePattern(appl(prod(Symbol::label("$MetaHole", Symbol _),[Symbol::sort("ConcreteHole")], {\tag("holeType"(Symbol holeType))}), [ConcreteHole hole]),
                         AType patType, AType subjectType, MuExp subjectExp, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, MuExp restore = muBlock([])) {
    holeName = prettyPrintName(hole.name);
-   return isWildCard(holeName) ? trueCont :  muBlock([muVarInit(mkVar(holeName, hole.name@\loc), subjectExp), trueCont]);
+   return isWildCard(holeName) ? trueCont :  muBlock([muVarInit(mkVar(holeName, hole.name.src), subjectExp), trueCont]);
 }
 
 // ---- char
@@ -668,13 +668,13 @@ Symbol getConcreteHoleSymbol(appl(Production::prod(Symbol::label("$MetaHole", Sy
     
 loc getConcreteHoleVarLoc(h: appl(Production _prod, list[Tree] args)) {
 	//println("getConcreteHoleVarLoc: ");
-	if(args[0].args[4].args[0]@\loc?){
+	if(args[0].args[4].args[0].src?){
 	    //iprintln(args[0].args[4].args[0]);
-		return args[0].args[4].args[0]@\loc;
+		return args[0].args[4].args[0].src;
 	}
-	if(args[0].args[4]@\loc?){
+	if(args[0].args[4].src?){
 		println("getConcreteHoleVarLoc: moved up one level to get loc: ");
-		return args[0].args[4]@\loc;
+		return args[0].args[4].src;
 	}
 	println("getConcreteHoleVarLoc: Missing loc:");
 	iprintln(h);
@@ -1008,8 +1008,8 @@ MuExp translatePat(p:(Pattern) ``, AType subjectType, MuExp
    if(isWildCard("")){
       return trueCont;
    }
-   var = mkVar(prettyPrintName(name), name@\loc);
-   if(isDefinition(name@\loc) && !subjectAssigned){
+   var = mkVar(prettyPrintName(name), name.src);
+   if(isDefinition(name.src) && !subjectAssigned){
      //return inlineVar(var, subjectExp, trueCont);
      //return muValueBlock(abool(), [muVarDecl(var), inlineVar(var, subjectExp, trueCont)]);
      //return muValueBlock(abool(), [muVarInit(var, subjectExp), trueCont]);
@@ -1043,7 +1043,7 @@ MuExp translatePat(p:(Pattern) ` `, AType subjectType, MuExp
     	      return trueCont;
     	   }
     	   ppname = prettyPrintName(name);
-    	    = getVariableScope(ppname, name@\loc);
+    	    = getVariableScope(ppname, name.src);
     	   var = muVar(prettyPrintName(name), fuid, pos, trType[alabel=ppname], patternVariableId());
     	   if(isSameVar(var, subjectExp)){
     	       return trueCont;
@@ -1059,7 +1059,7 @@ MuExp translatePat(p:(Pattern) ` `, AType subjectType, MuExp
           return muIfElse(precond, trueCont, falseCont);
        }
        ppname = prettyPrintName(name);
-        = getVariableScope(ppname, name@\loc);
+        = getVariableScope(ppname, name.src);
        var = muVar(prettyPrintName(name), fuid, pos, trType[alabel=ppname], patternVariableId());
        if(isSameVar(var, subjectExp)){
             return muIfElse(precond, trueCont, falseCont);
@@ -1090,7 +1090,7 @@ MuExp translatePat(p:(Pattern) ` `, AType subjectType, MuExp
                 return muIfElse(precond, trueCont, falseCont);
             }
             ppname = prettyPrintName(name);
-             = getVariableScope(ppname, name@\loc);
+             = getVariableScope(ppname, name.src);
             var = muVar(prettyPrintName(name), fuid, pos, trType[alabel=ppname], patternVariableId());
             if(isSameVar(var, subjectExp)){
                 return muIfElse(precond, trueCont, falseCont);
@@ -1161,7 +1161,7 @@ MuExp translatePat(p:(Pattern) ` ( <{Pattern ","}* arguments
        MuExp arg_fail = computeFail(p, lpats, i-1, btscopes, falseCont);
       
        MuExp arg = nonterminal_get_arg
-                 ? muPrim("nonterminal-get-arg", avalue(), [subjectType, aint()], [subject, muCon(i)], lpats[i]@\loc)
+                 ? muPrim("nonterminal-get-arg", avalue(), [subjectType, aint()], [subject, muCon(i)], lpats[i].src)
                  : muSubscript(subject, subjectType, muCon(i))
                  ;
  
@@ -1271,7 +1271,7 @@ BTINFO getBTInfoSet(p:(Pattern) ``, BTSCOPE btscope, BTSCOPE
 }  
 
 MuExp translatePatAsSetElem(p:(Pattern) ``, bool last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont/*, MuExp restore=muBlock([])*/) {
-    return translateVarAsSetElem(mkVar(p), isDefinition(p), p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont/*, restore=restore*/);
+    return translateVarAsSetElem(mkVar(p), isDefinition(p), p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont/*, restore=restore*/);
 }
 
 BTINFO getBTInfoSet(p:(Pattern) ` `, BTSCOPE btscope, BTSCOPES btscopes) {
@@ -1282,7 +1282,7 @@ BTINFO getBTInfoSet(p:(Pattern) ` `, BTSCOPE btscope, BTSCOP
 }
 
 MuExp translatePatAsSetElem(p:(Pattern) ` `, bool last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont/*, MuExp restore=muBlock([])*/) {
-    return translateVarAsSetElem(mkVar(p), isDefinition(p), p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont/*, restore=restore*/);
+    return translateVarAsSetElem(mkVar(p), isDefinition(p), p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont/*, restore=restore*/);
 }
 
 MuExp translateVarAsSetElem(MuExp var, bool isDefinition, loc patloc, bool last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont/*, MuExp restore=muBlock([])*/) {
@@ -1360,16 +1360,16 @@ BTINFO getBTInfoSet(p:(Pattern) `*`, BTSCOPE btscope, BTSCOPES btscop
 
 MuExp translatePatAsSetElem(p:(Pattern) `*`, bool last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont) {
     if("" == "_"){
-        return translateMultiVarAsSetElem(mkVar(p), false, p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
+        return translateMultiVarAsSetElem(mkVar(p), false, p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
     }
-    return translateMultiVarAsSetElem(mkVar(p), isDefinition(name@\loc), p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);  
+    return translateMultiVarAsSetElem(mkVar(p), isDefinition(name.src), p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);  
 }
 
 MuExp translatePatAsSetElem(p:(Pattern) `*`, bool last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont) {
     if("" == "_"){
-        return translateMultiVarAsSetElem(mkVar(p), false, p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
+        return translateMultiVarAsSetElem(mkVar(p), false, p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
     }
-    return translateMultiVarAsSetElem(mkVar(p), isDefinition(name@\loc), p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont); 
+    return translateMultiVarAsSetElem(mkVar(p), isDefinition(name.src), p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont); 
 }
  
 BTINFO getBTInfoSet(p:(Pattern) `* `, BTSCOPE btscope, BTSCOPES btscopes) {
@@ -1385,10 +1385,10 @@ BTINFO getBTInfoSet(p:(Pattern) `* `, BTSCOPE btscope, BTSCO
 
 MuExp translatePatAsSetElem(p:(Pattern) `* `, bool last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont) {
    if("" == "_"){
-    return translateMultiVarAsSetElem(mkVar(p), false, p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
+    return translateMultiVarAsSetElem(mkVar(p), false, p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
    }
    
-   return translateMultiVarAsSetElem(mkVar(p), true, p@\loc, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
+   return translateMultiVarAsSetElem(mkVar(p), true, p.src, last, elmType, subject, prevSubject, btscopes, trueCont, falseCont);
 }
 
 MuExp translateMultiVarAsSetElem(MuExp var, bool isDefinition, loc patsrc, bool _last, AType elmType, MuExp subject, MuExp prevSubject, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont) {
@@ -1486,7 +1486,7 @@ MuExp translatePatAsSetElem(p:(Pattern) ` : `, bool
     forAll_scope = my_btscope.enter+ "_NAMED_SET_ELM";
     code = muForAll(forAll_scope, elem, aset(elmType), prevSubject,
                     translatePat(p, elmType, elem, btscopes, 
-                        muBlock([ muConInit(subject, muPrim("delete", aset(elmType), [aset(elmType), elmType], [prevSubject, elem], p@\loc)),
+                        muBlock([ muConInit(subject, muPrim("delete", aset(elmType), [aset(elmType), elmType], [prevSubject, elem], p.src)),
                                   asgVar
                                 ]),            
                         muFail(forAll_scope)
@@ -1529,7 +1529,7 @@ MuExp translatePatAsSetElem(p:(Pattern) `  : ")|| isDefinition(pat.qualifiedName@\loc); 
+    return isWildCard("")|| isDefinition(pat.qualifiedName.src); 
   } else if(pat is qualifiedName){
-    return isWildCard("") || isDefinition(pat.qualifiedName@\loc);  
+    return isWildCard("") || isDefinition(pat.qualifiedName.src);  
   } else if(pat is typedVariable){
     return true;
   } else 
@@ -1623,7 +1623,7 @@ private bool isDefinition(Pattern pat){
 private bool isDefinedOutsidePat(loc def, Pattern container){
     try {
         defined = getDefinition(def); 
-        return !isContainedIn(defined, container@\loc);     // TODO: adapt
+        return !isContainedIn(defined, container.src);     // TODO: adapt
     } catch: {
          return false;
     }
@@ -1634,17 +1634,17 @@ private bool allVarsDefinedOutsidePat(Pattern pat, Pattern container){
      return allVarsDefinedOutsidePat(pat.argument, container);
   } else if(pat is multiVariable){
         if(isWildCard("")) return false;
-        return isDefinedOutsidePat(pat.qualifiedName@\loc, container);
+        return isDefinedOutsidePat(pat.qualifiedName.src, container);
   } else if(pat is qualifiedName){
         if(isWildCard("")) return false;
-        return isDefinedOutsidePat(pat.qualifiedName@\loc, container);  
+        return isDefinedOutsidePat(pat.qualifiedName.src, container);  
   } else if(pat is typedVariable){
     return false;
   } else {
     bool found = true;
     visit(pat){
-        case (Pattern) ``:  found = found && isDefinedOutsidePat(qualifiedName@\loc, container);
-        case (Pattern) `*`: found = found && isDefinedOutsidePat(qualifiedName@\loc, container);
+        case (Pattern) ``:  found = found && isDefinedOutsidePat(qualifiedName.src, container);
+        case (Pattern) `*`: found = found && isDefinedOutsidePat(qualifiedName.src, container);
     }
     return found;
     }
@@ -1658,31 +1658,31 @@ private MuExp mkVar(Pattern pat){
         if(isWildCard("")){
             return muVar("", topFunctionScope(), -1, avalue(), patternVariableId());
         } else {
-            return mkVar("", pat.qualifiedName@\loc);
+            return mkVar("", pat.qualifiedName.src);
         }
   } else if(pat is qualifiedName){
         if(isWildCard("")){
              return muVar("", topFunctionScope(), -1, avalue(), patternVariableId());
         } else {
-            return mkVar("", pat@\loc);
+            return mkVar("", pat.src);
         }
   } else if(pat is typedVariable){
         if(isWildCard("")){
              return muVar("", topFunctionScope(), -1, getType(pat.name), patternVariableId());
          } else {
-            return mkVar("", pat.name@\loc);
+            return mkVar("", pat.name.src);
          }
   } else if(pat is variableBecomes){
         if(isWildCard("")){
              return muVar("", topFunctionScope(), -1, avalue(), patternVariableId());
         } else {
-            return mkVar("", pat.name@\loc);
+            return mkVar("", pat.name.src);
         }
   } else if(pat is typedVariableBecomes){
         if(isWildCard("")){
             return muVar("", topFunctionScope(), -1, getType(pat.name), patternVariableId());
         } else {
-            return mkVar("", pat.name@\loc);
+            return mkVar("", pat.name.src);
         }
   } else
     throw "mkVar: ";
@@ -1789,12 +1789,12 @@ MuExp translateSetPat(p:(Pattern) `{<{Pattern ","}* _>}`, AType subjectType, MuE
    MuExp fixedParts = muCon({con | muCon(value con) <- fixedLiterals });
     
    for(vp <- fixedVars){
-       fixedParts = muPrim("add", aset(elmType), [aset(elmType), elmType], [fixedParts, mkVar(vp)], p@\loc);
+       fixedParts = muPrim("add", aset(elmType), [aset(elmType), elmType], [fixedParts, mkVar(vp)], p.src);
    }
    for(vp <- fixedMultiVars){
-       fixedParts = muPrim("add", aset(elmType), [aset(elmType), aset(elmType)], [fixedParts, mkVar(vp)], p@\loc);
+       fixedParts = muPrim("add", aset(elmType), [aset(elmType), aset(elmType)], [fixedParts, mkVar(vp)], p.src);
    }
-   subject_minus_fixed = muPrim("subtract", aset(elmType), [aset(elmType), aset(elmType)], [subject, fixed], p@\loc);
+   subject_minus_fixed = muPrim("subtract", aset(elmType), [aset(elmType), aset(elmType)], [subject, fixed], p.src);
    
    MuExp setPatTrueCont =
         isEmpty(subjects) ? ( ( isEmpty(fixedLiterals) && isEmpty(fixedVars) && isEmpty(fixedMultiVars) )
@@ -1818,7 +1818,7 @@ MuExp translateSetPat(p:(Pattern) `{<{Pattern ","}* _>}`, AType subjectType, MuE
         block = setPatTrueCont;
    } else {
         block = muBlock([ muConInit(fixed, fixedParts),
-                          muIfElse(muPrim("subset", aset(elmType), [aset(elmType), aset(elmType)], [fixed, subject], p@\loc),
+                          muIfElse(muPrim("subset", aset(elmType), [aset(elmType), aset(elmType)], [fixed, subject], p.src),
                                    muBlock([ *(leftMostVar <= 0 ? [muAssign(subject, subject_minus_fixed)] : [muConInit(subjects[leftMostVar-1], subject)]),
                                              setPatTrueCont]),
                                    muFail(getFail(my_btscope), comment="set pat5"))
@@ -2112,8 +2112,8 @@ MuExp translatePatAsListElem(p:(Pattern) ``, Lookahead looka
                                ]),
                        falseCont);
     }
-    var = mkVar(prettyPrintName(name), name@\loc);
-    if(isDefinition(name@\loc)){
+    var = mkVar(prettyPrintName(name), name.src);
+    if(isDefinition(name.src)){
         return muIfElse(muLessNativeInt(cursor, sublen),
                         muBlock([ muVarInit(var, muSubscript(subject, subjectType, cursor)),
                                   muIncNativeInt(cursor, muCon(1)), 
@@ -2149,7 +2149,7 @@ MuExp translatePatAsListElem(p:(Pattern) ` `, Lookahead look
       code = muIfElse(check, muBlock([ muIncNativeInt(cursor, muCon(1)), trueCont ]),
                              falseCont);
    } else {
-       var = mkVar(prettyPrintName(name), name@\loc);
+       var = mkVar(prettyPrintName(name), name.src);
        var.atype = getType(tp);
        
        code = muIfElse(check, muBlock([ muVarInit(var, muSubscript(subject, subjectType, cursor)), muIncNativeInt(cursor, muCon(1)), trueCont ]),
@@ -2184,15 +2184,15 @@ bool isUsed(MuExp _var, MuExp _exp){
 }
 
 MuExp translatePatAsListElem(p:(Pattern) `*`, Lookahead lookahead, AType subjectType, MuExp subject, MuExp sublen, MuExp cursor, int posInPat, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, MuExp restore=muBlock([])) {
-    return translateMultiVarAsListElem(mkVar(p), isDefinition(name@\loc), lookahead, subjectType, subject, sublen, cursor, posInPat, getEnter(p, btscopes), trueCont, falseCont, restore=restore);
+    return translateMultiVarAsListElem(mkVar(p), isDefinition(name.src), lookahead, subjectType, subject, sublen, cursor, posInPat, getEnter(p, btscopes), trueCont, falseCont, restore=restore);
 }
 
 MuExp translatePatAsListElem(p:(Pattern) `*`, Lookahead lookahead, AType subjectType, MuExp subject, MuExp sublen, MuExp cursor, int posInPat, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, MuExp restore=muBlock([])) {
-    return translateMultiVarAsListElem(mkVar(p), isDefinition(name@\loc), lookahead, subjectType, subject, sublen, cursor, posInPat, getEnter(p, btscopes), trueCont, falseCont, restore=restore);
+    return translateMultiVarAsListElem(mkVar(p), isDefinition(name.src), lookahead, subjectType, subject, sublen, cursor, posInPat, getEnter(p, btscopes), trueCont, falseCont, restore=restore);
 } 
 
 MuExp translatePatAsListElem(p:(Pattern) `* `, Lookahead lookahead, AType subjectType, MuExp subject, MuExp sublen, MuExp cursor, int posInPat, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, MuExp restore=muBlock([])) {
-    return translateMultiVarAsListElem(mkVar(p), isDefinition(name@\loc), lookahead, subjectType, subject, sublen, cursor, posInPat, getEnter(p, btscopes), trueCont, falseCont, restore=restore);
+    return translateMultiVarAsListElem(mkVar(p), isDefinition(name.src), lookahead, subjectType, subject, sublen, cursor, posInPat, getEnter(p, btscopes), trueCont, falseCont, restore=restore);
 }
 
 MuExp translatePatAsListElem(p:(Pattern) `+`, Lookahead lookahead, AType subjectType, MuExp subject, MuExp sublen, MuExp cursor, int posInPat, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, MuExp restore=muBlock([])) {
@@ -2307,8 +2307,8 @@ MuExp translatePat(p:(Pattern) ` : `, AType subjectT
     if(subjectAssigned){
          return translatePat(pattern, subjectType, subjectExp, btscopes, trueCont, falseCont, subjectAssigned=false, restore=restore);
     } else {
-        var = mkVar(prettyPrintName(name), name@\loc);
-        asg = isDefinition(name@\loc) ? muVarInit(var, subjectExp) : muAssign(var, subjectExp);
+        var = mkVar(prettyPrintName(name), name.src);
+        asg = isDefinition(name.src) ? muVarInit(var, subjectExp) : muAssign(var, subjectExp);
         return translatePat(pattern, subjectType, subjectExp, btscopes, muValueBlock(avalue(), [ asg, trueCont ]), falseCont, subjectAssigned=subjectAssigned, restore=restore);
     }
 }
@@ -2428,7 +2428,7 @@ MuExp translatePat(p:(Pattern) `  : `, ATyp
          return asubtype(subjectType, trType) ? trPat : muIfElse(muValueIsSubtypeOf(subjectExp, trType), trPat, falseCont);
     }
     str fuid = ""; int pos=0;           // TODO: this keeps type checker happy, why?
-     = getVariableScope(prettyPrintName(name), name@\loc);
+     = getVariableScope(prettyPrintName(name), name.src);
     ppname = prettyPrintName(name);
     var = muVar(ppname, fuid, pos, trType/*[alabel=ppname]*/, patternVariableId());
     trueCont2 = trueCont;
@@ -2450,7 +2450,7 @@ default BTINFO getBTInfo(Pattern p, BTSCOPE btscope, BTSCOPES btscopes)
 
 default MuExp translatePat(Pattern p, AType subjectType,  MuExp subjectExp, BTSCOPES btscopes, MuExp trueCont, MuExp falseCont, bool subjectAssigned=false, MuExp restore=muBlock([])) { 
     //iprintln(p);
-    return muValueBlock(avalue(), [muThrow(muCon("could not translate pattern 

: "), p@\loc)]); + return muValueBlock(avalue(), [muThrow(muCon("could not translate pattern

: "), p.src)]); } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalStatement.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalStatement.rsc index fc0e0de78d7..54bfa55a8fd 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalStatement.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalStatement.rsc @@ -80,7 +80,7 @@ MuExp translate(s: (Statement) `assert ;`, BTSCOPES btsc if(assertsEnabled()){ return muIfExp(translate(expression), muCon(true), - muPrim("assert_fails", abool(), [astr()], [muCon("")], s@\loc)); + muPrim("assert_fails", abool(), [astr()], [muCon("")], s.src)); } return muCon(true); } @@ -89,7 +89,7 @@ MuExp translate(s: (Statement) `assert : while ( <{Expression ","}+ conditi if(containsAppend(body)){ writer = muTmpListWriter("listwriter_", fuid); code = muValueBlock(getType(s), - [ muConInit(writer, muPrim("open_list_writer", avalue(), [], [], s@\loc)), + [ muConInit(writer, muPrim("open_list_writer", avalue(), [], [], s.src)), loopBody, - muPrim("close_list_writer", avalue(), [avalue()], [writer], s@\loc) + muPrim("close_list_writer", avalue(), [avalue()], [writer], s.src) ]); } else { //code = loopBody; @@ -215,9 +215,9 @@ MuExp translate(s: (Statement) `

"()[@label=""][@\loc=p@\loc] + c += ["

"()[label=""][src=p.src] | /Prod p := def.production, p is labeled || p is unlabeled, str prefix := (p is labeled ? ": " : "") ]; @@ -97,18 +100,18 @@ node outline(Module m) { } map[node,list[node]] count(map[str,list[node]] m) - = ((!isEmpty(m[k]) ? " ()"()[@\loc=(m[k][0])@\loc] : " ()"()) : m[k] | k <- m); + = ((!isEmpty(m[k]) ? " ()"()[src=(m[k][0]).src] : " ()"()) : m[k] | k <- m); return n( - "Functions"(count(functions))[@label="Functions ()"], - "Tests"(count(tests))[@label="Tests ()"], - "Variables"(variables)[@label="Variables ()"], - "Aliases"(aliases)[@label="Aliases ()"], - "Data"(count(adts))[@label="Data ()"], - "Annotations"(annotations)[@label="Annotations ()"], - "Tags"(tags)[@label="Tags ()"], - "Imports"(imports)[@label="Imports ()"], - "Syntax"(count(grammars))[@label="Syntax ()"] + "Functions"(count(functions))[label="Functions ()"], + "Tests"(count(tests))[label="Tests ()"], + "Variables"(variables)[label="Variables ()"], + "Aliases"(aliases)[label="Aliases ()"], + "Data"(count(adts))[label="Data ()"], + "Annotations"(annotations)[label="Annotations ()"], + "Tags"(tags)[label="Tags ()"], + "Imports"(imports)[label="Imports ()"], + "Syntax"(count(grammars))[label="Syntax ()"] ); } diff --git a/src/org/rascalmpl/library/lang/rascal/scrap/Patch.rsc b/src/org/rascalmpl/library/lang/rascal/scrap/Patch.rsc index 2d97d631e04..aa6b5421ce2 100644 --- a/src/org/rascalmpl/library/lang/rascal/scrap/Patch.rsc +++ b/src/org/rascalmpl/library/lang/rascal/scrap/Patch.rsc @@ -17,7 +17,7 @@ lrel[loc, str] commands2patch(start[Commands] pt) { // don't evaluate commands that represent output cmds = [ "" | c <- pt.top.commands, !(c is output) ]; - results = evalCommands(cmds, pt@\loc); + results = evalCommands(cmds, pt.src); patch = []; @@ -46,7 +46,7 @@ lrel[loc, str] commands2patch(start[Commands] pt) { // if there's a change in output, add a tuple // to the patch. if (new != "" && trim(old) != trim(new)) { - org = args[i]@\loc; + org = args[i].src; at = org.offset + org.length; l = org[offset=at][length=0]; // insert patch += []; @@ -60,7 +60,7 @@ lrel[loc, str] commands2patch(start[Commands] pt) { else { if (change) { // only remove previous output nodes if there was a change - patch += []; + patch += []; } // output commands are not evaluated by evalCommands above; @@ -73,7 +73,7 @@ lrel[loc, str] commands2patch(start[Commands] pt) { if (addedSpace && change && startsWith(l, " ")) { // if a leading space was added in the case of changed output, // remove it here. Otherwise leave the layout unchanged. - org = args[i]@\loc; + org = args[i].src; patch += []; addedSpace = false; } diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/Booleans.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/Booleans.rsc index c090f0efdcb..7a3d2cb0aa2 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/Booleans.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/Booleans.rsc @@ -423,12 +423,13 @@ test bool compositeEquivBothBTCnt() { data AnotherAndData = a(); -anno list[int] AnotherAndData@l; + +data AnotherAndData(list[int] l = []); test bool anotherAnd() { - v = a()[@l = [1,2,3]]; + v = a()[l=[1,2,3]]; list[list[int]] res = []; - if(v@l? && [*int x,*int y] := v@l) { + if(v.l? && [*int x,*int y] := v.l) { res = res + [ x, y ]; fail; } diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/Functions.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/Functions.rsc index 7b0994c5501..cc2bd3dc65f 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/Functions.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/Functions.rsc @@ -8,7 +8,7 @@ data B = and(B lhs, B rhs) | or(B lhs, B rhs) | t() | f(); B and(B b1, and(B b2, B b3)) = and(and(b1,b2),b3); -value callDelAnnotations() = delAnnotations("f"(1,2,3)); +value callDelAnnotations() = unset("f"(1,2,3)); test bool testCallWithTypeParameterBound() = callDelAnnotations() == "f"(1,2,3); diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/IsDefined.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/IsDefined.rsc index 1f3aa5b83e4..178a39c03e3 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/IsDefined.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/IsDefined.rsc @@ -243,41 +243,42 @@ test bool tst() { int x = 10; y = x ? 1; return y == 10; } // Annotations data F = f3() | f3(int n) | g(int n) | deep(F f); -anno int F@pos; + +data F(int pos = 10); -test bool isDefinedAnno1() = (f3()[@pos=1])@pos?; +test bool isDefinedAnno1() = (f3()[pos=1]).pos?; -test bool isDefinedAnno2() = !(f3()@pos)?; +test bool isDefinedAnno2() = !(f3().pos)?; -test bool isDefinedAnno3() = ((f3()[@pos=1])@pos ? 10) == 1; +test bool isDefinedAnno3() = ((f3()[pos=1]).pos) == 1; -test bool isDefinedAnno4() = ((f3())@pos ? 10) == 10; +test bool isDefinedAnno4() = ((f3()).pos) == 10; test bool isDefinedAnno5(){ X = f3(); - X@pos ? 0 += 1; - return X@pos == 1; + X.pos ? 0 += 1; + return X.pos == 1; } test bool isDefinedAnno6(){ - X = f3()[@pos=1]; - X@pos ? 0 += 1; - return X@pos == 2; + X = f3()[pos=1]; + X.pos ? 0 += 1; + return X.pos == 2; } test bool isDefinedAnno7(){ X = f3(); - X@pos ?= 3; - return X@pos == 3; + X.pos ?= 3; + return X.pos == 3; } test bool isDefinedAnno8(){ - X = f3()[@pos = 1]; - X@pos ?= 3; - return X@pos == 1; + X = f3()[pos=1]; + X.pos ?= 3; + return X.pos == 1; } -test bool isDefinedAnno9() = f3()[@pos = 1] has pos; +test bool isDefinedAnno9() = f3()[pos=1] has pos; // TODO we can not tell this anymore since annotations are now simulated using keyword parameters. // the keyword parameter "is" always there due to their semantics of having defaults.. diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/RepositionTree.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/RepositionTree.rsc index ea147b5afac..ff0b575909d 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/RepositionTree.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/RepositionTree.rsc @@ -7,7 +7,7 @@ import String; loc facPico = |project://rascal/src/org/rascalmpl/library/lang/pico/examples/fac.pico|; -private list[loc] collect(Tree t) = [s@\loc | /Tree s := t, s@\loc?]; +private list[loc] collect(Tree t) = [s.src | /Tree s := t, s.src?]; test bool repositionSimulatesReparse() { t1 = parse(#start[Program], facPico); @@ -39,7 +39,7 @@ test bool charsFromLeftToRight() { t1 = parse(#start[Program], facPico); t2 = reposition(t1, markChar=true); allChars = [ch | /ch:char(_) := t2]; - sortedChars = sort(allChars, bool (Tree c1, Tree c2) { return c1@\loc.offset < c2@\loc.offset;}); + sortedChars = sort(allChars, bool (Tree c1, Tree c2) { return c1.src.offset < c2.src.offset;}); return allChars == sortedChars; } \ No newline at end of file diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/Sets.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/Sets.rsc index 2b25b92cb0a..4e2eaf4923e 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/Sets.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/Sets.rsc @@ -144,7 +144,8 @@ test bool tst_toList(set[int] S) = isEmpty(S) || size(S) == size(toList(S)) && a test bool tst_toMap(rel[int, int] S) = isEmpty(S) || domain(S) == domain(toMap(S)) && range(S) == {*toMap(S)[k] | k <- toMap(S)}; data X = y(int y); -anno int X@z; + +data X(int z = 0); test bool tst_toMapUnique(set[int] D, set[int] R) { if(isEmpty(D) || isEmpty(R)) return true; diff --git a/src/org/rascalmpl/library/lang/rascal/tests/concrete/Locations.rsc b/src/org/rascalmpl/library/lang/rascal/tests/concrete/Locations.rsc index e0bb0a266f4..449b3cd8b86 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/concrete/Locations.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/concrete/Locations.rsc @@ -45,28 +45,28 @@ test bool parsedExpressionsHaveSourceLocations2c() = ([E] "(a+(a*a))").src.length == 9; test bool concreteExpressionsHaveSourceLocationsLegacy1a() - = (A) `a`@\loc?; + = (A) `a`.src?; test bool parsedExpressionsHaveSourceLocationsLegacy1a() - = ([A] "a")@\loc?; + = ([A] "a").src?; test bool concreteExpressionsHaveSourceLocationsLegacy1b() - = (E) `(a+a)`@\loc?; + = (E) `(a+a)`.src?; test bool parsedExpressionsHaveSourceLocationsLegacy1b() - = ([E] "(a+a)")@\loc?; + = ([E] "(a+a)").src?; test bool concreteExpressionsHaveSourceLocationsLegacy1c() - = (E) `(a+(a*a))`@\loc?; + = (E) `(a+(a*a))`.src?; test bool parsedExpressionsHaveSourceLocationsLegacy1c() - = ([E] "(a+(a*a))")@\loc?; + = ([E] "(a+(a*a))").src?; test bool concreteExpressionsSourceLocationsLengthLegacy1a() - = (A) `a`@\loc.length == 1; + = (A) `a`.src.length == 1; test bool parsedExpressionsSourceLocationsLengthLegacy1a() - = ([A] "a")@\loc.length == 1; + = ([A] "a").src.length == 1; test bool concreteExpressionsSourceLocationsLength2a() = (E) `(a+a)`.src.length == 5; @@ -100,7 +100,7 @@ test bool concreteExpressionsAssignSourceLocation1() { test bool concreteExpressionsAssignSourceLocationLegacy1() { x = (A) `a`; - y = x@\loc[length = 100]; + y = x.src[length = 100]; return y.length == 100; } @@ -111,7 +111,7 @@ test bool concreteExpressionsHaveSourceLocationsAfterVisitWithMatch() { case int i => i + 1 } - return t@\loc?; + return t.src?; } test bool concreteExpressionsHaveSourceLocationsAfterVisitWithNoMatch() { @@ -119,6 +119,6 @@ test bool concreteExpressionsHaveSourceLocationsAfterVisitWithNoMatch() { case 1239461234912634 => 123498761234896123 } - return t@\loc?; + return t.src?; } diff --git a/src/org/rascalmpl/library/lang/rascal/tests/concrete/Patterns3.rsc b/src/org/rascalmpl/library/lang/rascal/tests/concrete/Patterns3.rsc index 3c0b2ef1731..746a2227d3f 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/concrete/Patterns3.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/concrete/Patterns3.rsc @@ -85,11 +85,7 @@ appl( {}), [appl( regular(\iter-star(lex("LAYOUT"))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,0,<9,9>,<9,9>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,0,<9,9>,<9,9>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,0,<9,9>,<9,9>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,0,<9,9>,<9,9>)],appl( prod( label( "nonterminal", @@ -150,15 +146,7 @@ appl( range(95,95), range(97,122) ]))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(123,0,<9,10>,<9,10>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,1,<9,9>,<9,10>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,1,<9,9>,<9,10>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,1,<9,9>,<9,10>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(123,0,<9,10>,<9,10>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,1,<9,9>,<9,10>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,1,<9,9>,<9,10>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(122,1,<9,9>,<9,10>)],appl( prod( layouts("LAYOUTLIST"), [conditional( @@ -183,11 +171,7 @@ appl( {}), [appl( regular(\iter-star(lex("LAYOUT"))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(123,0,<9,10>,<9,10>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(123,0,<9,10>,<9,10>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(123,0,<9,10>,<9,10>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(123,0,<9,10>,<9,10>)],appl( prod( lit(")"), [\char-class([range(41,41)])], @@ -234,13 +218,7 @@ appl( range(12288,12288) ])], {}), - [char(32)])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(124,1,<9,11>,<9,12>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(124,1,<9,11>,<9,12>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(124,1,<9,11>,<9,12>) - ],appl( + [char(32)])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(124,1,<9,11>,<9,12>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(124,1,<9,11>,<9,12>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(124,1,<9,11>,<9,12>)],appl( prod( lit("`"), [\char-class([range(96,96)])], @@ -305,11 +283,7 @@ appl( {}), [appl( regular(\iter-star(lex("LAYOUT"))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,0,<9,14>,<9,14>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,0,<9,14>,<9,14>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,0,<9,14>,<9,14>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,0,<9,14>,<9,14>)],appl( prod( label( "nonterminal", @@ -370,15 +344,7 @@ appl( range(95,95), range(97,122) ]))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,0,<9,15>,<9,15>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,0,<9,15>,<9,15>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>)],appl( prod( layouts("LAYOUTLIST"), [conditional( @@ -420,13 +386,7 @@ appl( range(12288,12288) ])], {}), - [char(32)])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,1,<9,15>,<9,16>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,1,<9,15>,<9,16>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,1,<9,15>,<9,16>) - ],appl( + [char(32)])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,1,<9,15>,<9,16>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,1,<9,15>,<9,16>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,1,<9,15>,<9,16>)],appl( prod( lex("Name"), [conditional( @@ -492,13 +452,7 @@ appl( range(95,95), range(97,122) ]))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>)],appl( prod( layouts("LAYOUTLIST"), [conditional( @@ -523,29 +477,17 @@ appl( {}), [appl( regular(\iter-star(lex("LAYOUT"))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>)],appl( prod( lit("\>"), [\char-class([range(62,62)])], {}), - [char(62)])])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(126,5,<9,13>,<9,18>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(126,5,<9,13>,<9,18>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(126,5,<9,13>,<9,18>) - ],appl( + [char(62)])])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(126,5,<9,13>,<9,18>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(126,5,<9,13>,<9,18>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(126,5,<9,13>,<9,18>)],appl( prod( lit("`"), [\char-class([range(96,96)])], {}), - [char(96)])])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(121,11,<9,8>,<9,19>) -]; + [char(96)])])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(121,11,<9,8>,<9,19>)]; rel[Tree,Tree] ThePsList = {,<9,15>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>) - ],appl( + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(128,0,<9,15>,<9,15>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(127,1,<9,14>,<9,15>)],appl( prod( lex("Name"), [conditional( @@ -683,10 +617,4 @@ rel[Tree,Tree] ThePsList = range(95,95), range(97,122) ]))), - [])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>) - ]])[ - @\loc=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>) - ]>}; + [])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(130,0,<9,17>,<9,17>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>)]])[src=|project://rascal/src/org/rascalmpl/library/experiments/Compiler/Examples/Tst2.rsc|(129,1,<9,16>,<9,17>)]>}; diff --git a/src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax5.rsc b/src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax5.rsc index 951b00d538a..5f05c722b93 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax5.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax5.rsc @@ -20,7 +20,7 @@ test bool concreteFragmentHasSrc() test bool concreteFragmentHasLegacyLoc() = e:(Expression) ` + ` := (Expression) `1 + 2` && - e@\loc? && x@\loc?; + e.src? && x.src?; test bool concreteFragmentHasCorrectSrcs() = e:(Expression) ` + ` := (Expression) `1 + 2` && diff --git a/src/org/rascalmpl/library/lang/rascal/tests/concrete/SyntaxKeywordFields.rsc b/src/org/rascalmpl/library/lang/rascal/tests/concrete/SyntaxKeywordFields.rsc index 91986edf554..d0290e58f0d 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/concrete/SyntaxKeywordFields.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/concrete/SyntaxKeywordFields.rsc @@ -1,12 +1,11 @@ module lang::rascal::tests::concrete::SyntaxKeywordFields -import Node; import ParseTree; syntax A = "a"; syntax B = "b" | [b]; // ambiguous on purpose -// we only allow declarations on Tree for now, for lack of a syntax to declare them on non-terminals. +// we only allow keyword parameters on Tree for now, for lack of a syntax to declare them on non-terminals. data Tree(str y = "y"); &T<:Tree get(&T<:Tree e) = e; diff --git a/src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/MultiErrorBug.rsc b/src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/MultiErrorBug.rsc index 94c135b89b9..f026006337c 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/MultiErrorBug.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/bugs/MultiErrorBug.rsc @@ -48,7 +48,7 @@ bool multiErrorBug() { println(" Errors"); for (Tree error <- errors) { Tree skipped = getSkipped(error); - println(" : "); + println(" : "); } Tree disambiguated = disambiguateParseErrors(t); list[Tree] disambiguatedErrors = findAllParseErrors(disambiguated); @@ -56,7 +56,7 @@ bool multiErrorBug() { println(" Errors"); for (Tree error <- disambiguatedErrors) { Tree skipped = getSkipped(error); - println(" : "); + println(" : "); } return true; } diff --git a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Annotation.rsc b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Annotation.rsc index ef5934d502a..e4b7f6aa330 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Annotation.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Annotation.rsc @@ -7,30 +7,33 @@ } @contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} @contributor{Paul Klint - Paul.Klint@cwi.nl - CWI} +@synopsis{The old annotation feature has been replaced by the keyword field feature, but we kept the tests for reference.} module lang::rascal::tests::functionality::Annotation import Exception; data F = f() | f(int n) | g(int n) | deep(F f); -anno int F@pos; + +data F(int pos = 0); data AN = an(int n); -anno int F@notThere; + +data F(int notThere = 0); // boolannotations -test bool boolannotations1() = true || /*documentation of old behavior: */ f() [@pos=1] == f(); -test bool boolannotations2() = f() [@pos=1]@pos == 1; -test bool boolannotations3() = f() [@pos=1][@pos=2]@pos == 2; +test bool boolannotations1() = true || /*documentation of old behavior: */ f()[pos=1] == f(); +test bool boolannotations2() = f()[pos=1].pos == 1; +test bool boolannotations3() = f()[pos=1][pos=2].pos == 2; // since annotations are simulated by kw params this is no longer true: -test bool boolannotations4() = true || /*documentation of old behavior: */ f(5) [@pos=1] == f(5); -test bool boolannotations5() = true || /*documentation of old behavior: */ f(5) [@pos=1]@pos == 1; -test bool boolannotations6() = true || /*documentation of old behavior: */ f(5) [@pos=1][@pos=2]@pos == 2; +test bool boolannotations4() = true || /*documentation of old behavior: */ f(5)[pos=1] == f(5); +test bool boolannotations5() = true || /*documentation of old behavior: */ f(5)[pos=1].pos == 1; +test bool boolannotations6() = true || /*documentation of old behavior: */ f(5)[pos=1][pos=2].pos == 2; // since annotations are simulated by kw params this is no longer true -test bool boolannotations7() = true || /*documentation of old behavior: */ deep(f(5) [@pos=1]) == deep(f(5)); -test bool boolannotations8() = true || /*documentation of old behavior: */ f(5) [@pos=1] == f(5) [@pos=2]; +test bool boolannotations7() = true || /*documentation of old behavior: */ deep(f(5)[pos=1]) == deep(f(5)); +test bool boolannotations8() = true || /*documentation of old behavior: */ f(5)[pos=1] == f(5)[pos=2]; // annotationsInSets // since annotations are simulated by kw params this is no longer true: @@ -44,21 +47,21 @@ test bool boolannotations8() = true || /*documentation of old behavior: */ f(5) @ignoreCompiler{Annotations are not supported as keyword field} test bool accessAnnoAsKeywordField(){ F example = f(); - example@pos = 1; + example.pos = 1; return example.pos == 1; } @ignoreCompiler{Annotations are not supported as keyword field} test bool accessAnnoUpdateAsKeywordField(){ F example = f(); - example@pos = 1; - return example[@pos=2].pos == 2; + example.pos = 1; + return example[pos=2].pos == 2; } @ignoreCompiler{Annotations are not supported as keyword field} test bool checkAnnoExistsAsKeywordField(){ F example = f(); - example@pos = 1; + example.pos = 1; return example.pos?; } @@ -67,33 +70,28 @@ test bool checkAnnoExistsAsKeywordField(){ test bool KeywordFieldUpdateVisibleAsAnno(){ F example = f(); // keyword updates are visible to anno projection - return example[pos=3]@\pos == 3; + return example[pos=3].\pos == 3; } @ignoreCompiler{Annotations are not supported as keyword field} test bool KeywordAssignVisibleViaAnno1(){ F example = f(); - example@pos = 1; + example.pos = 1; example.pos = 4; - return example@pos == 4; + return example.pos == 4; } @ignoreCompiler{Annotations are not supported as keyword field} test bool KeywordAssignVisibleViaAnno2(){ F example = f(); - example@pos = 1; + example.pos = 1; example.pos += 4; - return example@pos == 5; + return example.pos == 5; } test bool unavailableAnno1(){ F example = f(); - try { - example@notThere; - return false; - } - catch NoSuchAnnotation("notThere"): - return true; + return example.notThere == 0 && !(example.notThere?); } test bool unavailableAnno2(){ @@ -105,7 +103,8 @@ test bool unavailableAnno2(){ x.notThere; return false; } - catch NoSuchField("notThere"): - return true; + catch NoSuchField("notThere") : + // TODO: where annotations would often throw exceptions, keyword fields return their default. + return true; } diff --git a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Assignment.rsc b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Assignment.rsc index ef9a641ab5c..129ad342c1a 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Assignment.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Assignment.rsc @@ -1,3 +1,4 @@ + module lang::rascal::tests::functionality::Assignment import Exception; @@ -95,23 +96,24 @@ test bool testADT33() { D d = intfield(5); d.i *= 3; return d == intfield(15); } test bool testADT34() { D d = intfield(6); d.i /= 3; return d == intfield(2); } data F = f() | f(int n) | g(int n) | deep(F f); -anno int F@pos; + +data F(int pos = 0); -// testAnnotations +// testAnnotations (the annotation syntax has been replaced by keywordparameters but we have kept the tests for reference.) -test bool testAnnotations1() { F X = f(); X@pos = 1; return X@pos == 1; } +test bool testAnnotations1() { F X = f(); X.pos = 1; return X.pos == 1; } -test bool testAnnotations2() { X = f(); X@pos = 2; X@pos += 3; return X@pos == 5; } +test bool testAnnotations2() { X = f(); X.pos = 2; X.pos += 3; return X.pos == 5; } -test bool testAnnotations3() { X = f(); X@pos = 3; X@pos -= 2; return X@pos == 1; } +test bool testAnnotations3() { X = f(); X.pos = 3; X.pos -= 2; return X.pos == 1; } -test bool testAnnotations4() { X = f(); X@pos = 2; X@pos *= 3; return X@pos == 6; } +test bool testAnnotations4() { X = f(); X.pos = 2; X.pos *= 3; return X.pos == 6; } -test bool testAnnotations5() { X = f(); X@pos = 6; X@pos /= 3; return X@pos == 2; } +test bool testAnnotations5() { X = f(); X.pos = 6; X.pos /= 3; return X.pos == 2; } -test bool testAnnotations6() { X = f(); X@pos = 6; X@pos ?= 3; return X@pos == 6; } +test bool testAnnotations6() { X = f(); X.pos = 6; X.pos ?= 3; return X.pos == 6; } -test bool testAnnotations7() { X = f(); X@pos ?= 3; return X@pos == 3; } +test bool testAnnotations7() { X = f(); X.pos ?= 3; return X.pos == 3; } // assigningClosureToVariableBug877 diff --git a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit1.rsc b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit1.rsc index 891b3606f4e..06d1b6b4e08 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit1.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit1.rsc @@ -597,12 +597,13 @@ test bool order4()= order(h1(f1(1),g1([h1(f1(2),f1(3)),f1(4),f1(5)]))) == [1,2,3 data NODE = nd(NODE left, NODE right) | leaf(int n); -anno int NODE@pos; + +data NODE(int pos = 0); -NODE N1 = nd(leaf(0)[@pos=0], leaf(1)[@pos=1])[@pos=2]; +NODE N1 = nd(leaf(0)[pos=0], leaf(1)[pos=1])[pos=2]; test bool visitWithAnno1() { - return visit(leaf(1)[@pos=1]){ + return visit(leaf(1)[pos=1]){ case leaf(1) => leaf(10) default:; } @@ -624,7 +625,7 @@ test bool visitWithAnno3() { default:; } == - nd(leaf(0)[@pos=0], leaf(10))[@pos=2]; + nd(leaf(0)[pos=0], leaf(10))[pos=2]; } test bool visitWithAnno4() { @@ -634,7 +635,7 @@ test bool visitWithAnno4() { default:; } == - nd(leaf(0), leaf(10))[@pos=2]; + nd(leaf(0), leaf(10))[pos=2]; } test bool visitWithAnno5() { @@ -649,19 +650,19 @@ test bool visitWithAnno5() { } public &T delAnnotationsRec1(&T v) = visit(v) { - case node n => delAnnotations(n) + case node n => unset(n) }; public &T delAnnotationsRec2(&T v) = visit(v) { - case node n: { insert delAnnotations(n); } + case node n: { insert unset(n); } }; public NODE A1 = leaf(3); -public NODE A2 = leaf(3)[@pos = 1]; +public NODE A2 = leaf(3)[pos=1]; -test bool visitWithAnno6() = !delAnnotationsRec1(A2)@pos?; +test bool visitWithAnno6() = !delAnnotationsRec1(A2).pos?; -test bool visitWithAnno7() = !delAnnotationsRec2(A2)@pos?; +test bool visitWithAnno7() = !delAnnotationsRec2(A2).pos?; // StringVisit1a diff --git a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit2.rsc b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit2.rsc index 7e188a690a6..b819a46fda8 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit2.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/functionality/Visit2.rsc @@ -3,40 +3,23 @@ module lang::rascal::tests::functionality::Visit2 import Grammar; import ParseTree; -anno int Symbol@id; + +data Symbol(int id = 0); Grammar G0 = grammar( - {sort("S")[ - @id=2 - ]}, + {sort("S")[id=2]}, ( - sort("S")[ - @id=3 - ]:choice( - sort("S")[ - @id=4 - ], + sort("S")[id=3]:choice( + sort("S")[id=4], {prod( - sort("S")[ - @id=5 - ], - [lit("0")[ - @id=6 - ]], + sort("S")[id=5], + [lit("0")[id=6]], {})}), - lit("0")[ - @id=7 - ]:choice( - lit("0")[ - @id=8 - ], + lit("0")[id=7]:choice( + lit("0")[id=8], {prod( - lit("0")[ - @id=9 - ], - [\char-class([range(48,48)])[ - @id=10 - ]], + lit("0")[id=9], + [\char-class([range(48,48)])[id=10]], {})}) )); diff --git a/src/org/rascalmpl/library/lang/rascal/tests/library/Node.rsc b/src/org/rascalmpl/library/lang/rascal/tests/library/Node.rsc index 95ccda6cd5c..96e9fb1ef54 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/library/Node.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/library/Node.rsc @@ -18,52 +18,54 @@ test bool arity3() = arity(xf(1,2)) == 2; // delAnnotation data ANODE = leaf(int n) | a(ANODE left, ANODE right); -anno int ANODE@pos; -anno str ANODE@label; + +data ANODE(int pos = 0); + +data ANODE(str label = ""); public ANODE A1 = leaf(3); -public ANODE A2 = leaf(3)[@pos = 1][@label="a"]; -public ANODE A3 = a(leaf(10)[@pos = 1][@label="a"], leaf(20)[@pos=2][@label="b"])[@pos=3][@label="c"]; +public ANODE A2 = leaf(3)[pos=1][label="a"]; +public ANODE A3 = a(leaf(10)[pos=1][label="a"], leaf(20)[pos=2][label="b"])[pos=3][label="c"]; -test bool delAnnotation1() = !delAnnotation(A1, "pos")@pos?; -test bool delAnnotation2() = !delAnnotation(A2, "pos")@pos?; -test bool delAnnotation3() = delAnnotation(A2, "pos")@label == "a"; -test bool delAnnotation4() = !delAnnotation(A3, "pos")@pos?; -test bool delAnnotation5() = delAnnotation(A3, "pos")@label == "c"; +test bool delAnnotation1() = !delAnnotation(A1, "pos").pos?; +test bool delAnnotation2() = !delAnnotation(A2, "pos").pos?; +test bool delAnnotation3() = delAnnotation(A2, "pos").label == "a"; +test bool delAnnotation4() = !delAnnotation(A3, "pos").pos?; +test bool delAnnotation5() = delAnnotation(A3, "pos").label == "c"; // delAnnotations -test bool delAnnotations1() = !delAnnotations(A1)@pos?; -test bool delAnnotations2() = !delAnnotations(A1)@label?; +test bool delAnnotations1() = !unset(A1).pos?; +test bool delAnnotations2() = !unset(A1).label?; -test bool delAnnotations3() = !delAnnotations(A2)@pos?; -test bool delAnnotations4() = !delAnnotations(A2)@label?; +test bool delAnnotations3() = !unset(A2).pos?; +test bool delAnnotations4() = !unset(A2).label?; -test bool delAnnotations5() = !delAnnotations(A3)@pos?; -test bool delAnnotations6() = !delAnnotations(A3)@label?; +test bool delAnnotations5() = !unset(A3).pos?; +test bool delAnnotations6() = !unset(A3).label?; -test bool delAnnotations7() = ANODE n := delAnnotations(A3)[0] && n@pos == 1; -test bool delAnnotations8() = ANODE n := delAnnotations(A3)[0] && n@label == "a"; +test bool delAnnotations7() = ANODE n := unset(A3)[0] && n.pos == 1; +test bool delAnnotations8() = ANODE n := unset(A3)[0] && n.label == "a"; -test bool delAnnotations9() = ANODE n := delAnnotations(A3)[1] && n@pos == 2; -test bool delAnnotations10() = ANODE n := delAnnotations(A3)[1] && n@label == "b"; +test bool delAnnotations9() = ANODE n := unset(A3)[1] && n.pos == 2; +test bool delAnnotations10() = ANODE n := unset(A3)[1] && n.label == "b"; // delAnnotationsRec -test bool delAnnotationsRec1() = !delAnnotationsRec(A1)@pos?; -test bool delAnnotationsRec2() = !delAnnotationsRec(A1)@label?; +test bool delAnnotationsRec1() = !delAnnotationsRec(A1).pos?; +test bool delAnnotationsRec2() = !delAnnotationsRec(A1).label?; -test bool delAnnotationsRec3() = !delAnnotationsRec(A2)@pos?; -test bool delAnnotationsRec4() = !delAnnotationsRec(A2)@label?; +test bool delAnnotationsRec3() = !delAnnotationsRec(A2).pos?; +test bool delAnnotationsRec4() = !delAnnotationsRec(A2).label?; -test bool delAnnotationsRec5() = !delAnnotationsRec(A3)@pos?; -test bool delAnnotationsRec6() = !delAnnotationsRec(A3)@label?; +test bool delAnnotationsRec5() = !delAnnotationsRec(A3).pos?; +test bool delAnnotationsRec6() = !delAnnotationsRec(A3).label?; -test bool delAnnotationsRec7() = ANODE n := delAnnotationsRec(A3)[0] && !n@pos?; -test bool delAnnotationsRec8() = ANODE n := delAnnotationsRec(A3)[0] && !n@label?; +test bool delAnnotationsRec7() = ANODE n := delAnnotationsRec(A3)[0] && !n.pos?; +test bool delAnnotationsRec8() = ANODE n := delAnnotationsRec(A3)[0] && !n.label?; -test bool delAnnotationsRec9() = ANODE n := delAnnotationsRec(A3)[1] && !n@pos?; -test bool delAnnotationsRec10() = ANODE n := delAnnotationsRec(A3)[1] && !n@label?; +test bool delAnnotationsRec9() = ANODE n := delAnnotationsRec(A3)[1] && !n.pos?; +test bool delAnnotationsRec10() = ANODE n := delAnnotationsRec(A3)[1] && !n.label?; // getAnnotations test bool getAnnotations1() = getAnnotations(A1) == (); @@ -103,8 +105,8 @@ test bool makeNode4() {node n = makeNode("f", 1, 2, 3); return getName(n) == "f" // setAnnotations test bool setAnnotations1() = setAnnotations(leaf(3), ()) == leaf(3); -test bool setAnnotations2() = setAnnotations(leaf(3), ("pos": 1, "label":"a"))@pos == 1; -test bool setAnnotations3() = setAnnotations(leaf(3), ("pos": 1, "label":"a"))@label == "a"; +test bool setAnnotations2() = setAnnotations(leaf(3), ("pos": 1, "label":"a")).pos == 1; +test bool setAnnotations3() = setAnnotations(leaf(3), ("pos": 1, "label":"a")).label == "a"; // unset diff --git a/src/org/rascalmpl/library/lang/rascal/upgrade/UpdateNestedListAndSetPatterns.rsc b/src/org/rascalmpl/library/lang/rascal/upgrade/UpdateNestedListAndSetPatterns.rsc index c1d6de2f449..8e1da83ba8f 100644 --- a/src/org/rascalmpl/library/lang/rascal/upgrade/UpdateNestedListAndSetPatterns.rsc +++ b/src/org/rascalmpl/library/lang/rascal/upgrade/UpdateNestedListAndSetPatterns.rsc @@ -1,26 +1,12 @@ @bootstrapParser module lang::rascal::upgrade::UpdateNestedListAndSetPatterns -import lang::rascal::\syntax::Rascal; -import util::FileSystem; -import ParseTree; -import IO; -import Message; - -list[Message] report(loc root) - = [*report(parse(#start[Module], m)) | m <- find(root, "rsc")]; - -void update(loc root) { - modules = [ f | /file(f) := crawl(root), f.extension == "rsc"]; - for (m <- modules) { - writeFile(m, ""); - } -} +extend lang::rascal::upgrade::UpgradeBase; list[Message] report(Tree m) - = [info("found postfix multivar", name@\loc) | /(Pattern) `*` := m]; + = [info("found postfix multivar", name.origin) | /(Pattern) `*` := m]; -Tree updateTree(Tree m) = +Tree update(Tree m) = visit(m) { case (Pattern) `*` => (Pattern) `*` }; diff --git a/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradeAnnotationsToKeywordParameters.rsc b/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradeAnnotationsToKeywordParameters.rsc new file mode 100644 index 00000000000..342ee9585e9 --- /dev/null +++ b/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradeAnnotationsToKeywordParameters.rsc @@ -0,0 +1,60 @@ +@bootstrapParser +module lang::rascal::upgrade::UpgradeAnnotationsToKeywordParameters + +extend lang::rascal::upgrade::UpgradeBase; +import ParseTree; + +list[Message] report(Tree m) + = [info("found " == "node") {>irreplacable<}> annotation definition", name.src) | /(Declaration) ` anno @;` := m] + + [info("found annotation use", name.src) | /(Expression) `@` := m] + + [info("found annotion update", name.src) | /(Expression) `[@=]` := m] + + [info("found annotation literal", field.src) | /(Assignable) `@` := m] + + [info("found annotation catch", e.src) | /(Catch) `catch NoSuchAnnotation() : ` := m] + ; + +Tree update(Tree m) = + top-down visit(m) { + case (Declaration) ` anno @;` + => (Declaration) ` + 'data ( = );` + when Expression init := getInitializer(t), Name name2 := getName(name) + + case (Expression) `@ ? ` => (Expression) `.` + when Name name2 := getName(name) + + case (Expression) `@` => (Expression) `.` + when Name name2 := getName(name) + + case (Expression) `[@=]` => (Expression) `[=]` + when Name name2 := getName(name) + + case (Expression) `delAnnotations()` => (Expression) `unset()` + + case (Assignable) `@` => (Assignable) `.` + when Name name2 := getName(field) + + case (Catch) `catch NoSuchAnnotation() : ` + => (Catch) `catch NoSuchField() : + ' // TODO: where annotations would often throw exceptions, keyword fields return their default. + ' ` + }; + +Name getName((Name) `\\loc`) = (Name) `src`; +Name getName((Name) `src`) = (Name) `src`; +Name getName((Name) `location`) = (Name) `src`; +default Name getName(Name n) = n; + +test bool nameTest() = getName((Name) `location`) := (Name) `src`; + +Expression getInitializer((Type) `rel[<{TypeArg ","}* elem>]`) = (Expression) `{}`; +Expression getInitializer((Type) `list[]`) = (Expression) `[]`; +Expression getInitializer((Type) `map[,]`) = (Expression) `()`; +Expression getInitializer((Type) `set[]`) = (Expression) `{}`; +Expression getInitializer((Type) `real`) = (Expression) `0.0`; +Expression getInitializer((Type) `int`) = (Expression) `0`; +Expression getInitializer((Type) `num`) = (Expression) `0`; +Expression getInitializer((Type) `str`) = (Expression) `""`; +Expression getInitializer((Type) `value`) = (Expression) `[]`; +Expression getInitializer((Type) `rat`) = (Expression) `r0`; +Expression getInitializer((Type) `loc`) = (Expression) `|unknown:///|`; +default Expression getInitializer(Type t) = (Expression) ` () { throw "no default value"; }()`; \ No newline at end of file diff --git a/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradeBase.rsc b/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradeBase.rsc new file mode 100644 index 00000000000..df18e1ceeb2 --- /dev/null +++ b/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradeBase.rsc @@ -0,0 +1,73 @@ +@bootstrapParser +module lang::rascal::upgrade::UpgradeBase + +import lang::rascal::\syntax::Rascal; +import util::FileSystem; +import ParseTree; +import IO; +import Message; +import Exception; +import util::Reflective; +import Set; +import util::Monitor; + +list[Message] reportForProject(loc projectRoot) + = reportForPathConfig(getProjectPathConfig(projectRoot)); + +list[Message] reportForProject(str projectName) + = reportForPathConfig(getProjectPathConfig(|project://|)); + +list[Message] reportForPathConfig(PathConfig pcfg) + = [ *report(root) | root <- pcfg.srcs]; + +list[Message] report(loc root) { + set[loc] ms = find(root, "rsc"); + + return job("Reporting for ", list[Message] (void (str, int) step) { + bool st(str msg) { step(msg, 1); return true; }; + + return [*reportFor(\module) | \module <- ms, st(\module.file)]; + }, totalWork = size(ms)); +} + +list[Message] reportFor(loc l) { + try { + return report(parse(#start[Module], l)); + } catch ParseError(loc r) : + return [warning("parse error in Rascal file",r)]; +} + +void updateProject(str projectName) { + updatePathConfig(getProjectPathConfig(|project://|)); +} + +void updatePathConfig(PathConfig pcfg) { + for (root <- pcfg.srcs) { + updateFolder(root); + } +} + +void updateFolder(loc root) { + set[loc] ms = find(root, "rsc"); + + job("Updating ", bool (void (str, int) step) { + for (loc m <- ms) { + try { + step(m.file, 1); + writeFile(m, ""); + } + catch ParseError(l): { + println("parse error in , skipped"); + } + } + + return true; + }, totalWork=size(ms)); +} + +@synopsis{Definition to override in an extending module for reporting on a specific upgrade refactoring.} +default list[Message] report(Tree _) = []; + +@synopsis{Definition to override in an extending module for implementing a specific upgrade refactoring.} +default Tree update(Tree m) = m; + diff --git a/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradePostfixStarAndPlusToPrefix.rsc b/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradePostfixStarAndPlusToPrefix.rsc index 22b9f2c8790..5f01f5d376e 100644 --- a/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradePostfixStarAndPlusToPrefix.rsc +++ b/src/org/rascalmpl/library/lang/rascal/upgrade/UpgradePostfixStarAndPlusToPrefix.rsc @@ -1,38 +1,26 @@ @bootstrapParser module lang::rascal::upgrade::UpgradePostfixStarAndPlusToPrefix -import util::FileSystem; -import lang::rascal::\syntax::Rascal; -import ParseTree; -import IO; -import Message; - -list[Message] report(loc root) - = [*report(parse(#start[Module], m)) | m <- find(root, "rsc")]; - -void update(loc root) { - for (m <- find(root, "rsc")) { - writeFile(m, ""); - } -} +import lang::rascal::upgrade::UpgradeBase; list[Message] report(Tree m) { result = []; visit(m) { - case (Pattern) `[<{Pattern ","}* _>,list[] ,<{Pattern ","}* _>]` : - result += [info("found list pattern to upgrade", elem@\loc)]; - case (Pattern) `{<{Pattern ","}* _>,set[] ,<{Pattern ","}* _>}` : - result += [info("found list pattern to upgrade", elem@\loc)]; + case (Pattern) `[<{Pattern ","}* before>,list[] ,<{Pattern ","}* after>]` : + result += [info("found list pattern to upgrade", elem.origin)]; + case (Pattern) `{<{Pattern ","}* before>,set[] ,<{Pattern ","}* after>}` : + result += [info("found list pattern to upgrade", elem.origin)]; + case Pattern p : ; } return result; } -public Tree updateTree(Tree m) = +public Tree update(Tree m) = innermost visit(m) { case (Pattern) `[<{Pattern ","}* before>,list[] ,<{Pattern ","}* after>]` => (Pattern) `[<{Pattern ","}* before>, * , <{Pattern ","}* after>]` case (Pattern) `{<{Pattern ","}* before>,set[] ,<{Pattern ","}* after>}` => (Pattern) `{<{Pattern ","}* before>, * , <{Pattern ","}* after>}` - case Pattern _ : fail; + case Pattern p : fail; }; diff --git a/src/org/rascalmpl/library/lang/sdf2/filters/DetectCycles.rsc b/src/org/rascalmpl/library/lang/sdf2/filters/DetectCycles.rsc index ac70f6ff340..46c24f20b10 100644 --- a/src/org/rascalmpl/library/lang/sdf2/filters/DetectCycles.rsc +++ b/src/org/rascalmpl/library/lang/sdf2/filters/DetectCycles.rsc @@ -4,7 +4,7 @@ import ParseTree; &T<:Tree cycleDetectionFilter(amb(set[&T<:Tree] alts)) { if (/t:cycle(_,_) <- alts) { - throw "Cycle detected at "; + throw "Cycle detected at "; } else { fail cycleDetectionFilter; diff --git a/src/org/rascalmpl/library/vis/Basic.rsc b/src/org/rascalmpl/library/vis/Basic.rsc index ec25eea83ab..44afc4db4e9 100644 --- a/src/org/rascalmpl/library/vis/Basic.rsc +++ b/src/org/rascalmpl/library/vis/Basic.rsc @@ -164,7 +164,7 @@ HTMLElement toHTML(t:) HTMLElement toHTML(Tree t:appl(Production p, list[Tree] args)) = div([ text(topProd2rascal(p)), - *(t@\loc? ? [toHTML(t@\loc)] : []), + *(t.src? ? [toHTML(t.src)] : []), ul([ li([toHTML(a)]) | a <- args diff --git a/src/org/rascalmpl/library/vis/Text.rsc b/src/org/rascalmpl/library/vis/Text.rsc index 5299034149c..10310115f48 100644 --- a/src/org/rascalmpl/library/vis/Text.rsc +++ b/src/org/rascalmpl/library/vis/Text.rsc @@ -53,7 +53,7 @@ str prettyTree(Tree t, bool src=false, bool characters=true, bool \layout=false, str nodeLabel(cycle(Symbol nt, int len)) = "cycle(, )"; default str nodeLabel(Tree v) = ""; - lrel[str,value] edges(Tree t:appl(_, list[Tree] args)) = [<"src", t@\loc> | src, t@\loc?] + [<"", k> | Tree k <- args, include(k)]; + lrel[str,value] edges(Tree t:appl(_, list[Tree] args)) = [<"src", t.src> | src, t.src?] + [<"", k> | Tree k <- args, include(k)]; lrel[str,value] edges(amb(set[Tree] alts)) = [<"", a> | Tree a <- alts]; lrel[str,value] edges(loc _) = []; default lrel[str,value] edges(Tree _) = []; diff --git a/src/org/rascalmpl/tutor/lang/rascal/tutor/apidoc/ExtractInfo.rsc b/src/org/rascalmpl/tutor/lang/rascal/tutor/apidoc/ExtractInfo.rsc index 48230c4f35d..faaedb66c1c 100644 --- a/src/org/rascalmpl/tutor/lang/rascal/tutor/apidoc/ExtractInfo.rsc +++ b/src/org/rascalmpl/tutor/lang/rascal/tutor/apidoc/ExtractInfo.rsc @@ -35,7 +35,7 @@ list[DeclarationInfo] extractModule(m: (Module) `

`) { return [moduleInfo( moduleName=moduleName, name=name, - src=m@\loc, + src=m.src, synopsis=synopsis, docs=sortedDocTags(tags), demo=(/demo|examples/ := moduleName), @@ -70,7 +70,7 @@ list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ` list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ` alias = ;`) { dtags = getTagContents(tags); - return [ aliasInfo(moduleName=moduleName, name="", signature="", src=d@\loc, synopsis=getSynopsis(dtags), docs=sortedDocTags(dtags))]; + return [ aliasInfo(moduleName=moduleName, name="", signature="", src=d.src, synopsis=getSynopsis(dtags), docs=sortedDocTags(dtags))]; } list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ` tag on <{Type ","}+ types> ;`) @@ -94,7 +94,7 @@ list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ` adtName = ""; return [dataInfo(moduleName=moduleName, name=adtName, signature="data ", - src=d@\loc, synopsis=getSynopsis(dtags), docs=sortedDocTags(dtags))]; + src=d.src, synopsis=getSynopsis(dtags), docs=sortedDocTags(dtags))]; } list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ` data = <{Variant "|"}+ variants> ;`) { @@ -104,12 +104,12 @@ list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ` infoVariants = [ genVariant(moduleName, variant) | variant <- variants ]; return dataInfo(moduleName=moduleName, name=adtName, signature="data ", - src=d@\loc, synopsis=getSynopsis(dtags), docs=sortedDocTags(dtags)) + infoVariants; + src=d.src, synopsis=getSynopsis(dtags), docs=sortedDocTags(dtags)) + infoVariants; } DeclarationInfo genVariant(str moduleName, v: (Variant) `(<{TypeArg ","}* _> )`) { signature = ""; - return constructorInfo(moduleName=moduleName, name="", signature="", src=v@\loc); + return constructorInfo(moduleName=moduleName, name="", signature="", src=v.src); } list[DeclarationInfo] extractDecl(str moduleName, d: (Declaration) ``) @@ -143,7 +143,7 @@ private DeclarationInfo extractFunctionDeclaration(str moduleName, FunctionDecla tags = getTagContents(fd.tags); - return functionInfo(moduleName=moduleName, name=fname, signature=signature, src=fd@\loc, synopsis=getSynopsis(tags), docs=sortedDocTags(tags), fullFunction=""); + return functionInfo(moduleName=moduleName, name=fname, signature=signature, src=fd.src, synopsis=getSynopsis(tags), docs=sortedDocTags(tags), fullFunction=""); } DeclarationInfo extractTestDecl(str moduleName, FunctionDeclaration fd) { @@ -152,7 +152,7 @@ DeclarationInfo extractTestDecl(str moduleName, FunctionDeclaration fd) { signature = ""; tags = getTagContents(fd.tags); - return testInfo(moduleName=moduleName, name=fname, src=fd@\loc, synopsis=getSynopsis(tags), fullTest=""); + return testInfo(moduleName=moduleName, name=fname, src=fd.src, synopsis=getSynopsis(tags), fullTest=""); } private Tree removeTags(Tree x) = visit(x) { diff --git a/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/SplitDocTag.rsc b/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/SplitDocTag.rsc index 0fd189694cd..f518f3743f9 100644 --- a/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/SplitDocTag.rsc +++ b/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/SplitDocTag.rsc @@ -25,8 +25,8 @@ void editModule(loc example) = editModule(parse(#start[Module], example).top); list[TextEdit] editsForModule(loc example) = rewriteDocTags(example); void editModule(Module m) { - edits = rewriteDocTags(m@\loc.top); - executeDocumentEdits([changed(m@\loc.top, edits)]); + edits = rewriteDocTags(m.src.top); + executeDocumentEdits([changed(m.src.top, edits)]); return; } diff --git a/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/TrimDoc.rsc b/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/TrimDoc.rsc index e7b10364ad2..422ad9171b4 100644 --- a/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/TrimDoc.rsc +++ b/src/org/rascalmpl/tutor/lang/rascal/tutor/conversions/TrimDoc.rsc @@ -16,7 +16,7 @@ void editModule(loc example) = editModule(parse(#start[Module], example).top); void editModule(start[Module] m) { n = rewriteDocTags(m); - writeFile(m@\loc.top, ""); + writeFile(m.src.top, ""); return; }