Populate xpath/ hierarchy
[yangtools.git] / parser / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / antlr / AbstractToken.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.parser.rfc7950.antlr;
9
10 import static com.google.common.base.Preconditions.checkState;
11
12 import org.antlr.v4.runtime.WritableToken;
13
14 abstract class AbstractToken implements WritableToken {
15     private int tokenIndex = -1;
16
17     @Override
18     public final int getChannel() {
19         return DEFAULT_CHANNEL;
20     }
21
22     @Override
23     public final int getTokenIndex() {
24         return tokenIndex;
25     }
26
27     @Override
28     public final void setTokenIndex(final int index) {
29         checkState(tokenIndex == -1);
30         tokenIndex = index;
31     }
32
33     @Override
34     public final void setText(final String text) {
35         throw new UnsupportedOperationException();
36     }
37
38     @Override
39     public final void setType(final int ttype) {
40         throw new UnsupportedOperationException();
41     }
42
43     @Override
44     public final void setLine(final int line) {
45         throw new UnsupportedOperationException();
46     }
47
48     @Override
49     public final void setCharPositionInLine(final int pos) {
50         throw new UnsupportedOperationException();
51     }
52
53     @Override
54     public final void setChannel(final int channel) {
55         throw new UnsupportedOperationException();
56     }
57 }