1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.parser.ast.type.visitor;
14 import org.simantics.databoard.parser.ast.type.AstArrayType;
\r
15 import org.simantics.databoard.parser.ast.type.AstComponent;
\r
16 import org.simantics.databoard.parser.ast.type.AstRecordType;
\r
17 import org.simantics.databoard.parser.ast.type.AstTupleType;
\r
18 import org.simantics.databoard.parser.ast.type.AstType;
\r
19 import org.simantics.databoard.parser.ast.type.AstTypeReference;
\r
20 import org.simantics.databoard.parser.ast.type.AstUnionType;
\r
22 public class AstTypePrinter implements AstTypeVisitorVoid {
23 StringBuilder b = new StringBuilder();
26 public void visit(AstArrayType arrayType) {
27 arrayType.componentType.accept(this);
32 public void visit(AstRecordType recordType) {
35 for(AstComponent component : recordType.components) {
40 b.append(component.name);
42 component.type.accept(this);
48 public void visit(AstTupleType tupleType) {
51 for(AstType component : tupleType.components) {
56 component.accept(this);
62 public void visit(AstTypeReference typeReference) {
63 b.append(typeReference.name);
64 if(!typeReference.parameters.isEmpty()) {
67 for(AstType component : typeReference.parameters) {
72 component.accept(this);
79 public void visit(AstUnionType unionType) {
81 for(AstComponent component : unionType.components) {
86 b.append(component.name);
88 component.type.accept(this);
93 public String toString() {