Space and comment
This commit is contained in:
@@ -77,6 +77,7 @@ ol.expression.Token;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lexer constructor.
|
* Lexer constructor.
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {string} source Source code.
|
* @param {string} source Source code.
|
||||||
*/
|
*/
|
||||||
@@ -108,6 +109,7 @@ ol.expression.Lexer = function(source) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan next token.
|
* Scan next token.
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} Next token.
|
* @return {ol.expression.Token} Next token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -157,6 +159,7 @@ ol.expression.Lexer.prototype.advance_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Increment the current character index.
|
* Increment the current character index.
|
||||||
|
*
|
||||||
* @param {number} delta Delta by which the index is advanced.
|
* @param {number} delta Delta by which the index is advanced.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -167,6 +170,7 @@ ol.expression.Lexer.prototype.increment_ = function(delta) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is a decimal digit.
|
* @return {boolean} The character is a decimal digit.
|
||||||
* @private
|
* @private
|
||||||
@@ -180,6 +184,7 @@ ol.expression.Lexer.prototype.isDecimalDigit_ = function(code) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.6.1.2
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.6.1.2
|
||||||
|
*
|
||||||
* @param {string} id A string identifier.
|
* @param {string} id A string identifier.
|
||||||
* @return {boolean} The identifier is a future reserved word.
|
* @return {boolean} The identifier is a future reserved word.
|
||||||
* @private
|
* @private
|
||||||
@@ -197,6 +202,7 @@ ol.expression.Lexer.prototype.isFutureReservedWord_ = function(id) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is a hex digit.
|
* @return {boolean} The character is a hex digit.
|
||||||
* @private
|
* @private
|
||||||
@@ -213,6 +219,7 @@ ol.expression.Lexer.prototype.isHexDigit_ = function(code) {
|
|||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
||||||
* Doesn't deal with non-ascii identifiers.
|
* Doesn't deal with non-ascii identifiers.
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is a valid identifier part.
|
* @return {boolean} The character is a valid identifier part.
|
||||||
* @private
|
* @private
|
||||||
@@ -227,6 +234,7 @@ ol.expression.Lexer.prototype.isIdentifierPart_ = function(code) {
|
|||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
||||||
* Doesn't yet deal with non-ascii identifiers.
|
* Doesn't yet deal with non-ascii identifiers.
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is a valid identifier start.
|
* @return {boolean} The character is a valid identifier start.
|
||||||
* @private
|
* @private
|
||||||
@@ -243,6 +251,7 @@ ol.expression.Lexer.prototype.isIdentifierStart_ = function(code) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.3
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.3
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is a line terminator.
|
* @return {boolean} The character is a line terminator.
|
||||||
* @private
|
* @private
|
||||||
@@ -257,6 +266,7 @@ ol.expression.Lexer.prototype.isLineTerminator_ = function(code) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is an octal digit.
|
* @return {boolean} The character is an octal digit.
|
||||||
* @private
|
* @private
|
||||||
@@ -270,6 +280,7 @@ ol.expression.Lexer.prototype.isOctalDigit_ = function(code) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.2
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.2
|
||||||
|
*
|
||||||
* @param {number} code The unicode of a character.
|
* @param {number} code The unicode of a character.
|
||||||
* @return {boolean} The character is whitespace.
|
* @return {boolean} The character is whitespace.
|
||||||
* @private
|
* @private
|
||||||
@@ -288,6 +299,7 @@ ol.expression.Lexer.prototype.isWhitespace_ = function(code) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the unicode of the character at the given offset from the current index.
|
* Get the unicode of the character at the given offset from the current index.
|
||||||
|
*
|
||||||
* @param {number} delta Offset from current index.
|
* @param {number} delta Offset from current index.
|
||||||
* @return {number} The character code.
|
* @return {number} The character code.
|
||||||
* @private
|
* @private
|
||||||
@@ -299,6 +311,7 @@ ol.expression.Lexer.prototype.getCharCode_ = function(delta) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the character at the current index.
|
* Get the character at the current index.
|
||||||
|
*
|
||||||
* @return {string} The current character.
|
* @return {string} The current character.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -309,6 +322,7 @@ ol.expression.Lexer.prototype.getCurrentChar_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the unicode of the character at the current index.
|
* Get the unicode of the character at the current index.
|
||||||
|
*
|
||||||
* @return {number} The current character code.
|
* @return {number} The current character code.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -319,6 +333,7 @@ ol.expression.Lexer.prototype.getCurrentCharCode_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan hex literal as numeric token.
|
* Scan hex literal as numeric token.
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} Numeric literal token.
|
* @return {ol.expression.Token} Numeric literal token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -356,6 +371,7 @@ ol.expression.Lexer.prototype.scanHexLiteral_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan identifier token.
|
* Scan identifier token.
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} Identifier token.
|
* @return {ol.expression.Token} Identifier token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -366,6 +382,8 @@ ol.expression.Lexer.prototype.scanIdentifier_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan numeric literal token.
|
* Scan numeric literal token.
|
||||||
|
* http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.3
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} Numeric literal token.
|
* @return {ol.expression.Token} Numeric literal token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -396,7 +414,7 @@ ol.expression.Lexer.prototype.scanNumericLiteral_ = function() {
|
|||||||
return this.scanOctalLiteral_();
|
return this.scanOctalLiteral_();
|
||||||
}
|
}
|
||||||
|
|
||||||
// numbers like 04 not allowed
|
// numbers like 09 not allowed
|
||||||
if (this.isDecimalDigit_(nextCode)) {
|
if (this.isDecimalDigit_(nextCode)) {
|
||||||
throw new Error('Unexpected token at index ' + this.index_ +
|
throw new Error('Unexpected token at index ' + this.index_ +
|
||||||
': ' + String.fromCharCode(nextCode));
|
': ' + String.fromCharCode(nextCode));
|
||||||
@@ -469,6 +487,7 @@ ol.expression.Lexer.prototype.scanNumericLiteral_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan octal literal as numeric token.
|
* Scan octal literal as numeric token.
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} Numeric literal token.
|
* @return {ol.expression.Token} Numeric literal token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -506,6 +525,7 @@ ol.expression.Lexer.prototype.scanOctalLiteral_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan punctuator token (a subset of allowed tokens in 7.7).
|
* Scan punctuator token (a subset of allowed tokens in 7.7).
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} Punctuator token.
|
* @return {ol.expression.Token} Punctuator token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -591,6 +611,7 @@ ol.expression.Lexer.prototype.scanPunctuator_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan string literal token.
|
* Scan string literal token.
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} String literal token.
|
* @return {ol.expression.Token} String literal token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -601,6 +622,7 @@ ol.expression.Lexer.prototype.scanStringLiteral_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Peek at the next token, but don't advance the index.
|
* Peek at the next token, but don't advance the index.
|
||||||
|
*
|
||||||
* @return {ol.expression.Token} The upcoming token.
|
* @return {ol.expression.Token} The upcoming token.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -614,6 +636,7 @@ ol.expression.Lexer.prototype.peek_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tokenize the provided code.
|
* Tokenize the provided code.
|
||||||
|
*
|
||||||
* @return {Array.<ol.expression.Token>} Tokens.
|
* @return {Array.<ol.expression.Token>} Tokens.
|
||||||
*/
|
*/
|
||||||
ol.expression.Lexer.prototype.tokenize = function() {
|
ol.expression.Lexer.prototype.tokenize = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user