Jurassic.Compiler.Lexer.ReadOctalEscapeSequence C# (CSharp) Method

ReadOctalEscapeSequence() private method

Reads an octal number turns it into a single-byte character.
private ReadOctalEscapeSequence ( int stringDelimiter, int firstDigit ) : char
stringDelimiter int The first character delimiting the string literal.
firstDigit int The value of the first digit.
return char
        private char ReadOctalEscapeSequence(int stringDelimiter, int firstDigit)
        {
            // Octal escape sequences are not allowed in strict mode.
            if (this.StrictMode)
                throw new JavaScriptException(this.engine, ErrorType.SyntaxError, "Octal escape sequences are not allowed in strict mode.", this.lineNumber, this.Source.Path);

            // Octal escape sequences are not allowed in template strings.
            if (stringDelimiter == '`')
                throw new JavaScriptException(this.engine, ErrorType.SyntaxError, "Octal escape sequences are not allowed in template strings.", this.lineNumber, this.Source.Path);

            int numericValue = firstDigit;
            for (int i = 0; i < 2; i++)
            {
                int c = this.reader.Peek();
                if (c < '0' || c > '9')
                    break;
                if (c == '8' || c == '9')
                    throw new JavaScriptException(this.engine, ErrorType.SyntaxError, "Invalid octal escape sequence.", this.lineNumber, this.Source.Path);
                numericValue = numericValue * 8 + (c - '0');
                ReadNextChar();
                if (numericValue * 8 > 255)
                    break;
            }
            return (char)numericValue;
        }