Skip to content

Commit b678af8

Browse files
rodinaarssenjurgenvinju
authored andcommitted
fixed PR review by @rodinaarssen
1 parent 78045b9 commit b678af8

3 files changed

Lines changed: 11 additions & 14 deletions

File tree

‎src/org/rascalmpl/compiler/lang/rascalcore/check/AType.rsc‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,12 @@ bool asubtype(\asyntaxRoleModifier(SyntaxRole role, \aparameter(_,_)), aadt(_, _
246246
// All open syntax role modifiers are sub-types of `node`
247247
bool asubtype(\asyntaxRoleModifier(SyntaxRole role, \aparameter(_,_)), anode(_)) = true;
248248

249+
@synopsis{These are the roles for values of the Tree type}
250+
private set[SyntaxRole] treeSyntaxRoles = {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
251+
249252
// All context-free grammar-related syntax roles are sub-types of `Tree`
250253
bool asubtype(\asyntaxRoleModifier(SyntaxRole role, \aparameter(_,_)), aadt("Tree", [], dataSyntax())) = true
251-
when role in {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
254+
when role in treeSyntaxRoles;
252255

253256
bool asubtype(\start(AType a), AType b) = asubtype(a, b);
254257

@@ -562,12 +565,6 @@ bool outerComparable1(aparameter(str pname1, AType bound1), aparameter(str pname
562565

563566
bool outerComparable1(aadt(str adtName1, list[AType] parameters1, SyntaxRole syntaxRole1), areified(_)) = true;
564567

565-
// syntax role with incomparable roles are not outer comparable, but otherwise they act like aadt's:
566-
// JV: commented out until I understand the use of outerComparable1 better.
567-
// bool outerComparable1(asyntaxRoleModifier(SyntaxRole role, aparameter(_,_)), asyntaxRoleModifier(role, aparameter(_,_))) = true;
568-
// bool outerComparable1(asyntaxRoleModifier(SyntaxRole role, aparameter(_,_)), aadt(_,_,role)) = true;
569-
// bool outerComparable1(aadt(_,_,role), asyntaxRoleModifier(SyntaxRole role, aparameter(_,_))) = true;
570-
571568
default bool outerComparable1(AType l, AType r) {
572569
return comparable(l, r);
573570
}
@@ -751,11 +748,11 @@ AType alub(\anode(l), \asyntaxRoleModifier(_, \aparameter(_, _))) = \anode(l);
751748

752749
AType alub(\asyntaxRoleModifier(SyntaxRole role, \aparameter(_, _)), aadt("Tree",[], dataSyntax()))
753750
= aadt("Tree",[], dataSyntax())
754-
when role in {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
751+
when role in treeSyntaxRoles;
755752

756753
AType alub(aadt("Tree",[], dataSyntax()), \asyntaxRoleModifier(SyntaxRole role, \aparameter(_, _)))
757754
= aadt("Tree",[], dataSyntax())
758-
when role in {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
755+
when role in treeSyntaxRoles;
759756

760757
// ---
761758

@@ -767,7 +764,7 @@ AType alub(\asyntaxRoleModifier(SyntaxRole _, \aparameter(x, _)),
767764

768765
AType alub(\asyntaxRoleModifier(SyntaxRole a, \aparameter(x, _)),
769766
\asyntaxRoleModifier(SyntaxRole b, \aparameter(y, _))) = aadt("Tree",[], dataSyntax())
770-
when x != y, {a,b} < {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
767+
when {a,b} < treeSyntaxRoles;
771768

772769
AType alub(l:\achar-class(_), r:\achar-class(_)) = union(l, r);
773770

@@ -945,10 +942,10 @@ AType aglb(a:asyntaxRoleModifier(SyntaxRole _, aparameter(_,_)), \anode(_)) = a;
945942
AType aglb(\anode(_), a:asyntaxRoleModifier(SyntaxRole _, aparameter(_,_))) = a;
946943

947944
AType aglb(a:asyntaxRoleModifier(SyntaxRole role, aparameter(_,_)), aadt("Tree", [], dataSyntax())) = a
948-
when role in {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
945+
when role in treeSyntaxRoles;
949946

950947
AType aglb(aadt("Tree", [], dataSyntax()), a:asyntaxRoleModifier(SyntaxRole role, aparameter(_,_))) = a
951-
when role in {contextFreeSyntax(), lexicalSyntax(), keywordSyntax(), layoutSyntax()};
948+
when role in treeSyntaxRoles;
952949

953950
public list[AType] aglbList(list[AType] l, list[AType] r) = [aglb(l[idx],r[idx]) | idx <- index(l)] when size(l) == size(r);
954951
public default list[AType] aglbList(list[AType] l, list[AType] r) = [avalue()];

‎src/org/rascalmpl/library/Type.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class Type {
3737
private final IRascalValueFactory vf;
3838

39-
public Type(IRascalValueFactory vf, TypeFactory tf) {
39+
public Type(IRascalValueFactory vf) {
4040
this.vf = vf;
4141
}
4242

‎src/org/rascalmpl/library/lang/paths/Windows.rsc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The main function of this module, ((parseWindowsPath)):
1010
* throws a ParseError if the path does not comply. Typically file names ending in spaces do not comply.
1111
* ensures that if the file exists on system A, then the `loc` representation
1212
resolves to the same file on system A via any ((Library:module:IO)) function.
13-
* and nothing more. No normalization, no interpretation of `.` and `..`, no changing of cases.
13+
* and nothing more. No normalization, no interpretation of `.` and `..`, no changing of cases.
1414
This is left to downstream processors of `loc` values, if necessary. The current transformation
1515
is purely syntactical, and tries to preserve the semantics of the path as much as possible.
1616
}

0 commit comments

Comments
 (0)