Skip to content

Commit 9220635

Browse files
committed
Extend ability for parsing octal constant
Add extra logic to deal with octal literals satisfied re(0[0-7]+) in function 'read_numeric_constant'.
1 parent a11876c commit 9220635

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/parser.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ int read_numeric_constant(char buffer[])
175175
}
176176
return value;
177177
}
178-
value = value * 10 + buffer[i++] - '0';
178+
if (buffer[0] == '0') /* octal */
179+
value = value * 8 + buffer[i++] - '0';
180+
else
181+
value = value * 10 + buffer[i++] - '0';
179182
}
180183
return value;
181184
}

0 commit comments

Comments
 (0)