| /*=============================================================================# |
| # Copyright (c) 2009, 2018 Stephan Wahlbrink and others. |
| # |
| # This program and the accompanying materials are made available under the |
| # terms of the Eclipse Public License 2.0 which is available at |
| # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 |
| # which is available at https://www.apache.org/licenses/LICENSE-2.0. |
| # |
| # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 |
| # |
| # Contributors: |
| # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation |
| #=============================================================================*/ |
| |
| package org.eclipse.statet.docmlet.wikitext.core.ast; |
| |
| import java.lang.reflect.InvocationTargetException; |
| |
| import org.eclipse.statet.docmlet.wikitext.core.ast.WikitextAst.NodeType; |
| import org.eclipse.statet.ltk.ast.core.AstNode; |
| import org.eclipse.statet.ltk.ast.core.AstVisitor; |
| |
| |
| public final class Control extends WikitextAstNode { |
| |
| |
| /** Explicite line break (<br>) */ |
| public static final String LINE_BREAK= "\n"; |
| |
| |
| private final String text; |
| |
| |
| Control(final WikitextAstNode parent, final int startOffset, final int endOffset, |
| final String text) { |
| super(parent, startOffset, endOffset); |
| |
| this.text= text; |
| } |
| |
| |
| @Override |
| public NodeType getNodeType() { |
| return NodeType.LABEL; |
| } |
| |
| @Override |
| public String getText() { |
| return this.text; |
| } |
| |
| |
| @Override |
| public boolean hasChildren() { |
| return false; |
| } |
| |
| @Override |
| public int getChildCount() { |
| return 0; |
| } |
| |
| @Override |
| public WikitextAstNode getChild(final int index) { |
| throw new IndexOutOfBoundsException(); |
| } |
| |
| @Override |
| public int getChildIndex(final AstNode element) { |
| return -1; |
| } |
| |
| @Override |
| public void acceptInChildren(final AstVisitor visitor) throws InvocationTargetException { |
| } |
| |
| @Override |
| public void acceptInWikitext(final WikitextAstVisitor visitor) throws InvocationTargetException { |
| visitor.visit(this); |
| } |
| |
| @Override |
| public void acceptInWikitextChildren(final WikitextAstVisitor visitor) throws InvocationTargetException { |
| } |
| |
| } |