Package org.jacop.util.fsm
Class RegularExpressionParser
- java.lang.Object
-
- org.jacop.util.fsm.RegularExpressionParser
-
public class RegularExpressionParser extends java.lang.ObjectInstances of this class parse the word combination little language.- Version:
- 4.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classRegularExpressionParser.ConcatinationclassRegularExpressionParser.ExpressionIt creates an abstract class expression which specifies basic methods of the expression.classRegularExpressionParser.LiteralIt specifies a simple literal.(package private) classRegularExpressionParser.Star(package private) classRegularExpressionParser.Sumstatic classRegularExpressionParser.SyntaxExceptionSyntaxException raised if not regular expression is being parsed.
-
Field Summary
Fields Modifier and Type Field Description static intConcatenationThe constant denoting concatenation expression.static intExpressionConstant denoting an expression.private LexicalAnalyzerlexerstatic intLiteralThe constant denoting simple literal.static intStarThe constant denoting star expression.static intSumThe constant denoting sum expression.private inttoken
-
Constructor Summary
Constructors Constructor Description RegularExpressionParser(java.io.StringReader input)It constructs a parser of the regular expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidexpect(int t)Complain if the current token is not the specified kind of token.RegularExpressionParser.Expressionparse(boolean parseOneNext)This method parses an expression that it reads from a given input stream.private java.lang.StringtokenName(int t)
-
-
-
Field Detail
-
lexer
private LexicalAnalyzer lexer
-
token
private int token
-
Expression
public static final int Expression
Constant denoting an expression.- See Also:
- Constant Field Values
-
Literal
public static final int Literal
The constant denoting simple literal.- See Also:
- Constant Field Values
-
Concatenation
public static final int Concatenation
The constant denoting concatenation expression.- See Also:
- Constant Field Values
-
Star
public static final int Star
The constant denoting star expression.- See Also:
- Constant Field Values
-
Sum
public static final int Sum
The constant denoting sum expression.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RegularExpressionParser
public RegularExpressionParser(java.io.StringReader input) throws RegularExpressionParser.SyntaxExceptionIt constructs a parser of the regular expression.- Parameters:
input- string reader containing the regular expression.- Throws:
RegularExpressionParser.SyntaxException- if first token is neither word or left parenthesis.
-
-
Method Detail
-
parse
public RegularExpressionParser.Expression parse(boolean parseOneNext) throws RegularExpressionParser.SyntaxException
This method parses an expression that it reads from a given input stream.- Parameters:
parseOneNext- if parsing should parse only one item.- Returns:
- An expression that is the root of the parse tree produced by the parser.
- Throws:
RegularExpressionParser.SyntaxException- execption rised when syntax is not followed
-
expect
private void expect(int t) throws RegularExpressionParser.SyntaxExceptionComplain if the current token is not the specified kind of token.- Parameters:
t- The type of token that is expected.- Throws:
RegularExpressionParser.SyntaxException
-
tokenName
private java.lang.String tokenName(int t)
-
-