Package io.vertigo.commons.peg
Class AbstractRule<R,M>
- java.lang.Object
-
- io.vertigo.commons.peg.AbstractRule<R,M>
-
- Type Parameters:
R- Type of the product text parsingM- Type of the parent parsing rule
- All Implemented Interfaces:
PegRule<R>
public abstract class AbstractRule<R,M> extends Object implements PegRule<R>
Une règle peut être vue comme - la création d'une règle principale - la gestion du résultat du parsing- Author:
- pchretien
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.vertigo.commons.peg.PegRule
PegRule.Dummy
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRule(PegRule<M> mainRule)protectedAbstractRule(PegRule<M> mainRule, String ruleName)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetExpression()protected PegRule<M>getMainRule()protected StringgetRuleName()protected abstract Rhandle(M parsing)PegResult<R>parse(String text, int start)Parser produces an object
-
-
-
Method Detail
-
getRuleName
protected final String getRuleName()
-
getExpression
public final String getExpression()
- Specified by:
getExpressionin interfacePegRule<R>- Returns:
- Expression de la règle.
-
parse
public final PegResult<R> parse(String text, int start) throws PegNoMatchFoundException
Parser produces an objector throw an exception. A parser analyzes a text, according some rules. A parser is responsible for moving the index position or throw an exception. Returns the result of the parsing operation.
- Specified by:
parsein interfacePegRule<R>- Parameters:
text- Text to parsestart- Start of the element of text to parse- Returns:
- the new index and the result
- Throws:
PegNoMatchFoundException- if parsing has failed.
-
-