Skip to content

Commit

Permalink
added empty tuple to syntax without adding a type syntax for the empt…
Browse files Browse the repository at this point in the history
…y tuple yet. Towards fixing #2106
  • Loading branch information
jurgenvinju committed Dec 19, 2024
1 parent 0f2e799 commit 67329e2
Show file tree
Hide file tree
Showing 67 changed files with 829 additions and 747 deletions.
86 changes: 81 additions & 5 deletions src/org/rascalmpl/ast/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -6465,6 +6465,82 @@ public Object clone() {
return newInstance(getClass(), src, (IConstructor) null , clone(elements));
}

}
public boolean isTuple() {
return false;
}

static public class Tuple extends Expression {
// Production: sig("Tuple",[arg("java.util.List\<org.rascalmpl.ast.Expression\>","elements0")],breakable=false)


private final java.util.List<org.rascalmpl.ast.Expression> elements0;

public Tuple(ISourceLocation src, IConstructor node , java.util.List<org.rascalmpl.ast.Expression> elements0) {
super(src, node);

this.elements0 = elements0;
}

@Override
public boolean isTuple() {
return true;
}

@Override
public <T> T accept(IASTVisitor<T> visitor) {
return visitor.visitExpressionTuple(this);
}

@Override
protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) {
if (getLocation().getBeginLine() == $line) {
$result.add(this);
}
ISourceLocation $l;

for (AbstractAST $elem : elements0) {
$l = $elem.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
$elem.addForLineNumber($line, $result);
}
if ($l.getBeginLine() > $line) {
return;
}

}
}

@Override
public boolean equals(Object o) {
if (!(o instanceof Tuple)) {
return false;
}
Tuple tmp = (Tuple) o;
return true && tmp.elements0.equals(this.elements0) ;
}

@Override
public int hashCode() {
return 331 + 347 * elements0.hashCode() ;
}


@Override
public java.util.List<org.rascalmpl.ast.Expression> getElements0() {
return this.elements0;
}

@Override
public boolean hasElements0() {
return true;
}

@Override
public Object clone() {
return newInstance(getClass(), src, (IConstructor) null , clone(elements0));
}

}
public boolean isTypedVariable() {
return false;
Expand Down Expand Up @@ -6530,7 +6606,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 331 + 347 * type.hashCode() + 487 * name.hashCode() ;
return 487 + 53 * type.hashCode() + 983 * name.hashCode() ;
}


Expand Down Expand Up @@ -6633,7 +6709,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 53 + 983 * type.hashCode() + 653 * name.hashCode() + 29 * pattern.hashCode() ;
return 653 + 29 * type.hashCode() + 487 * name.hashCode() + 653 * pattern.hashCode() ;
}


Expand Down Expand Up @@ -6735,7 +6811,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 487 + 653 * name.hashCode() + 373 * pattern.hashCode() ;
return 373 + 449 * name.hashCode() + 251 * pattern.hashCode() ;
}


Expand Down Expand Up @@ -6828,7 +6904,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 449 + 251 * label.hashCode() + 109 * visit.hashCode() ;
return 109 + 967 * label.hashCode() + 269 * visit.hashCode() ;
}


Expand Down Expand Up @@ -6923,7 +6999,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 967 + 269 * parameters.hashCode() + 97 * statements0.hashCode() ;
return 97 + 101 * parameters.hashCode() + 467 * statements0.hashCode() ;
}


Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/ast/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 101 + 467 * fieldIndex.hashCode() ;
return 89 + 727 * fieldIndex.hashCode() ;
}


Expand Down Expand Up @@ -172,7 +172,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 89 + 727 * fieldName.hashCode() ;
return 673 + 743 * fieldName.hashCode() ;
}


Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/ast/Formals.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 673 + 743 * formals.hashCode() ;
return 29 + 571 * formals.hashCode() ;
}


Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/ast/FunctionBody.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 29 + 571 * statements.hashCode() ;
return 211 + 727 * statements.hashCode() ;
}


Expand Down
8 changes: 4 additions & 4 deletions src/org/rascalmpl/ast/FunctionDeclaration.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 211 + 727 * tags.hashCode() + 251 * visibility.hashCode() + 131 * signature.hashCode() ;
return 251 + 131 * tags.hashCode() + 811 * visibility.hashCode() + 199 * signature.hashCode() ;
}


Expand Down Expand Up @@ -280,7 +280,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 811 + 199 * tags.hashCode() + 5 * visibility.hashCode() + 157 * signature.hashCode() + 389 * expression.hashCode() + 163 * conditions.hashCode() ;
return 5 + 157 * tags.hashCode() + 389 * visibility.hashCode() + 163 * signature.hashCode() + 163 * expression.hashCode() + 71 * conditions.hashCode() ;
}


Expand Down Expand Up @@ -420,7 +420,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 163 + 71 * tags.hashCode() + 503 * visibility.hashCode() + 31 * signature.hashCode() + 181 * body.hashCode() ;
return 503 + 31 * tags.hashCode() + 181 * visibility.hashCode() + 313 * signature.hashCode() + 463 * body.hashCode() ;
}


