Interface IProductionRule
-
- All Known Implementing Classes:
ProductionRule
public interface IProductionRule
This class represents the interface to define the production rule for any grammar. It provides the way to define a valid token for the parser.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getName()
Returns the name of production rule.boolean
isAllowed(String token)
Checks whether the token is allowed or not.boolean
isApproaching(String pattern)
Checks whether the given token is approachable using any of the pattern or not.
-
-
-
Method Detail
-
getName
String getName()
Returns the name of production rule.- Returns:
- the name of production rule
-
isApproaching
boolean isApproaching(String pattern)
Checks whether the given token is approachable using any of the pattern or not. Given token can be partially or fully constructed token during parsing process. Parser/DefaultXMLGrammar generally calls this method to check whether the current token can be combined with next character of expression to form some meaningful token or not. If not, then it utilize the existing collected characters as one token, otherwise it keep collecting characters.- Parameters:
token
- the token, partially or full constructed, to check whether it can approach to any expression token pattern or not.- Returns:
true
if the token pattern is approachablefalse
otherwise.
-
isAllowed
boolean isAllowed(String token)
Checks whether the token is allowed or not. A token is fully constructed token. DefaultXMLGrammar/Parser generally calls this method to check whether the current token is a valid token as per the production rules or not.- Parameters:
token
- the token which is to be checked for its validity- Returns:
true
if the token is allowedfalse
otherwise.
-
-