Skip to content

Commit

Permalink
Supporting for reading octal constant
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecJ committed Sep 14, 2024
1 parent b210a66 commit 9f6e642
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ int read_numeric_constant(char buffer[])
}
return value;
}
value = value * 10 + buffer[i++] - '0';
if(buffer[0] == '0') /* octal */
value = value * 8 + buffer[i++] - '0';
else
value = value * 10 + buffer[i++] - '0';
}
return value;
}
Expand Down

0 comments on commit 9f6e642

Please sign in to comment.