@Test public void testFindAllQuotedWords() { LineParser lineParser = new LineParser(); ParsedLine line = lineParser.parseLine("foo bar \"baz 12345\" ", 19); assertEquals("foo", line.words().get(0).word()); assertEquals(0, line.words().get(0).lineIndex()); assertEquals("bar", line.words().get(1).word()); assertEquals(4, line.words().get(1).lineIndex()); assertEquals("baz 12345", line.words().get(2).word()); assertEquals(9, line.words().get(2).lineIndex()); assertEquals("", line.selectedWord().word()); assertEquals(0, line.wordCursor()); assertFalse(line.cursorAtEnd()); line = lineParser.parseLine("java -cp \"foo/bar\" \"Example\"", 32); assertEquals("foo/bar", line.words().get(2).word()); assertEquals("Example", line.words().get(3).word()); assertTrue(line.cursorAtEnd()); line = lineParser.parseLine("'foo/bar/' Example\\ 1"); assertEquals("foo/bar/", line.words().get(0).word()); assertEquals("Example 1", line.words().get(1).word()); line = lineParser.parseLine("man -f='foo bar/' Example\\ 1 foo"); assertEquals("man", line.words().get(0).word()); assertEquals("-f=foo bar/", line.words().get(1).word()); assertEquals("Example 1", line.words().get(2).word()); assertEquals("foo", line.words().get(3).word()); line = lineParser.parseLine("man -f='foo/bar/ Example\\ 1"); assertEquals(ParserStatus.UNCLOSED_QUOTE, line.status()); line = lineParser.parseLine("man -f='foo/bar/' Example\\ 1\""); assertEquals(ParserStatus.UNCLOSED_QUOTE, line.status()); line = lineParser.parseLine("-s \'redirectUris=[\"http: assertEquals("-s", line.words().get(0).word()); assertEquals("redirectUris=[\"http: line = lineParser.parseLine("\"baz\\ 12345\""); assertEquals(line.words().toString(), "baz\\ 12345", line.words().get(0).word()); line = lineParser.parseLine("\"\\\"String with double quotes\\\"\""); assertEquals(line.words().toString(), 1, line.words().size()); assertEquals(line.words().toString(), "\\\"String with double quotes\\\"", line.words().get(0).word()); line = lineParser.parseLine("\"\\\"String with double quotes\"\\\""); assertEquals(line.words().toString(), 2, line.words().size()); assertEquals(line.words().toString(), "\\\"String with double quotes", line.words().get(0).word()); assertEquals(line.words().toString(), "\"", line.words().get(1).word()); line = lineParser.parseLine("'\\'String with single quotes\\''"); assertEquals(line.words().toString(), 1, line.words().size()); assertEquals(line.words().toString(), "\\'String with single quotes\\'", line.words().get(0).word()); line = lineParser.parseLine("'\\'String with single quotes'\\'"); assertEquals(line.words().toString(), 2, line.words().size()); assertEquals(line.words().toString(), "\\'String with single quotes", line.words().get(0).word()); assertEquals(line.words().toString(), "'", line.words().get(1).word()); }
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);  }