<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Thank you for your patch.</div><div>We are currently working on comprehensive hexadecimal support.</div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><br>-- <br>Igor Sysoev<br><a href="http://nginx.com">http://nginx.com</a></div><div><br></div></div></div></div><div><div>On 21 May 2017, at 20:52, Paulo Pacheco <<a href="mailto:fooinha@gmail.com">fooinha@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div># HG changeset patch<br># User Paulo Pacheco <<a href="mailto:fooinha@gmail.com">fooinha@gmail.com</a>><br># Date 1495388206 0<br># Sun May 21 17:36:46 2017 +0000<br># Node ID 22db6b6a3a0eebff8453fb22035628410c05c5c8<br># Parent 96fda9957427e1ea78d0096b019a3f3183db7346<br>[njs] Lexer support for hexadecimal literal values.<br><br>diff -r 96fda9957427 -r 22db6b6a3a0e njs/njs_lexer.c<br>--- a/njs/njs_lexer.c Wed Apr 19 17:48:56 2017 +0300<br>+++ b/njs/njs_lexer.c Sun May 21 17:36:46 2017 +0000<br>@@ -19,7 +19,7 @@<br> #include <njs_variable.h><br> #include <njs_parser.h><br> #include <string.h><br>-<br>+#include <stdlib.h><br><br> typedef struct njs_lexer_multi_s njs_lexer_multi_t;<br><br>@@ -539,10 +539,28 @@<br> {<br> u_char c, *p;<br> double num, frac, scale;<br>+ char *endptr;<br><br> /* TODO: "1e2" */<br><br> p = lexer->start;<br>+<br>+ /* Hexadecimal literal values */<br>+ if ( (lexer->end - lexer->start) > 2<br>+ && (*p == 'x' || *p == 'X')<br>+ && (lexer->prev_token > 0<br>+ || ((lexer->start - 1) == lexer->text.start)<br>+ )<br>+ && (*(p-1) == '0')) {<br>+<br>+ lexer->number = strtod((const char *) p-1, &endptr);<br>+ if ((u_char *) endptr <= lexer->end) {<br>+ lexer->start = (u_char *) endptr;<br>+ return NJS_TOKEN_NUMBER;<br>+ }<br>+ lexer->number = 0;<br>+ }<br>+<br> c = p[-1];<br><br> /* Values below '0' become >= 208. */<br>diff -r 96fda9957427 -r 22db6b6a3a0e njs/test/njs_unit_test.c<br>--- a/njs/test/njs_unit_test.c Wed Apr 19 17:48:56 2017 +0300<br>+++ b/njs/test/njs_unit_test.c Sun May 21 17:36:46 2017 +0000<br>@@ -112,6 +112,18 @@<br> { nxt_string("+1"),<br> nxt_string("1") },<br><br>+ { nxt_string("var a = 0x01; a"),<br>+ nxt_string("1") },<br>+<br>+ { nxt_string("var x = 0xffff; x"),<br>+ nxt_string("65535") },<br>+<br>+ { nxt_string("0x01"),<br>+ nxt_string("1") },<br>+<br>+ { nxt_string("0xffff"),<br>+ nxt_string("65535") },<br>+<br> { nxt_string("+1\n"),<br> nxt_string("1") },<br><br><br></div>---------------------------------- CUT HERE --------------------------------------<br>Paulo Pacheco | Паулу Пашеку<br><div><br><br></div></div>
_______________________________________________<br>nginx-devel mailing list<br><a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>http://mailman.nginx.org/mailman/listinfo/nginx-devel</blockquote></div><br></body></html>