Package io.karatelabs.gherkin
Class GherkinParser
java.lang.Object
io.karatelabs.parser.BaseParser
io.karatelabs.gherkin.GherkinParser
public class GherkinParser
extends io.karatelabs.parser.BaseParser
-
Nested Class Summary
Nested classes/interfaces inherited from class io.karatelabs.parser.BaseParser
io.karatelabs.parser.BaseParser.Shift -
Field Summary
Fields inherited from class io.karatelabs.parser.BaseParser
errorRecoveryEnabled, resource, tokens -
Constructor Summary
ConstructorsConstructorDescriptionGherkinParser(io.karatelabs.common.Resource resource) GherkinParser(io.karatelabs.common.Resource resource, boolean errorRecovery) -
Method Summary
Modifier and TypeMethodDescriptionio.karatelabs.parser.NodegetAst()static List<io.karatelabs.parser.Token> getTokens(io.karatelabs.common.Resource resource) parse()static MatchExpressionparseMatchExpression(String expression) Parses a match expression string into a MatchExpression object.Methods inherited from class io.karatelabs.parser.BaseParser
anyOf, anyOf, consume, consumeIf, consumeNext, consumeSoft, enter, enter, enter, enter, enterIf, enterIf, error, error, error, exit, exit, exit, exitSoft, getErrors, getPosition, hasErrors, isCallerType, lastConsumed, lastConsumedText, markerNode, next, noLineTerminatorBefore, peek, peekAnyOf, peekAnyOf, peekIf, peekToken, recoverTo, toString
-
Constructor Details
-
GherkinParser
public GherkinParser(io.karatelabs.common.Resource resource) -
GherkinParser
public GherkinParser(io.karatelabs.common.Resource resource, boolean errorRecovery)
-
-
Method Details
-
getTokens
-
getAst
public io.karatelabs.parser.Node getAst()- Returns:
- the AST root node (G_FEATURE) for IDE features
-
parse
-
parseMatchExpression
Parses a match expression string into a MatchExpression object. Uses token positions to preserve exact spacing in expressions like json['key']. The LHS is evaluated as JS by the step executor.- Parameters:
expression- e.g., "foo == bar" or "each item contains { a: 1 }"- Returns:
- parsed MatchExpression
- Throws:
RuntimeException- if the expression cannot be parsed
-