@Test public void testParsedLineIterator() { LineParser lineParser = new LineParser(); ParsedLine line = lineParser.parseLine("foo bar"); ParsedLineIterator iterator = line.iterator(); int counter = 0; while(iterator.hasNextWord()) { if(counter == 0) assertEquals("foo", iterator.pollWord()); else if(counter == 1) assertEquals("bar", iterator.pollWord()); counter++; } line = lineParser.parseLine(""); iterator = line.iterator(); assertFalse(iterator.hasNextWord()); assertNull(iterator.pollWord()); line = lineParser.parseLine("\\ foo ba bar"); iterator = line.iterator(); assertEquals(" foo", iterator.peekWord()); assertEquals(" foo", iterator.pollWord()); assertFalse(iterator.finished()); assertEquals('b', iterator.pollChar()); assertEquals('a', iterator.pollChar()); assertEquals(' ', iterator.pollChar()); assertFalse(iterator.finished()); assertEquals("bar", iterator.peekWord()); assertEquals("bar", iterator.pollWord()); assertTrue(iterator.finished()); line = lineParser.parseLine("\\ foo ba bar"); iterator = line.iterator(); assertEquals('\\', iterator.pollChar()); assertEquals(' ', iterator.pollChar()); assertEquals('f', iterator.pollChar()); assertEquals(" foo", iterator.pollWord()); assertEquals("ba", iterator.pollWord()); assertEquals('b', iterator.pollChar()); assertEquals('a', iterator.pollChar()); assertEquals('r', iterator.pollChar()); assertTrue(iterator.finished()); line = lineParser.parseLine("\\ foo ba bar"); iterator = line.iterator(); assertEquals(" foo", iterator.pollWord()); }
public ParsedLine parseLine(String text) { return parseLine(text, -1); }
LineParser { public ParsedLine parseLine(String text) { return parseLine(text, -1); } }
LineParser { public ParsedLine parseLine(String text) { return parseLine(text, -1); }  }
LineParser { public ParsedLine parseLine(String text) { return parseLine(text, -1); }  LineParser input(String text); LineParser cursor(int cursor); LineParser parseBrackets(boolean doParse); LineParser operators(EnumSet<OperatorType> operators); ParsedLine parse(); List<ParsedLine> parseWithOperators(); ParsedLine parseLine(String text); ParsedLine parseLine(String text, int cursor); ParsedLine parseLine(String text, int cursor, boolean parseCurlyAndSquareBrackets); List<ParsedLine> parseLine(String text, int cursor, boolean parseCurlyAndSquareBrackets, Set<OperatorType> operators); }
LineParser { public ParsedLine parseLine(String text) { return parseLine(text, -1); }  LineParser input(String text); LineParser cursor(int cursor); LineParser parseBrackets(boolean doParse); LineParser operators(EnumSet<OperatorType> operators); ParsedLine parse(); List<ParsedLine> parseWithOperators(); ParsedLine parseLine(String text); ParsedLine parseLine(String text, int cursor); ParsedLine parseLine(String text, int cursor, boolean parseCurlyAndSquareBrackets); List<ParsedLine> parseLine(String text, int cursor, boolean parseCurlyAndSquareBrackets, Set<OperatorType> operators);  }