Skip to content

Commit 907d849

Browse files
committed
fixes
1 parent 7c8b638 commit 907d849

2 files changed

Lines changed: 4 additions & 25 deletions

File tree

src/org/rascalmpl/library/lang/rascal/format/Rascal.rsc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,25 +1068,6 @@ list[Box] flatString((StringTemplate) `if(<{Expression ","}+ conds>) { <Statemen
10681068
L("}")
10691069
];
10701070
1071-
/* Concrete fragments*/
1072-
1073-
// "(" LAYOUTLIST l1 Sym symbol LAYOUTLIST l2 ")" LAYOUTLIST l3 "`" ConcretePart* parts "`";
1074-
// Box toBox((Concrete) `(<LAYOUTLIST _><Sym symbol><LAYOUTLIST _>)<LAYOUTLIST _>\`<ConcretePart* parts>\`)`)
1075-
// = V();
1076-
1077-
1078-
/*
1079-
lexical ConcretePart
1080-
= @category="string" text : ![`\<\>\\\n]+ !>> ![`\<\>\\\n]
1081-
| newline: "\n" [\ \t \u00A0 \u1680 \u2000-\u200A \u202F \u205F \u3000]* "\'"
1082-
| @category="variable" hole : ConcreteHole hole
1083-
| @category="string" lt: "\\\<"
1084-
| @category="string" gt: "\\\>"
1085-
| @category="string" bq: "\\`"
1086-
| @category="string" bs: "\\\\"
1087-
;
1088-
*/
1089-
10901071
/* Types */
10911072
10921073
Box toBox((FunctionType) `<Type typ>(<{TypeArg ","}* args>)`)

src/org/rascalmpl/library/util/Formatters.rsc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,13 @@ private Symbol delabel(label(_, Symbol s)) = delabel(s);
202202
private Symbol delabel(conditional(Symbol s, _)) = delabel(s);
203203
private default Symbol delabel(Symbol s) = s;
204204

205-
int stubCounter = 1;
206-
207205
@synopsis{Generates a string formatter that produces ((TextEdit))s for downstream processing.}
208206
list[TextEdit](str) stringEdits(type[&G <: Tree] grammar, Style style, FormattingOptions opts=fo()) {
209207
&G(str, loc) p = parser(grammar);
210-
loc stub = |tmp:///| + "formatted<stubCounter>.txt";
211-
stubCounter = stubCounter + 1;
212208

213209
return list[TextEdit] (str input) {
210+
loc stub = |tmp:///| + "formatted<md5Hash(input)>.txt";
211+
214212
&G tree = p(input, stub);
215213
try {
216214
return layoutDiff(tree, p(format(style(tree), opts=opts[ci=asIs()]), stub), ci=opts.caseInsensitivity);
@@ -244,10 +242,10 @@ parameter (a substring). For example: `#Statement` and `if (true) false;`.
244242
}
245243
list[TextEdit](type[Tree], str) subStringEdits(type[&G <: Tree] grammar, Style style, FormattingOptions opts=fo()) {
246244
Tree(type[Tree], str, loc) p = parsers(grammar);
247-
loc stub = |tmp:///| + "formatted-<stubCounter>.txt";
248-
stubCounter = stubCounter + 1;
249245

250246
return list[TextEdit] (type[Tree] nonterminal, str input) {
247+
loc stub = |tmp:///| + "formatted<md5Hash(input)>.txt";
248+
251249
&G tree = p(nonterminal, input, stub);
252250
try {
253251
return layoutDiff(tree, p(nonterminal, format(style(tree), opts=opts[ci=asIs()]), stub), ci=opts.caseInsensitivity);

0 commit comments

Comments
 (0)