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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.tsdl
.event
;
12 import static org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.tsdl
.TsdlUtils
.concatenateUnaryStrings
;
13 import static org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.tsdl
.TsdlUtils
.isAnyUnaryString
;
15 import org
.antlr
.runtime
.tree
.CommonTree
;
16 import org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.ICommonTreeParser
;
17 import org
.eclipse
.tracecompass
.internal
.ctf
.core
.event
.metadata
.ParseException
;
20 * Parser for event names
22 * @author Matthew Khouzam
25 public final class EventNameParser
implements ICommonTreeParser
{
29 public static final EventNameParser INSTANCE
= new EventNameParser();
31 private EventNameParser() {
35 public String
parse(CommonTree tree
, ICommonTreeParserParameter param
) throws ParseException
{
36 CommonTree firstChild
= (CommonTree
) tree
.getChild(0);
38 if (isAnyUnaryString(firstChild
)) {
39 return concatenateUnaryStrings(tree
.getChildren());
41 throw new ParseException("invalid value for event name"); //$NON-NLS-1$