Class ParseTreeVisitorPrinter

java.lang.Object
dev.galasa.framework.spi.language.gherkin.xform.ParseTreeVisitorBase
dev.galasa.framework.spi.language.gherkin.xform.ParseTreeVisitorPrinter
All Implemented Interfaces:
ParseTreeVisitor

public class ParseTreeVisitorPrinter extends ParseTreeVisitorBase
A visitor of the parse tree which can turn an entire parse tree into a single string, for easy output or comparing against test data. Each nested level of children is indented by a few spaces so it looks like an acual hierarchy of some sort. For example: This gherkin feature: Feature: GherkinLog Scenario Outline: Log Example Statement THEN Write to log "This is a log the item: " THEN Write to log "Log the value: " Examples: | Item | Cost | | apple | 89 | | pineapple | 339 | Will render into something like this: {token:, line:1, text:GherkinLog} {token:Feature:, line:1, text:GherkinLog} {token:, line:2, text:Log Example Statement} {token:, line:2, text:Log Example Statement} {token:, line:2, text:Log Example Statement} {token:Scenario Outline:, line:2, text:Log Example Statement} {token:, line:4, text:THEN Write to log "This is a log the item: "} {token:step, line:4, text:THEN Write to log "This is a log the item: "} {token:, line:5, text:THEN Write to log "Log the value: "} {token:step, line:5, text:THEN Write to log "Log the value: "} {token:, line:7, text:} {token:Examples:, line:7, text:} {token:, line:8, text:| Item | Cost |} {token:, line:8, text:| Item | Cost |} {token:data line, line:8, text:| Item | Cost |} {token:, line:9, text:| apple | 89 |} {token:data line, line:9, text:| apple | 89 |} {token:, line:10, text:| pineapple | 339 |} {token:data line, line:10, text:| pineapple | 339 |} {token:, line:0, text:} {token:, line:11, text:}