Top Description Fields Constructors Methods
org.antlr.v4.codegen

public Class OutputModelWalker

extends Object
Class Inheritance
Imports
org.antlr.v4.Tool, org.antlr.v4.codegen.model.ModelElement, .OutputModelObject, org.antlr.v4.tool.ErrorType, org.stringtemplate.v4.ST, .STGroup, org.stringtemplate.v4.compiler.FormalArgument, java.lang.reflect.Field, java.util.Arrays, .Collection, .HashSet, .Iterator, .LinkedHashMap, .Map, .Set

Convert an output model tree to template hierarchy by walking the output model. Each output model object has a corresponding template of the same name. An output model object can have nested objects. We identify those nested objects by the list of arguments in the template definition. For example, here is the definition of the parser template: Parser(parser, scopes, funcs) ::= <<...>> The first template argument is always the output model object from which this walker will create the template. Any other arguments identify the field names within the output model object of nested model objects. So, in this case, template Parser is saying that output model object Parser has two fields the walker should chase called a scopes and funcs. This simple mechanism means we don't have to include code in every output model object that says how to create the corresponding template.

Field Summary

Modifier and TypeField and Description
pack-priv STGroup
pack-priv Tool

Constructor Summary

AccessConstructor and Description
public
OutputModelWalker(Tool tool, STGroup templates)

Method Summary

Modifier and TypeMethod and Description
public ST
walk(OutputModelObject omo, boolean header)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

templatesback to summary
pack-priv STGroup templates
toolback to summary
pack-priv Tool tool

Constructor Detail

OutputModelWalkerback to summary
public OutputModelWalker(Tool tool, STGroup templates)

Method Detail

walkback to summary
public ST walk(OutputModelObject omo, boolean header)