| java.lang.Object xtc.tree.Visitor xtc.lang.jeannie.JeanniePrinter
All known Subclasses: xtc.lang.jeannie.DebuggerAstPrinter,
JeanniePrinter | public class JeanniePrinter extends Visitor (Code) | | A pretty printer for Jeannie (pretty JNI).
This is an example of combining two visitors (CPrinter and JavaPrinter). But it
is slightly unusual in that those visitors don't call dispatch() on themselves for
children directly; instead, they call it indirectly through Printer, which is not
a visitor itself.
TD 41 double-check that this takes care of precedence, dangling else, and such
Simplified abstract Jeannie grammar:
This grammar describes the kinds of AST nodes that can occur in a Jeannie AST; in
addition, all AST nodes from the plain C and Java grammars that are not modified here
can also occur. See JavaAstSimplifier for notation explanation.
Notation explanation
Whole = Part1 Part2 ... PartN | the Whole consists of all the parts Parti
| Whole = Part1 / Part2 / ... / PartN | the Whole consists of one of the parts Parti
| Super > Sub1, Sub2, ..., SubN | any of the Subi can appear where a Super is expected
| Super > {Pre1,Pre2,...,PreN}Sub | shorthand for Super > Pre1Sub, Pre2Sub, ..., PreNSub
| Super : Lit1, Lit2, ..., LitN | shorthand for Super > "Lit1", "Lit2", ..., "LitN"
| [Option] | zero or one occurrences
| Repetee* | zero or more occurrences
| Repetee+ | one or more occurrences
| "token" | literal string token
|
Modifications to Java grammar
CompilationUnit | = | CDeclarations [PackageDeclaration] ImportDeclaration* JeannieJava.Declaration*
| Block | > | JavaInJavaBlock, CInJavaBlock
| JeannieJava.Expression | > | ..., CInJavaExpression
|
Modifications to C grammar
TranslationUnit | = | [JavaImports] ExternalDeclaration* Annotations
| CompoundStatement | > | CInCBlock, JavaInCBlock
| FunctionDeclarator | = | (ParameterTypeList / IdentifierList) JavaThrows
| JeannieC.Statement | > | ..., JavaInCStatement, CancelStatement, CommitStatement, WithStatement
| JeannieC.UnaryExpression | > | ..., JavaInCExpression
| TypeSpecifier | > | ..., JavaType
|
New productions
JeannieFile | > | TranslationUnit, CompilationUnit
| CDeclarations | = | ExternalDeclaration*
| CInCBlock | = | LocalLabelDeclaration* JeannieC.DeclarationOrStatement* Annotations
| CInJavaBlock | = | CInCBlock
| CInJavaExpression | = | JeannieC.UnaryExpression
| JavaImports | = | ImportDeclaration*
| JavaInCBlock | = | JavaInJavaBlock
| JavaInCExpression | = | JeannieJava.UnaryExpression
| JavaInCStatement | = | TryStatement / SynchronizedStatement / ThrowStatement
| JavaInJavaBlock | = | JeannieJava.DeclarationOrStatement*
| JavaThrows | = | [ThrowsClause]
| JavaType | = | QualifiedIdentifier
| CancelStatement | = | JeannieC.PrimaryIdentifier
| CommitStatement | = | JeannieC.PrimaryIdentifier
| WithStatement | = | WithInitializer CInCBlock
| WithInitializer | > | JeannieC.Declaration, JeannieC.AssignmentExpression
|
author: Martin Hirzel version: $Revision: 1.6 $ |
Inner Class : enum TransitionKind | |
enterC | final void enterC(TransitionKind transitionKind)(Code) | | |
enterJava | final void enterJava(TransitionKind transitionKind)(Code) | | |
exitJava | final void exitJava()(Code) | | |
visitBlock | final public void visitBlock(GNode n)(Code) | | Visit a Block > JavaInJavaBlock, CInJavaBlock.
|
visitCDeclarations | final public void visitCDeclarations(GNode n)(Code) | | Visit a CDeclarations = ExternalDeclaration*.
|
visitCInCBlock | final public void visitCInCBlock(GNode n)(Code) | | Visit a CInCBlock = LocalLabelDeclaration* JeannieC.DeclarationOrStatement* Annotations.
|
visitCInJavaBlock | final public void visitCInJavaBlock(GNode n)(Code) | | Visit a CInJavaBlock = CInCBlock.
|
visitCInJavaExpression | final public void visitCInJavaExpression(GNode n)(Code) | | Visit a CInJavaExpression = JeannieC.UnaryExpression.
|
visitCancelStatement | final public void visitCancelStatement(GNode n)(Code) | | Visit a CancelStatement = JeannieC.PrimaryIdentifier.
|
visitCommitStatement | final public void visitCommitStatement(GNode n)(Code) | | Visit a CommitStatement = JeannieC.PrimaryIdentifier.
|
visitCompilationUnit | final public void visitCompilationUnit(GNode n)(Code) | | Visit a CompilationUnit = CDeclarations [PackageDeclaration] ImportDeclaration* JeannieJava.Declaration*.
|
visitCompoundStatement | final public void visitCompoundStatement(GNode n)(Code) | | Visit a CompoundStatement > CInCBlock, JavaInCBlock.
|
visitFile | final public void visitFile(GNode n)(Code) | | Visit a File > TranslationUnit, CompilationUnit.
|
visitFunctionDeclarator | final public void visitFunctionDeclarator(GNode n)(Code) | | Visit a FunctionDeclarator = (ParameterTypeList / IdentifierList) JavaThrows.
|
visitJavaImports | final public void visitJavaImports(GNode n)(Code) | | Visit a JavaImports = ImportDeclaration*.
|
visitJavaInCBlock | final public void visitJavaInCBlock(GNode n)(Code) | | Visit a JavaInCBlock = JavaInJavaBlock.
|
visitJavaInCExpression | final public void visitJavaInCExpression(GNode n)(Code) | | Visit a JavaInCExpression = JeannieJava.UnaryExpression.
|
visitJavaInCStatement | final public void visitJavaInCStatement(GNode n)(Code) | | Visit a JavaInCStatement = TryStatement / SynchronizedStatement / ThrowStatement.
|
visitJavaInJavaBlock | final public void visitJavaInJavaBlock(GNode n)(Code) | | Visit a JavaInJavaBlock = JeannieJava.DeclarationOrStatement*.
|
visitJavaThrows | final public void visitJavaThrows(GNode n)(Code) | | Visit a JavaThrows = [ThrowsClause].
|
visitJavaType | final public void visitJavaType(GNode n)(Code) | | Visit a JavaType = QualifiedIdentifier.
|
visitTranslationUnit | final public void visitTranslationUnit(GNode n)(Code) | | Visit a TranslationUnit = [JavaImports] ExternalDeclaration* Annotations.
|
visitWithStatement | final public void visitWithStatement(GNode n)(Code) | | Visit a WithStatement = (JeannieC.Declaration / JeannieC.AssignmentExpression) CInCBlock.
|
|
|