indent is not handling correctly case statements dealing with values range.
For example:
case 0x01 ... 0x0b:
Will be transformed by indent in:
case 0x01...0 x0b:
Which cannot compile.
This patch tries to fix this issue. I am not sure this is the correct
solution but it seems to work for me.
Signed-off-by: Jean-Christophe Dubois <[email protected]>
--- indent-2.2.10.org/src/lexi.c 2008-03-11 19:50:42.000000000 +0100
+++ indent-2.2.10/src/lexi.c 2009-10-01 01:22:09.349653276 +0200
@@ -938,28 +938,38 @@
break;
case '.':
- if (parser_state_tos->in_decl &&
- (buf_ptr[0] == '.') &&
+ if ((buf_ptr[0] == '.') &&
(buf_ptr[1] == '.'))
{
- /* check for '...' in a declaration */
+ /* We have a '...'. This is supposed to mean something */
if ((buf_ptr += 2) >= buf_end)
{
fill_buffer();
}
- unary_delim = true;
- code = decl;
- token_end = buf_ptr;
- break;
- }
- unary_delim = false;
- code = struct_delim;
+ if (parser_state_tos->in_decl)
+ {
+ /* this is '...' in a declaration */
+ unary_delim = true;
+ code = decl;
+ token_end = buf_ptr;
+ } else {
+ /* this is '...' somewhere else */
+ /* for example: case 1 ... 9: */
+ unary_delim = true;
+ code = binary_op;
+ token_end = buf_ptr;
+ }
+ } else {
+
+ unary_delim = false;
+ code = struct_delim;
- if (*buf_ptr == '*') /* object .* pointer-to-member */
- {
- ++buf_ptr;
- token_end = buf_ptr;
+ if (*buf_ptr == '*') /* object .* pointer-to-member */
+ {
+ ++buf_ptr;
+ token_end = buf_ptr;
+ }
}
break;
_______________________________________________
bug-indent mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-indent