Skip to content

Commit a0fcd84

Browse files
committed
Misc edits
1 parent b82b59e commit a0fcd84

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

convex-core/src/main/antlr4/convex/core/json/reader/antlr/JSON5.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ STRING
6363
;
6464

6565
fragment ESC
66-
: '\\' (["\\/bfnrt] | UNICODE)
66+
: '\\' (["\\/bfnrtv0] | UNICODE)
6767
;
6868
6969
fragment UNICODE

convex-core/src/main/java/convex/core/cvm/Address.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public AType getType() {
9393
@Override
9494
public boolean equals(ACell o) {
9595
if (o==this) return true;
96-
if (o instanceof Address) {
97-
return value==((Address) o).value;
96+
if (o instanceof Address addr) {
97+
return value==addr.value;
9898
} else {
9999
return Cells.equalsGeneric(this, o);
100100
}
@@ -158,14 +158,13 @@ public static Address parse(String s) {
158158
*/
159159
public static Address parse(Object o) {
160160
if (o==null) return null;
161-
if (o instanceof ACell) {
162-
Address add=RT.castAddress((ACell)o);
161+
if (o instanceof ACell cell) {
162+
Address add=RT.castAddress(cell);
163163
if (add!=null) return add;
164-
o=RT.jvm((ACell)o); // convert to JVM type
164+
o=RT.jvm((ACell)o); // convert to JVM type, last try (e.g. BigInteger)
165165
}
166-
if (o instanceof String) return parse((String)o);
167-
if (o instanceof Number) {
168-
Number n=(Number)o;
166+
if (o instanceof String s) return parse(s);
167+
if (o instanceof Number n) {
169168
long l=n.longValue();
170169
if (l==n.doubleValue()) return Address.create(l);
171170
}

0 commit comments

Comments
 (0)