[njs] Allowed uppercased O in octal literal values.

Valentin Bartenev vbart at nginx.com
Sun Jul 1 09:20:14 UTC 2018


details:   http://hg.nginx.org/njs/rev/1cdf9c1a377d
branches:  
changeset: 544:1cdf9c1a377d
user:      Valentin Bartenev <vbart at nginx.com>
date:      Sun Jul 01 09:59:45 2018 +0300
description:
Allowed uppercased O in octal literal values.

diffstat:

 njs/njs_lexer.c          |  2 +-
 njs/test/njs_unit_test.c |  7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r a361553ce219 -r 1cdf9c1a377d njs/njs_lexer.c
--- a/njs/njs_lexer.c	Sat Jun 30 20:39:22 2018 +0300
+++ b/njs/njs_lexer.c	Sun Jul 01 09:59:45 2018 +0300
@@ -550,7 +550,7 @@ njs_lexer_number(njs_lexer_t *lexer)
 
         /* Octal literal values. */
 
-        if (*p == 'o') {
+        if (*p == 'o' || *p == 'O') {
             p++;
 
             if (p == lexer->end) {
diff -r a361553ce219 -r 1cdf9c1a377d njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Sat Jun 30 20:39:22 2018 +0300
+++ b/njs/test/njs_unit_test.c	Sun Jul 01 09:59:45 2018 +0300
@@ -118,10 +118,13 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("0o0"),
       nxt_string("0") },
 
+    { nxt_string("0O10"),
+      nxt_string("8") },
+
     { nxt_string("0o011"),
       nxt_string("9") },
 
-    { nxt_string("-0o777"),
+    { nxt_string("-0O777"),
       nxt_string("-511") },
 
     /* Legacy Octal Numbers are deprecated. */
@@ -141,7 +144,7 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("0o"),
       nxt_string("SyntaxError: Unexpected token \"\" in 1") },
 
-    { nxt_string("0o778"),
+    { nxt_string("0O778"),
       nxt_string("SyntaxError: Unexpected token \"\" in 1") },
 
     /* Hex Numbers. */


More information about the nginx-devel mailing list