ref: 0f2de28c580dd78160230b5b973c903378527623
parent: 2944ebad62186a50bdab83488755287d9596b283
author: Ori Bernstein <[email protected]>
date: Fri Jun 21 06:49:10 EDT 2013
Add support for '_' in number literals for readability.
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -514,8 +514,10 @@
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)
--- a/test/add.myr
+++ b/test/add.myr
@@ -3,8 +3,10 @@
const main = {
var a
var b
+ var c
a = 42
b = 11
- -> a + b
+ c = 0_0
+ -> a + b + c
}