File: CaseChangingStream.js

package info (click to toggle)
antlr4 4.9.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,328 kB
  • sloc: java: 45,008; javascript: 1,121; xml: 1,077; python: 73; cs: 71; sh: 29; makefile: 9
file content (65 lines) | stat: -rw-r--r-- 1,537 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
 * Use of this file is governed by the BSD 3-clause license that
 * can be found in the LICENSE.txt file in the project root.
 */
//

function CaseChangingStream(stream, upper) {
	this._stream = stream;
	this._upper = upper;
}

CaseChangingStream.prototype.LA = function(offset) {
	var c = this._stream.LA(offset);
	if (c <= 0) {
		return c;
	}
	return String.fromCodePoint(c)[this._upper ? "toUpperCase" : "toLowerCase"]().codePointAt(0);
};

CaseChangingStream.prototype.reset = function() {
	return this._stream.reset();
};

CaseChangingStream.prototype.consume = function() {
	return this._stream.consume();
};

CaseChangingStream.prototype.LT = function(offset) {
	return this._stream.LT(offset);
};

CaseChangingStream.prototype.mark = function() {
	return this._stream.mark();
};

CaseChangingStream.prototype.release = function(marker) {
	return this._stream.release(marker);
};

CaseChangingStream.prototype.seek = function(_index) {
	return this._stream.seek(_index);
};

CaseChangingStream.prototype.getText = function(start, stop) {
	return this._stream.getText(start, stop);
};

CaseChangingStream.prototype.toString = function() {
	return this._stream.toString();
};

Object.defineProperty(CaseChangingStream.prototype, "index", {
	get: function() {
		return this._stream.index;
	}
});

Object.defineProperty(CaseChangingStream.prototype, "size", {
	get: function() {
		return this._stream.size;
	}
});

exports.CaseChangingStream = CaseChangingStream;