-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v1] Remove PartiQLValue from AST; refactor AST literals
- Loading branch information
Showing
31 changed files
with
613 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
partiql-ast/src/main/java/org/partiql/ast/expr/ExprLit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
partiql-ast/src/main/java/org/partiql/ast/literal/Literal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
public abstract class Literal { | ||
@NotNull | ||
public final String text; | ||
|
||
protected Literal(@NotNull String _text) { | ||
this.text = _text; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralBool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralBool extends Literal { | ||
public boolean value; | ||
|
||
public LiteralBool(boolean value) { | ||
super(String.valueOf(value)); | ||
this.value = value; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralDecimal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.math.BigDecimal; | ||
|
||
/** | ||
* TODO DOCS | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralDecimal extends Literal { | ||
@NotNull | ||
public BigDecimal value; | ||
|
||
public LiteralDecimal(@NotNull BigDecimal value) { | ||
super(value.toString()); | ||
this.value = value; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralDouble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralDouble extends Literal { | ||
public double value; | ||
|
||
public LiteralDouble(@NotNull String text) { | ||
super(text); | ||
this.value = Double.parseDouble(text); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralInt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralInt extends Literal { | ||
public int value; | ||
|
||
public LiteralInt(int value) { | ||
super(String.format("%d", value)); | ||
this.value = value; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralLong.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralLong extends Literal { | ||
public long value; | ||
|
||
public LiteralLong(long value) { | ||
super(String.format("%d", value)); | ||
this.value = value; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralMissing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralMissing extends Literal { | ||
public LiteralMissing() { | ||
super("MISSING"); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralNull.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralNull extends Literal { | ||
public LiteralNull() { | ||
super("NULL"); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* TODO docs | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralString extends Literal { | ||
@NotNull | ||
public String value; | ||
|
||
public LiteralString(@NotNull String value) { | ||
super(String.format("'%s'", value)); | ||
this.value = value; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
partiql-ast/src/main/java/org/partiql/ast/literal/LiteralTypedString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.partiql.ast.literal; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.partiql.ast.DataType; | ||
|
||
/** | ||
* TODO docs | ||
* Represent type + 'some string value' | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LiteralTypedString extends Literal { | ||
@NotNull | ||
public DataType type; | ||
|
||
@NotNull | ||
public String value; | ||
|
||
public LiteralTypedString(@NotNull DataType type, @NotNull String value) { | ||
super(String.format("%s '%s'", type.name(), value)); | ||
this.type = type; | ||
this.value = value; | ||
} | ||
} |
Oops, something went wrong.