From 5f3fb9afece2125cbeba79d61a8d88460b7878d7 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Tue, 27 Jan 2015 18:40:32 -0700 Subject: initial commit --- .../modulus/dataread/expressions/ParseRules.java | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 project/JavaCommon/src/com/modulus/dataread/expressions/ParseRules.java (limited to 'project/JavaCommon/src/com/modulus/dataread/expressions/ParseRules.java') diff --git a/project/JavaCommon/src/com/modulus/dataread/expressions/ParseRules.java b/project/JavaCommon/src/com/modulus/dataread/expressions/ParseRules.java new file mode 100644 index 0000000..a48f3b9 --- /dev/null +++ b/project/JavaCommon/src/com/modulus/dataread/expressions/ParseRules.java @@ -0,0 +1,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 off 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 off + * a folder is being opened. + * + * @param off the position in the code + * @return true if at position off a + * folder is being opened. + */ + boolean openFolder( int off ); + + /** + * returns true if at position off + * a folder is being closed in the code. + * + * @param off the position of the parser + * @return if a folder is being closed at position off + */ + boolean closeFolder( int off ); + + /** + * returns true if a statement is terminated at position off + * + * @param off the position in the code. + * @return true if a statement is terminated at position off + */ + 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(); +} -- cgit