1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.tsdl
;
11 import java
.util
.List
;
13 import org
.antlr
.runtime
.tree
.CommonTree
;
14 import org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.ICommonTreeParser
;
15 import org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.ParseException
;
18 * Type specifier list string parser, parses a list of names
20 * @author Matthew Khouzam
23 public final class TypeSpecifierListStringParser
implements ICommonTreeParser
{
28 public static final TypeSpecifierListStringParser INSTANCE
= new TypeSpecifierListStringParser();
30 private TypeSpecifierListStringParser() {
34 * Creates the string representation of a type specifier.
36 * @param typeSpecifierList
37 * A TYPE_SPECIFIER node.
41 * @return A StringBuilder to which will be appended the string.
42 * @throws ParseException
46 public StringBuilder
parse(CommonTree typeSpecifierList
, ICommonTreeParserParameter param
) throws ParseException
{
47 StringBuilder sb
= new StringBuilder();
48 List
<CommonTree
> children
= typeSpecifierList
.getChildren();
50 boolean firstItem
= true;
52 for (CommonTree child
: children
) {
60 /* Append the string that represents this type specifier. */
61 sb
.append(TypeSpecifierListNameParser
.INSTANCE
.parse(child
, null));