@Test public void testArgumentParsing () { String[] args = new String[] { "0", "1", "2", "3", "4" }; String result; result = ArgumentParser.replaceArgs ("abcdefg", args); Assert.assertEquals ("abcdefg", result); result = ArgumentParser.replaceArgs ("ab $1 $5 cd", args); Assert.assertEquals ("ab 1 cd", result); result = ArgumentParser.replaceArgs ("ab $(1) $(5) cd", args); Assert.assertEquals ("ab 1 cd", result); result = ArgumentParser.replaceArgs ("ab $1 $ cd", args); Assert.assertEquals ("ab 1 $ cd", result); result = ArgumentParser.replaceArgs ("ab $1 $* cd", args); Assert.assertEquals ("ab 1 0 1 2 3 4 cd", result); result = ArgumentParser.replaceArgs ("ab $1 $@ cd", args); Assert.assertEquals ("ab 1 0 1 2 3 4 cd", result); result = ArgumentParser.replaceArgs ("ab $(1) cd", args); Assert.assertEquals ("ab 1 cd", result); result = ArgumentParser.replaceArgs ("ab $(1-3) cd", args); Assert.assertEquals ("ab 1 2 3 cd", result); result = ArgumentParser.replaceArgs ("ab $(3-1) cd", args); Assert.assertEquals ("ab 3 2 1 cd", result); result = ArgumentParser.replaceArgs ("ab $(3-) cd", args); Assert.assertEquals ("ab 3 4 cd", result); result = ArgumentParser.replaceArgs ("ab $(3- ) cd", args); Assert.assertEquals ("ab $(3- ) cd", result); }
public static String replaceArgs (String str, String[] args) { ArgumentParser parser = new ArgumentParser (args); parser.setInput (new StringReader (str)); try { parser.yyLex (); return parser.getString (); } catch (IOException ex) { } return str; }
ArgumentParser extends GeneratedArgumentParser { public static String replaceArgs (String str, String[] args) { ArgumentParser parser = new ArgumentParser (args); parser.setInput (new StringReader (str)); try { parser.yyLex (); return parser.getString (); } catch (IOException ex) { } return str; } }
ArgumentParser extends GeneratedArgumentParser { public static String replaceArgs (String str, String[] args) { ArgumentParser parser = new ArgumentParser (args); parser.setInput (new StringReader (str)); try { parser.yyLex (); return parser.getString (); } catch (IOException ex) { } return str; } private  ArgumentParser(String[] args); }
ArgumentParser extends GeneratedArgumentParser { public static String replaceArgs (String str, String[] args) { ArgumentParser parser = new ArgumentParser (args); parser.setInput (new StringReader (str)); try { parser.yyLex (); return parser.getString (); } catch (IOException ex) { } return str; } private  ArgumentParser(String[] args); static String replaceArgs(String str, String[] args); }
ArgumentParser extends GeneratedArgumentParser { public static String replaceArgs (String str, String[] args) { ArgumentParser parser = new ArgumentParser (args); parser.setInput (new StringReader (str)); try { parser.yyLex (); return parser.getString (); } catch (IOException ex) { } return str; } private  ArgumentParser(String[] args); static String replaceArgs(String str, String[] args);  }