Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 Recognize binary constants



details:   https://anonhg.NetBSD.org/src/rev/77063cd631aa
branches:  trunk
changeset: 811730:77063cd631aa
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 12 17:34:01 2015 +0000

description:
Recognize binary constants

diffstat:

 usr.bin/xlint/lint1/scan.l |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 7a00ca29de3e -r 77063cd631aa usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l        Thu Nov 12 17:31:43 2015 +0000
+++ b/usr.bin/xlint/lint1/scan.l        Thu Nov 12 17:34:01 2015 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.61 2015/08/28 09:42:07 joerg Exp $ */
+/* $NetBSD: scan.l,v 1.62 2015/11/12 17:34:01 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.61 2015/08/28 09:42:07 joerg Exp $");
+__RCSID("$NetBSD: scan.l,v 1.62 2015/11/12 17:34:01 christos Exp $");
 #endif
 
 #include <stdlib.h>
@@ -86,9 +86,11 @@
 
 %}
 
+
 L      [_A-Za-z]
 D      [0-9]
 NZD    [1-9]
+BD     [0-1]
 OD     [0-7]
 HD     [0-9A-Fa-f]
 EX     ([eE][+-]?[0-9]+)
@@ -100,6 +102,7 @@
 %%
 
 {L}({L}|{D})*                  return (name());
+0[bB]{BD}+[lLuU]*              return (icon(2));
 0{OD}*[lLuU]*                  return (icon(8));
 {NZD}{D}*[lLuU]*               return (icon(10));
 0[xX]{HD}+[lLuU]*              return (icon(16));
@@ -532,8 +535,8 @@
        cp = yytext;
        len = yyleng;
 
-       /* skip 0x */
-       if (base == 16) {
+       /* skip 0[xX] or 0[bB] */
+       if (base == 16 || base == 2) {
                cp += 2;
                len -= 2;
        }



Home | Main Index | Thread Index | Old Index