52938
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2018, the original author or authors.
|
|
3 |
*
|
|
4 |
* This software is distributable under the BSD license. See the terms of the
|
|
5 |
* BSD license in the documentation provided with this software.
|
|
6 |
*
|
58903
|
7 |
* https://opensource.org/licenses/BSD-3-Clause
|
52938
|
8 |
*/
|
|
9 |
package jdk.internal.org.jline.reader;
|
|
10 |
|
|
11 |
import java.util.List;
|
|
12 |
|
|
13 |
/**
|
|
14 |
* <code>ParsedLine</code> objects are returned by the {@link Parser}
|
|
15 |
* during completion or when accepting the line.
|
|
16 |
*
|
|
17 |
* The instances should implement the {@link CompletingParsedLine}
|
|
18 |
* interface so that escape chars and quotes can be correctly handled.
|
|
19 |
*
|
|
20 |
* @see Parser
|
|
21 |
* @see CompletingParsedLine
|
|
22 |
*/
|
|
23 |
public interface ParsedLine {
|
|
24 |
|
|
25 |
/**
|
|
26 |
* The current word being completed.
|
|
27 |
* If the cursor is after the last word, an empty string is returned.
|
|
28 |
*
|
|
29 |
* @return the word being completed or an empty string
|
|
30 |
*/
|
|
31 |
String word();
|
|
32 |
|
|
33 |
/**
|
|
34 |
* The cursor position within the current word.
|
|
35 |
*
|
|
36 |
* @return the cursor position within the current word
|
|
37 |
*/
|
|
38 |
int wordCursor();
|
|
39 |
|
|
40 |
/**
|
|
41 |
* The index of the current word in the list of words.
|
|
42 |
*
|
|
43 |
* @return the index of the current word in the list of words
|
|
44 |
*/
|
|
45 |
int wordIndex();
|
|
46 |
|
|
47 |
/**
|
|
48 |
* The list of words.
|
|
49 |
*
|
|
50 |
* @return the list of words
|
|
51 |
*/
|
|
52 |
List<String> words();
|
|
53 |
|
|
54 |
/**
|
|
55 |
* The unparsed line.
|
|
56 |
*
|
|
57 |
* @return the unparsed line
|
|
58 |
*/
|
|
59 |
String line();
|
|
60 |
|
|
61 |
/**
|
|
62 |
* The cursor position within the line.
|
|
63 |
*
|
|
64 |
* @return the cursor position within the line
|
|
65 |
*/
|
|
66 |
int cursor();
|
|
67 |
|
|
68 |
}
|