Populate parser/ hierarchy
[yangtools.git] / parser / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / antlr / ExplicitTextToken.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 java.util.Objects.requireNonNull;
11
12 import org.antlr.v4.runtime.CharStream;
13 import org.antlr.v4.runtime.TokenSource;
14
15 final class ExplicitTextToken extends AbstractToken {
16     private final int type;
17     private final String text;
18
19     ExplicitTextToken(final int type, final String text) {
20         this.type = type;
21         this.text = requireNonNull(text);
22     }
23
24     @Override
25     public String getText() {
26         return text;
27     }
28
29     @Override
30     public int getType() {
31         return type;
32     }
33
34     @Override
35     public int getLine() {
36         // TODO: this mimics CommonToken, but is probably not right
37         return 0;
38     }
39
40     @Override
41     public int getCharPositionInLine() {
42         return -1;
43     }
44
45     @Override
46     public int getStartIndex() {
47         // TODO: this mimics CommonToken, but is probably not right
48         return 0;
49     }
50
51     @Override
52     public int getStopIndex() {
53         // TODO: this mimics CommonToken, but is probably not right
54         return 0;
55     }
56
57     @Override
58     public TokenSource getTokenSource() {
59         return null;
60     }
61
62     @Override
63     public CharStream getInputStream() {
64         return null;
65     }
66 }