summaryrefslogtreecommitdiff
path: root/parse/tok.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-06-21 10:49:10 -0400
committerOri Bernstein <ori@eigenstate.org>2013-06-21 10:49:10 -0400
commit0f2de28c580dd78160230b5b973c903378527623 (patch)
tree9ef9d7aaafd01ab2efcb10b2101e4a84e6d32d6c /parse/tok.c
parent2944ebad62186a50bdab83488755287d9596b283 (diff)
downloadmc-0f2de28c580dd78160230b5b973c903378527623.tar.gz
Add support for '_' in number literals for readability.
Diffstat (limited to 'parse/tok.c')
-rw-r--r--parse/tok.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/parse/tok.c b/parse/tok.c
index 339fc41..0c323aa 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -514,8 +514,10 @@ static Tok *number(int base)
t = NULL;
isfloat = 0;
start = fidx;
- for (c = peek(); isxdigit(c) || c == '.'; c = peek()) {
+ for (c = peek(); isxdigit(c) || c == '.' || c == '_'; c = peek()) {
next();
+ if (c == '_')
+ continue;
if (c == '.')
isfloat = 1;
else if (hexval(c) > base)