aboutsummaryrefslogtreecommitdiff
path: root/project/JavaCommon/src/com/modulus/dataread/expressions/ParseRules.java
blob: a48f3b9b1209fc9b6dd869a7d7a0a70d6f55bf85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.modulus.dataread.expressions;

/**
 * Interface defines a set of rules used to parse
 * text files. These rules include such rules like
 * in string or folder start and end etc.
 * 
 * @author jrahm
 *
 */
public interface ParseRules {
	/**
	 * First formats the code to make
	 * life much easier for the parser.
	 * 
	 * This should be the first method to be
	 * called at all times.
	 */
	void format();
	
	/**
	 * Signals these parse rules that the user has read the character at
	 * the point <code>off</code> of which the parser dictates how much
	 * code to skip.
	 * 
	 * @param off point in the code which was read
	 * @return how many characters the parser should skip.
	 */
	int read( int off );
	
	/**
	 * Returns true if the parser is in quotes, false otherwise.
	 * 
	 * @return true if the parser is in quotes, false otherwuse. 
	 */
	boolean inQuotes();
	
	/**
	 * Returns true if the parser is in a
	 * comment or not.
	 * 
	 * @return true if the parser is in a
	 * comment or not.
	 */
	boolean inComment();
	
	/**
	 * returns true if at position <code>off</code>
	 * a folder is being opened.
	 * 
	 * @param off the position in the code
	 * @return true if at position <code>off</code> a
	 * folder is being opened.
	 */
	boolean openFolder( int off );
	
	/**
	 * returns true if at position <code>off</code>
	 * a folder is being closed in the code.
	 * 
	 * @param off the position of the parser
	 * @return if a folder is being closed at position <code>off</code>
	 */
	boolean closeFolder( int off );
	
	/**
	 * returns true if a statement is terminated at position <code>off</code>
	 * 
	 * @param off the position in the code.
	 * @return true if a statement is terminated at position <code>off</code>
	 */
	boolean statementTerminated( int off );
	
	/**
	 * Returns the code which these parse rules are using.
	 * @return the code which these parse rules are using.
	 */
	String getCode();
	
	/**
	 * Returns the line number of this reader
	 */
	int getLineNumber();
}