X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmisc%2FCharToken.java;h=72578dcac1013d3ced46a3990b1d7ba764c198d8;hp=bad43724b7101030d92ea284c20560ced16bf3ec;hb=6f995008673ec682df49866ac2e9623397c99679;hpb=0a0227b9180534d2a431f3d6e08a398bde2244c4 diff --git a/src/edu/berkeley/sbp/misc/CharToken.java b/src/edu/berkeley/sbp/misc/CharToken.java index bad4372..72578dc 100644 --- a/src/edu/berkeley/sbp/misc/CharToken.java +++ b/src/edu/berkeley/sbp/misc/CharToken.java @@ -50,6 +50,11 @@ public class CharToken implements Token, IntegerTopology.IntegerMappable { return new CharRange(new IntegerTopology(new Range.Set(new Range((int)start, (int)end)).complement().intersect(all))); } + public static CharToken left(int row, int col) { return new CharToken((char)9998, 0, 0) { public String toString() { return "{"; } }; } + public static CharToken right(int row, int col) { return new CharToken((char)9999, 0, 0) { public String toString() { return "}"; } }; } + public static final Atom leftBrace = new Atom(new IntegerTopology(9998)) { public String toString() { return "{"; } }; + public static final Atom rightBrace = new Atom(new IntegerTopology(9999)) { public String toString() { return "}"; } }; + private static final Range.Set all = new Range.Set(new Range(0, Character.MAX_VALUE)); public static final Atom any = new CharRange(new IntegerTopology(all)); public static final Atom none = new CharRange(new IntegerTopology()); @@ -86,7 +91,7 @@ public class CharToken implements Token, IntegerTopology.IntegerMappable { public final char c; public final Location location; - private CharToken(char c, int line, int col) { this(c, new CartesianLocation(line, col)); } + public CharToken(char c, int line, int col) { this(c, new CartesianLocation(line, col)); } private CharToken(char c, Location loc) { this.c = c; this.location = loc; } public String result() { return c+""; } public Location getLocation() { return location; }