antlr-ng
Version:
Next generation ANTLR Tool
30 lines (29 loc) • 1.81 kB
TypeScript
import { ATN } from "antlr4ng";
import { IOutputModelFactory } from "../IOutputModelFactory.js";
import { SerializedATN } from "./SerializedATN.js";
/** A serialized ATN for the Java target, which requires we use strings and 16-bit unicode values. */
export declare class SerializedJavaATN extends SerializedATN {
/** Only valid if there's a single segment. */
readonly serializedAsString: string[];
private readonly segments;
constructor(factory: IOutputModelFactory, atn: ATN);
getSegments(): string[][];
/**
* Given a list of integers representing a serialized ATN, encode values too large to fit into 15 bits
* as two 16-bit values. We use the high bit (0x8000_0000) to indicate values requiring two 16-bit words.
* If the high bit is set, we grab the next value and combine them to get a 31-bit value. The possible
* input int values are [-1,0x7FFF_FFFF].
*
* | compression/encoding | uint16 count | type |
* | -------------------------------------------- | ------------ | --------------- |
* | 0xxxxxxx xxxxxxxx | 1 | uint (15 bit) |
* | 1xxxxxxx xxxxxxxx yyyyyyyy yyyyyyyy | 2 | uint (16+ bits) |
* | 11111111 11111111 11111111 11111111 | 2 | int value -1 |
*
* This is only used (other than for testing) by {@link org.antlr.v4.codegen.model.SerializedJavaATN}
* to encode ints as char values for the java target, but it is convenient to combine it with the
* #decodeIntsEncodedAs16BitWords that follows as they are a pair (I did not want to introduce a new class
* into the runtime). Used only for Java Target.
*/
private encodeIntsWith16BitWords;
}