X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fchr%2FCharAtom.java;h=45c85b95a1ca94c7af6f891a2b0746d216db94d0;hp=89a45ad154ff1603eaac320f7a74eab792a11611;hb=987a3f1d9ae796bb8db1294654125b07255128a5;hpb=173e1696d10a91db6f5a919dbb2b2ed2c6e2a227 diff --git a/src/edu/berkeley/sbp/chr/CharAtom.java b/src/edu/berkeley/sbp/chr/CharAtom.java index 89a45ad..45c85b9 100644 --- a/src/edu/berkeley/sbp/chr/CharAtom.java +++ b/src/edu/berkeley/sbp/chr/CharAtom.java @@ -1,3 +1,5 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + package edu.berkeley.sbp.chr; import java.io.*; import java.util.*; @@ -21,18 +23,17 @@ public class CharAtom extends Atom { public static final char left = (char)9998; public static final char right = (char)9999; - public static final Atom leftBrace = new CharAtom(left,left) { public String toString() { return "[{]"; } }; - public static final Atom rightBrace = new CharAtom(right,right) { public String toString() { return "[}]"; } }; - public static final Atom braces = new CharAtom(left,right) { public String toString() { return "[{}]"; } }; + public static final Atom leftBrace = new CharAtom(left,left) { public String toString() { return "\\{"; } }; + public static final Atom rightBrace = new CharAtom(right,right) { public String toString() { return "\\}"; } }; + public static final Atom braces = new CharAtom(left,right) { public String toString() { return "[\\{\\}]"; } }; public static Atom set(Range.Set r) { return new CharAtom(new CharTopology(r)); } - public String toString() { return t.toString(); } /** returns an element which exactly matches the string given */ public static Element string(String s) { return string(s, true); } public static Element string(String s, boolean share) { - if (share && s.length() == 0) return epsilon; + if (share && s.length() == 0) return emptyString; final String escapified = "\""+StringUtil.escapify(s, "\"\r\n\\")+"\""; Element ret; if (share && s.length() == 1) { @@ -44,18 +45,21 @@ public class CharAtom extends Atom { public String toString() { return escapified; } }; Element[] refs = new Element[s.length()]; for(int i=0; i> unwrap() { return this; } public Topology> empty() { return new CharAtom(); } - public Topology underlying() { return top(); } + public Topology getTokenTopology() { return top(); } public boolean contains(Atom v) { return top().containsAll(((CharAtom)v).top()); } public boolean disjoint(Topology> t) { return top().disjoint(((CharAtom)t).top()); }