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
;
17 * A parser of pointer lists... like x.y.z
19 * @author Matthew Khouzam - Initial API and implementation
21 public final class PointerListStringParser
implements ICommonTreeParser
{
26 public static final PointerListStringParser INSTANCE
= new PointerListStringParser();
28 private PointerListStringParser() {
32 * Creates the string representation of a type specifier.
35 * A TYPE_SPECIFIER node.
39 * @return A StringBuilder to which will be appended the string.
42 public StringBuilder
parse(CommonTree pointers
, ICommonTreeParserParameter param
) {
43 StringBuilder sb
= new StringBuilder();
44 List
<CommonTree
> pointerList
= pointers
.getChildren();
45 if (pointers
.getChildCount() == 0) {
49 for (CommonTree pointer
: pointerList
) {
51 sb
.append(" *"); //$NON-NLS-1$
52 if (pointer
.getChildCount() > 0) {
53 sb
.append(" const"); //$NON-NLS-1$