Package org.jacop.util.fsm
Class RegularExpressionParser
- java.lang.Object
-
- org.jacop.util.fsm.RegularExpressionParser
-
public class RegularExpressionParser extends java.lang.Object
Instances of this class parse the word combination little language.- Version:
- 4.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
RegularExpressionParser.Concatination
class
RegularExpressionParser.Expression
It creates an abstract class expression which specifies basic methods of the expression.class
RegularExpressionParser.Literal
It specifies a simple literal.(package private) class
RegularExpressionParser.Star
(package private) class
RegularExpressionParser.Sum
static class
RegularExpressionParser.SyntaxException
SyntaxException raised if not regular expression is being parsed.
-
Field Summary
Fields Modifier and Type Field Description static int
Concatenation
The constant denoting concatenation expression.static int
Expression
Constant denoting an expression.private LexicalAnalyzer
lexer
static int
Literal
The constant denoting simple literal.static int
Star
The constant denoting star expression.static int
Sum
The constant denoting sum expression.private int
token
-
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 void
expect(int t)
Complain if the current token is not the specified kind of token.RegularExpressionParser.Expression
parse(boolean parseOneNext)
This method parses an expression that it reads from a given input stream.private java.lang.String
tokenName(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.SyntaxException
It 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.SyntaxException
Complain 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)
-
-