Package io.vertigo.commons.peg
Interface PegRule<R>
-
- Type Parameters:
R
- Type of the product text parsing
- All Known Implementing Classes:
AbstractRule
,PegWordRule
public interface PegRule<R>
Rule used in PEG. parsing expression grammar.- Author:
- pchretien
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PegRule.Dummy
Dummy class, used for rule that returns Void.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
getExpression()
default PegResult<R>
parse(String text)
PegResult<R>
parse(String text, int start)
Parser produces an object
-
-
-
Method Detail
-
getExpression
String getExpression()
- Returns:
- Expression de la règle.
-
parse
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.
- 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.
-
parse
default PegResult<R> parse(String text) throws PegNoMatchFoundException
- Throws:
PegNoMatchFoundException
-
-