From cfa62077ae26cc704390719af1063fcc3dcc21d2 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 5 Aug 2006 23:21:04 -0400 Subject: [PATCH] checkpoint darcs-hash:20060806032104-5007d-f6d8dc8cda56c82e5c06b436e4a9e34412a5f565.gz --- TODO | 2 -- src/edu/berkeley/sbp/Walk.java | 3 ++- src/edu/berkeley/sbp/chr/CharInput.java | 14 +++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 280f875..e3e7dfa 100644 --- a/TODO +++ b/TODO @@ -6,8 +6,6 @@ Immediately - Annotation Tutorial - - Get at least *some* sort of moderate improvement in the error messages - .................................................. - evil problems with: (x y? z /ws) diff --git a/src/edu/berkeley/sbp/Walk.java b/src/edu/berkeley/sbp/Walk.java index 092d1ff..5e1f534 100644 --- a/src/edu/berkeley/sbp/Walk.java +++ b/src/edu/berkeley/sbp/Walk.java @@ -109,7 +109,8 @@ abstract class Walk { private final HashSet all; private boolean eof = false; public boolean includesEof() { return eof; } - public Follow(Topology cs, SequenceOrElement me, HashSet all, Cache c) { super(cs, c); this.me = me; this.all = all; } + public Follow(Topology cs, SequenceOrElement me, HashSet all, Cache c) { + super(cs, c); this.me = me; this.all = all; } public Topology bottom(SequenceOrElement e) { return cs; } public Topology sequence(Sequence seq) { return cs; } public Topology walkAtom(Atom r) { return walk((SequenceOrElement)r); } diff --git a/src/edu/berkeley/sbp/chr/CharInput.java b/src/edu/berkeley/sbp/chr/CharInput.java index b6a175d..15f1289 100644 --- a/src/edu/berkeley/sbp/chr/CharInput.java +++ b/src/edu/berkeley/sbp/chr/CharInput.java @@ -52,11 +52,19 @@ public class CharInput extends Cartesian.Input { if (end < start) end = start; if (end > cache.length()) end = cache.length(); String ret; - if (end-start < 60) ret = cache.substring(start, end); - else ret = cache.substring(start, start+25) + + if (end-start < 60) ret = cachesubstring(start, end); + else ret = cachesubstring(start, start+25) + "..." + - cache.substring(end-25, end); + cachesubstring(end-25, end); return StringUtil.escapify(ret, "\n\r"); } + private String cachesubstring(int start, int end) { + if (start < 0) start = 0; + if (end < 0) end = 0; + if (start >= cache.length()) start = cache.length(); + if (end >= cache.length()) end = cache.length(); + return cache.substring(start, end); + } + } -- 1.7.10.4