bug-indent
[Top][All Lists]
Advanced

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

[PATCH] Support for binary constants


From: Colin Leitner
Subject: [PATCH] Support for binary constants
Date: Thu, 04 Mar 2010 15:17:05 +0100

Hello,

this is a patch to support binary constants of the form ``0b00101010''. Mostly
used in embedded C compilers and gcc supports them too:

http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html

Regards,
        Colin Leitner

--- indent-2.2.10.orig/ChangeLog        2008-03-11 19:53:21.000000000 +0100
+++ indent-2.2.10.new/ChangeLog 2010-03-04 13:40:28.450417903 +0100
@@ -1,3 +1,6 @@
+2010-03-04 Colin Leitner <address@hidden>
+       * lexi.c: Added support for binary constants as understood by a couple 
of compilers.
+
 -2008-03-11 david <address@hidden>
        * Re-baselined to the freeBSD indent version to avoid onerous 
constraints in the old BSD license.
        * Release version 2.2.10
--- indent-2.2.10.orig/src/lexi.c       2008-03-11 19:50:42.000000000 +0100
+++ indent-2.2.10.new/src/lexi.c        2010-03-04 13:32:37.302911824 +0100
@@ -288,6 +288,14 @@
                buf_ptr++;
             }
          }
+         else if ((*buf_ptr == '0') && ((buf_ptr[1] == 'b') || (buf_ptr[1] == 
'B')))
+         {
+            buf_ptr += 2;
+            while ((*buf_ptr == '0') || (*buf_ptr == '1'))
+            {
+               buf_ptr++;
+            }
+         }
          else
          {
             while (1)








reply via email to

[Prev in Thread] Current Thread [Next in Thread]