From: Jim Procter Date: Fri, 14 Jun 2013 15:17:58 +0000 (+0100) Subject: JAL-1316 recognise and extract quoted region as nodename X-Git-Tag: Jalview_2_9~241^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e85b1902d37f75f3b4b68a5f4b8f21b8e7261b1d;p=jalview.git JAL-1316 recognise and extract quoted region as nodename --- diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index d664dcf..d653811 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -292,6 +292,7 @@ public class NewickFile extends FileParse int nextcp = 0; int ncp = cp; + boolean parsednodename=false; while (majorsyms.searchFrom(nf, cp) && (Error == null)) { int fcp = majorsyms.matchedFrom(); @@ -349,14 +350,16 @@ public class NewickFile extends FileParse case '\'': com.stevesoft.pat.Regex qnodename = new com.stevesoft.pat.Regex( - "([^']|'')+'"); + "'([^']|'')+'"); if (qnodename.searchFrom(nf, fcp)) { int nl = qnodename.stringMatched().length(); - nodename = new String(qnodename.stringMatched().substring(0, + nodename = new String(qnodename.stringMatched().substring(1, nl - 1)); - cp = fcp + nl + 1; + // jump to after end of quoted nodename + nextcp = fcp + nl + 1; + parsednodename=true; } else { @@ -425,7 +428,7 @@ public class NewickFile extends FileParse com.stevesoft.pat.Regex ndist = new com.stevesoft.pat.Regex( ":([-0-9Ee.+]+)"); - if (uqnodename.search(fstring) + if (!parsednodename && uqnodename.search(fstring) && ((uqnodename.matchedFrom(1) == 0) || (fstring .charAt(uqnodename.matchedFrom(1) - 1) != ':'))) // JBPNote // HACK! @@ -584,6 +587,7 @@ public class NewickFile extends FileParse distance = DefDistance; bootstrap = DefBootstrap; commentString2 = null; + parsednodename=false; } if (nextcp == 0) {