X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fchr%2FCharAtom.java;h=ee3167504af81ac2c0d1625480198b9adaa6f4b0;hp=f2f8e624462feeffe1b12b5906916964894b63bb;hb=61a0c83fd40b98292b2dfe1eaba237eb804b2cb4;hpb=d28917b3c84c429e8fd6587717df9e90a894b18f diff --git a/src/edu/berkeley/sbp/chr/CharAtom.java b/src/edu/berkeley/sbp/chr/CharAtom.java index f2f8e62..ee31675 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.*; @@ -10,8 +12,6 @@ import edu.berkeley.sbp.Input.Location; public class CharAtom extends Atom { - public StringBuffer toString(StringBuffer sb) { sb.append(this); return sb; } - public CharAtom() { this(new CharTopology()); } public CharAtom(char a) { this(a,a); } public CharAtom(char a, char b) { this(new CharTopology(a, b)); } @@ -23,9 +23,9 @@ 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(); } @@ -33,7 +33,7 @@ public class CharAtom extends Atom { /** 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) { @@ -45,14 +45,17 @@ 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(); }