/[svn]/jlscp/trunk/src/org/linuxsampler/lscp/Parser.java
ViewVC logotype

Diff of /jlscp/trunk/src/org/linuxsampler/lscp/Parser.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1325 by iliev, Mon Aug 27 13:34:34 2007 UTC revision 1326 by iliev, Fri Sep 7 11:03:52 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *   jlscp - a java LinuxSampler control protocol API   *   jlscp - a java LinuxSampler control protocol API
3   *   *
4   *   Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of jlscp.   *   This file is part of jlscp.
7   *   *
# Line 156  final class Parser { Line 156  final class Parser {
156                                    
157                  return far;                  return far;
158          }          }
159            
160          /**          /**
161           * Parses a comma separated list whose items are encapsulated into apostrophes.           * Parses a comma separated list whose items are not encapsulated into apostrophes.
162           * @param list The comma separated list.           * @param list The comma separated list.
163           * @return A <code>String</code> array containing all items in the list.           * @return A <code>String</code> array containing all items in the list.
164           * @throws LscpException if the list is broken.           * @throws LscpException if the list is broken.
165           */           */
166          protected static String[]          protected static String[]
167          parseStringList(String list) throws LscpException {          parseStringList(String list) throws LscpException {
168                  return parseStringList(list, ',');                  list = removeQuotation(list);
169                    return parseList(list);
170            }
171            
172            /**
173             * Parses a comma separated list whose items are encapsulated into apostrophes.
174             * @param list The comma separated list.
175             * @return A <code>String</code> array containing all items in the list.
176             * @throws LscpException if the list is broken.
177             */
178            protected static String[]
179            parseQuotedStringList(String list) throws LscpException {
180                    return parseQuotedStringList(list, ',');
181          }          }
182                    
183          /**          /**
# Line 175  final class Parser { Line 188  final class Parser {
188           * @throws LscpException if the list is broken.           * @throws LscpException if the list is broken.
189           */           */
190          protected static String[]          protected static String[]
191          parseStringList(String list, char separator) throws LscpException {          parseQuotedStringList(String list, char separator) throws LscpException {
192                  if(list == null || list.length() == 0) return new String[0];                  if(list == null || list.length() == 0) return new String[0];
193                  int q1 = 0, q2 = 0;                  int q1 = 0, q2 = 0;
194                  Vector<String> v = new Vector<String>();                  Vector<String> v = new Vector<String>();
# Line 206  final class Parser { Line 219  final class Parser {
219                  String[][] s2S;                  String[][] s2S;
220                  if(!list.startsWith("''") && !list.startsWith("\"\"")) {                  if(!list.startsWith("''") && !list.startsWith("\"\"")) {
221                          s2S = new String[1][];                          s2S = new String[1][];
222                          s2S[0] = parseStringList(list);                          s2S[0] = parseQuotedStringList(list);
223                          return s2S;                          return s2S;
224                  }                  }
225                                                    
# Line 223  final class Parser { Line 236  final class Parser {
236                  }                  }
237                                    
238                  s2S = new String[v.size()][];                  s2S = new String[v.size()][];
239                  for(i = 0; i < v.size(); i++) s2S[i] = Parser.parseStringList(v.get(i));                  for(i = 0; i < v.size(); i++) s2S[i] = parseQuotedStringList(v.get(i));
240                                    
241                  return s2S;                  return s2S;
242          }          }

Legend:
Removed from v.1325  
changed lines
  Added in v.1326

  ViewVC Help
Powered by ViewVC