| 1 |
// |
| 2 |
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. |
| 3 |
* Use of this file is governed by the BSD 3-clause license that |
| 4 |
* can be found in the LICENSE.txt file in the project root. |
| 5 |
*/ |
| 6 |
// |
| 7 |
|
| 8 |
function CaseChangingStream(stream, upper) { |
| 9 |
this._stream = stream; |
| 10 |
this._upper = upper; |
| 11 |
} |
| 12 |
|
| 13 |
CaseChangingStream.prototype.LA = function(offset) { |
| 14 |
var c = this._stream.LA(offset); |
| 15 |
if (c <= 0) { |
| 16 |
return c; |
| 17 |
} |
| 18 |
return String.fromCodePoint(c)[this._upper ? "toUpperCase" : "toLowerCase"]().codePointAt(0); |
| 19 |
}; |
| 20 |
|
| 21 |
CaseChangingStream.prototype.reset = function() { |
| 22 |
return this._stream.reset(); |
| 23 |
}; |
| 24 |
|
| 25 |
CaseChangingStream.prototype.consume = function() { |
| 26 |
return this._stream.consume(); |
| 27 |
}; |
| 28 |
|
| 29 |
CaseChangingStream.prototype.LT = function(offset) { |
| 30 |
return this._stream.LT(offset); |
| 31 |
}; |
| 32 |
|
| 33 |
CaseChangingStream.prototype.mark = function() { |
| 34 |
return this._stream.mark(); |
| 35 |
}; |
| 36 |
|
| 37 |
CaseChangingStream.prototype.release = function(marker) { |
| 38 |
return this._stream.release(marker); |
| 39 |
}; |
| 40 |
|
| 41 |
CaseChangingStream.prototype.seek = function(_index) { |
| 42 |
return this._stream.seek(_index); |
| 43 |
}; |
| 44 |
|
| 45 |
CaseChangingStream.prototype.getText = function(start, stop) { |
| 46 |
return this._stream.getText(start, stop); |
| 47 |
}; |
| 48 |
|
| 49 |
CaseChangingStream.prototype.toString = function() { |
| 50 |
return this._stream.toString(); |
| 51 |
}; |
| 52 |
|
| 53 |
Object.defineProperty(CaseChangingStream.prototype, "index", { |
| 54 |
get: function() { |
| 55 |
return this._stream.index; |
| 56 |
} |
| 57 |
}); |
| 58 |
|
| 59 |
Object.defineProperty(CaseChangingStream.prototype, "size", { |
| 60 |
get: function() { |
| 61 |
return this._stream.size; |
| 62 |
} |
| 63 |
}); |
| 64 |
|
| 65 |
exports.CaseChangingStream = CaseChangingStream; |