Expand Down Expand Up @@ -551,7 +551,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 313 + 463 * tags.hashCode() + 257 * visibility.hashCode() + 211 * signature.hashCode() + 179 * expression.hashCode() ;
return 257 + 211 * tags.hashCode() + 179 * visibility.hashCode() + 457 * signature.hashCode() + 839 * expression.hashCode() ;
}


Expand Down
6 changes: 3 additions & 3 deletions src/org/rascalmpl/ast/FunctionModifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 457 ;
return 2 ;
}


Expand Down Expand Up @@ -129,7 +129,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 839 ;
return 461 ;
}


Expand Down Expand Up @@ -184,7 +184,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 2 ;
return 877 ;
}


Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/ast/FunctionModifiers.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 461 + 877 * modifiers.hashCode() ;
return 599 + 281 * modifiers.hashCode() ;
}


Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/ast/FunctionType.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 599 + 281 * type.hashCode() + 43 * arguments.hashCode() ;
return 43 + 103 * type.hashCode() + 673 * arguments.hashCode() ;
}


Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/ast/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 103 + 673 * tags.hashCode() + 509 * name.hashCode() + 61 * imports.hashCode() ;
return 509 + 61 * tags.hashCode() + 173 * name.hashCode() + 761 * imports.hashCode() ;
}


Expand Down Expand Up @@ -258,7 +258,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 173 + 761 * tags.hashCode() + 409 * name.hashCode() + 997 * params.hashCode() + 367 * imports.hashCode() ;
return 409 + 997 * tags.hashCode() + 367 * name.hashCode() + 401 * params.hashCode() + 139 * imports.hashCode() ;
}


Expand Down
2 changes: 2 additions & 0 deletions src/org/rascalmpl/ast/IASTVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ public interface IASTVisitor<T> {

public T visitExpressionTuple(Expression.Tuple x);

public T visitExpressionTuple(Expression.Tuple x);

public T visitExpressionTypedVariable(Expression.TypedVariable x);

public T visitExpressionTypedVariableBecomes(Expression.TypedVariableBecomes x);
Expand Down
8 changes: 4 additions & 4 deletions src/org/rascalmpl/ast/Import.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 401 + 139 * module.hashCode() ;
return 937 + 521 * module.hashCode() ;
}


Expand Down Expand Up @@ -186,7 +186,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 937 + 521 * module.hashCode() ;
return 719 + 773 * module.hashCode() ;
}


Expand Down Expand Up @@ -270,7 +270,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 719 + 773 * name.hashCode() + 277 * at.hashCode() ;
return 277 + 239 * name.hashCode() + 151 * at.hashCode() ;
}


Expand Down Expand Up @@ -353,7 +353,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 239 + 151 * syntax.hashCode() ;
return 397 + 137 * syntax.hashCode() ;
}


Expand Down
8 changes: 4 additions & 4 deletions src/org/rascalmpl/ast/ImportedModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 397 + 137 * name.hashCode() + 811 * actuals.hashCode() ;
return 811 + 709 * name.hashCode() + 167 * actuals.hashCode() ;
}


Expand Down Expand Up @@ -218,7 +218,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 709 + 167 * name.hashCode() + 53 * actuals.hashCode() + 463 * renamings.hashCode() ;
return 53 + 463 * name.hashCode() + 127 * actuals.hashCode() + 67 * renamings.hashCode() ;
}


Expand Down Expand Up @@ -310,7 +310,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 127 + 67 * name.hashCode() ;
return 643 + 229 * name.hashCode() ;
}


Expand Down Expand Up @@ -394,7 +394,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 643 + 229 * name.hashCode() + 271 * renamings.hashCode() ;
return 271 + 331 * name.hashCode() + 17 * renamings.hashCode() ;
}


Expand Down
6 changes: 3 additions & 3 deletions src/org/rascalmpl/ast/IntegerLiteral.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 331 + 17 * decimal.hashCode() ;
return 401 + 313 * decimal.hashCode() ;
}


Expand Down Expand Up @@ -179,7 +179,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 401 + 313 * hex.hashCode() ;
return 449 + 463 * hex.hashCode() ;
}


Expand Down Expand Up @@ -253,7 +253,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 449 + 463 * octal.hashCode() ;
return 971 + 179 * octal.hashCode() ;
}


Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/ast/KeywordArgument_Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 971 + 179 * name.hashCode() + 229 * expression.hashCode() ;
return 229 + 823 * name.hashCode() + 43 * expression.hashCode() ;
}


Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/ast/KeywordArguments_Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 823 + 43 * optionalComma.hashCode() + 733 * keywordArgumentList.hashCode() ;
return 733 + 239 * optionalComma.hashCode() + 941 * keywordArgumentList.hashCode() ;
}


Expand Down Expand Up @@ -183,7 +183,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 239 ;
return 941 ;
}


Expand Down
Loading

0 comments on commit 67329e2

Please sign in to comment.