/* * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.parser.rfc7950.antlr; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.TokenSource; import org.antlr.v4.runtime.misc.Pair; /** * Intermediate general token implementation. This cuts {@code channel}, {@code text} fields completely, as we typically * we do not use them. {@code type} and {@code charPositionInLine} are cut down to a single byte, and {@code line} is * cut down to an unsigned short. {@code startIndex} and {@code stopIndex} are kept at full four-byte range, this making * this implementation useful beyond 64K-char file mark. * *
* This class ends up costing 32/48/32/32 bytes instead of 48/64/48/48 bytes, a saving of 33% in the same scenarios as
* {@link Token12122} across all possible file sizes.
*/
final class Token12144 extends AbstractSourceToken {
private final byte type;
private final short line;
private final byte charPositionInLine;
private final int startIndex;
private final int stopIndex;
Token12144(final Pair