mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-19 16:11:30 +00:00
Ellipsis is now just ..; Remove half-closed range operator and treat all of them as half-closed; slice expression uses ..;
This commit is contained in:
+4
-4
@@ -9,14 +9,14 @@
|
||||
|
||||
main :: proc() {
|
||||
buf: [64]byte;
|
||||
// len := strconv.generic_ftoa(buf[:], 123.5431, 'f', 4, 64);
|
||||
// len := strconv.generic_ftoa(buf[..], 123.5431, 'f', 4, 64);
|
||||
x := 624.123;
|
||||
s := strconv.format_float(buf[:], x, 'f', 6, 64);
|
||||
s := strconv.format_float(buf[..], x, 'f', 6, 64);
|
||||
fmt.println(s);
|
||||
fmt.printf("%3d\n", 102);
|
||||
|
||||
i := 123;
|
||||
fmt.println(123);
|
||||
a := [..]int{0, 1, 2, 3, 4, 5, 6};
|
||||
fmt.println(a[0..4]);
|
||||
|
||||
|
||||
when false {
|
||||
|
||||
+3
-3
@@ -316,7 +316,7 @@ __bounds_check_error :: proc(file: string, line, column: int, index, count: int)
|
||||
if 0 <= index && index < count {
|
||||
return;
|
||||
}
|
||||
fmt.fprintf(os.stderr, "%s(%d:%d) Index %d is out of bounds range 0..<%d\n",
|
||||
fmt.fprintf(os.stderr, "%s(%d:%d) Index %d is out of bounds range 0..%d\n",
|
||||
file, line, column, index, count);
|
||||
__debug_trap();
|
||||
}
|
||||
@@ -325,7 +325,7 @@ __slice_expr_error :: proc(file: string, line, column: int, low, high: int) {
|
||||
if 0 <= low && low <= high {
|
||||
return;
|
||||
}
|
||||
fmt.fprintf(os.stderr, "%s(%d:%d) Invalid slice indices: [%d:%d]\n",
|
||||
fmt.fprintf(os.stderr, "%s(%d:%d) Invalid slice indices: [%d..%d]\n",
|
||||
file, line, column, low, high);
|
||||
__debug_trap();
|
||||
}
|
||||
@@ -333,7 +333,7 @@ __substring_expr_error :: proc(file: string, line, column: int, low, high: int)
|
||||
if 0 <= low && low <= high {
|
||||
return;
|
||||
}
|
||||
fmt.fprintf(os.stderr, "%s(%d:%d) Invalid substring indices: [%d:%d]\n",
|
||||
fmt.fprintf(os.stderr, "%s(%d:%d) Invalid substring indices: [%d..%d]\n",
|
||||
file, line, column, low, high);
|
||||
__debug_trap();
|
||||
}
|
||||
|
||||
+65
-66
@@ -3,11 +3,10 @@
|
||||
// NOTE: This is only for floating point printing and nothing else
|
||||
|
||||
Decimal :: struct {
|
||||
d: [384]byte, // big-endian digits
|
||||
ndu: int,
|
||||
dp: int,
|
||||
neg: bool,
|
||||
trunc: bool,
|
||||
digits: [384]byte, // big-endian digits
|
||||
count: int,
|
||||
decimal_point: int,
|
||||
neg, trunc: bool,
|
||||
}
|
||||
|
||||
decimal_to_string :: proc(buf: []byte, a: ^Decimal) -> string {
|
||||
@@ -19,42 +18,42 @@ decimal_to_string :: proc(buf: []byte, a: ^Decimal) -> string {
|
||||
}
|
||||
|
||||
|
||||
n := 10 + a.ndu + abs(a.dp);
|
||||
n := 10 + a.count + abs(a.decimal_point);
|
||||
|
||||
// TODO(bill): make this work with a buffer that's not big enough
|
||||
assert(buf.count >= n);
|
||||
buf = buf[:n];
|
||||
buf = buf[..n];
|
||||
|
||||
if a.ndu == 0 {
|
||||
if a.count == 0 {
|
||||
buf[0] = '0';
|
||||
return cast(string)buf[0:1];
|
||||
return cast(string)buf[0..1];
|
||||
}
|
||||
|
||||
w := 0;
|
||||
if a.dp <= 0 {
|
||||
if a.decimal_point <= 0 {
|
||||
buf[w] = '0'; w++;
|
||||
buf[w] = '.'; w++;
|
||||
w += digit_zero(buf[w: w-a.dp]);
|
||||
w += copy(buf[w:], a.d[0:a.ndu]);
|
||||
} else if a.dp < a.ndu {
|
||||
w += copy(buf[w:], a.d[0:a.dp]);
|
||||
w += digit_zero(buf[w .. w-a.decimal_point]);
|
||||
w += copy(buf[w..], a.digits[0..a.count]);
|
||||
} else if a.decimal_point < a.count {
|
||||
w += copy(buf[w..], a.digits[0..a.decimal_point]);
|
||||
buf[w] = '.'; w++;
|
||||
w += copy(buf[w:], a.d[a.dp:a.ndu]);
|
||||
w += copy(buf[w..], a.digits[a.decimal_point .. a.count]);
|
||||
} else {
|
||||
w += copy(buf[w:], a.d[0:a.ndu]);
|
||||
w += digit_zero(buf[w : w+a.dp-a.ndu]);
|
||||
w += copy(buf[w..], a.digits[0..a.count]);
|
||||
w += digit_zero(buf[w .. w+a.decimal_point-a.count]);
|
||||
}
|
||||
|
||||
return cast(string)buf[0:w];
|
||||
return cast(string)buf[0..w];
|
||||
}
|
||||
|
||||
// trim trailing zeros
|
||||
trim :: proc(a: ^Decimal) {
|
||||
for a.ndu > 0 && a.d[a.ndu-1] == '0' {
|
||||
a.ndu--;
|
||||
for a.count > 0 && a.digits[a.count-1] == '0' {
|
||||
a.count--;
|
||||
}
|
||||
if a.ndu == 0 {
|
||||
a.dp = 0;
|
||||
if a.count == 0 {
|
||||
a.decimal_point = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,12 +69,12 @@ assign :: proc(a: ^Decimal, i: u64) {
|
||||
i = j;
|
||||
}
|
||||
|
||||
a.ndu = 0;
|
||||
a.count = 0;
|
||||
for n--; n >= 0; n-- {
|
||||
a.d[a.ndu] = buf[n];
|
||||
a.ndu++;
|
||||
a.digits[a.count] = buf[n];
|
||||
a.count++;
|
||||
}
|
||||
a.dp = a.ndu;
|
||||
a.decimal_point = a.count;
|
||||
trim(a);
|
||||
}
|
||||
|
||||
@@ -88,10 +87,10 @@ shift_right :: proc(a: ^Decimal, k: uint) {
|
||||
|
||||
n: uint;
|
||||
for ; n>>k == 0; r++ {
|
||||
if r >= a.ndu {
|
||||
if r >= a.count {
|
||||
if n == 0 {
|
||||
// Just in case
|
||||
a.ndu = 0;
|
||||
a.count = 0;
|
||||
return;
|
||||
}
|
||||
for n>>k == 0 {
|
||||
@@ -100,18 +99,18 @@ shift_right :: proc(a: ^Decimal, k: uint) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
c := cast(uint)a.d[r];
|
||||
c := cast(uint)a.digits[r];
|
||||
n = n*10 + c - '0';
|
||||
}
|
||||
a.dp -= r-1;
|
||||
a.decimal_point -= r-1;
|
||||
|
||||
mask: uint = (1<<k) - 1;
|
||||
|
||||
for ; r < a.ndu; r++ {
|
||||
c := cast(uint)a.d[r];
|
||||
for ; r < a.count; r++ {
|
||||
c := cast(uint)a.digits[r];
|
||||
dig := n>>k;
|
||||
n &= mask;
|
||||
a.d[w] = cast(byte)('0' + dig);
|
||||
a.digits[w] = cast(byte)('0' + dig);
|
||||
w++;
|
||||
n = n*10 + c - '0';
|
||||
}
|
||||
@@ -119,8 +118,8 @@ shift_right :: proc(a: ^Decimal, k: uint) {
|
||||
for n > 0 {
|
||||
dig := n>>k;
|
||||
n &= mask;
|
||||
if w < a.d.count {
|
||||
a.d[w] = cast(byte)('0' + dig);
|
||||
if w < a.digits.count {
|
||||
a.digits[w] = cast(byte)('0' + dig);
|
||||
w++;
|
||||
} else if dig > 0 {
|
||||
a.trunc = true;
|
||||
@@ -129,24 +128,24 @@ shift_right :: proc(a: ^Decimal, k: uint) {
|
||||
}
|
||||
|
||||
|
||||
a.ndu = w;
|
||||
a.count = w;
|
||||
trim(a);
|
||||
}
|
||||
|
||||
shift_left :: proc(a: ^Decimal, k: uint) {
|
||||
delta := cast(int)(k/4);
|
||||
|
||||
r := a.ndu; // read index
|
||||
w := a.ndu+delta; // write index
|
||||
r := a.count; // read index
|
||||
w := a.count+delta; // write index
|
||||
|
||||
n: uint;
|
||||
for r--; r >= 0; r-- {
|
||||
n += (cast(uint)a.d[r] - '0') << k;
|
||||
n += (cast(uint)a.digits[r] - '0') << k;
|
||||
quo := n/10;
|
||||
rem := n - 10*quo;
|
||||
w--;
|
||||
if w < a.d.count {
|
||||
a.d[w] = cast(byte)('0' + rem);
|
||||
if w < a.digits.count {
|
||||
a.digits[w] = cast(byte)('0' + rem);
|
||||
} else if rem != 0 {
|
||||
a.trunc = true;
|
||||
}
|
||||
@@ -157,23 +156,23 @@ shift_left :: proc(a: ^Decimal, k: uint) {
|
||||
quo := n/10;
|
||||
rem := n - 10*quo;
|
||||
w--;
|
||||
if w < a.d.count {
|
||||
a.d[w] = cast(byte)('0' + rem);
|
||||
if w < a.digits.count {
|
||||
a.digits[w] = cast(byte)('0' + rem);
|
||||
} else if rem != 0 {
|
||||
a.trunc = true;
|
||||
}
|
||||
n = quo;
|
||||
}
|
||||
|
||||
a.ndu += delta;
|
||||
a.ndu = min(a.ndu, a.d.count);
|
||||
a.dp += delta;
|
||||
a.count += delta;
|
||||
a.count = min(a.count, a.digits.count);
|
||||
a.decimal_point += delta;
|
||||
trim(a);
|
||||
}
|
||||
|
||||
shift :: proc(a: ^Decimal, k: int) {
|
||||
match {
|
||||
case a.ndu == 0:
|
||||
case a.count == 0:
|
||||
// no need to update
|
||||
case k > 0:
|
||||
for k > max_shift {
|
||||
@@ -193,19 +192,19 @@ shift :: proc(a: ^Decimal, k: int) {
|
||||
}
|
||||
|
||||
can_round_up :: proc(a: ^Decimal, nd: int) -> bool {
|
||||
if nd < 0 || nd >= a.ndu { return false ; }
|
||||
if a.d[nd] == '5' && nd+1 == a.ndu {
|
||||
if nd < 0 || nd >= a.count { return false ; }
|
||||
if a.digits[nd] == '5' && nd+1 == a.count {
|
||||
if a.trunc {
|
||||
return true;
|
||||
}
|
||||
return nd > 0 && (a.d[nd-1]-'0')%2 != 0;
|
||||
return nd > 0 && (a.digits[nd-1]-'0')%2 != 0;
|
||||
}
|
||||
|
||||
return a.d[nd] >= '5';
|
||||
return a.digits[nd] >= '5';
|
||||
}
|
||||
|
||||
round :: proc(a: ^Decimal, nd: int) {
|
||||
if nd < 0 || nd >= a.ndu { return; }
|
||||
if nd < 0 || nd >= a.count { return; }
|
||||
if can_round_up(a, nd) {
|
||||
round_up(a, nd);
|
||||
} else {
|
||||
@@ -214,44 +213,44 @@ round :: proc(a: ^Decimal, nd: int) {
|
||||
}
|
||||
|
||||
round_up :: proc(a: ^Decimal, nd: int) {
|
||||
if nd < 0 || nd >= a.ndu { return; }
|
||||
if nd < 0 || nd >= a.count { return; }
|
||||
|
||||
for i := nd-1; i >= 0; i-- {
|
||||
if c := a.d[i]; c < '9' {
|
||||
a.d[i]++;
|
||||
a.ndu = i+1;
|
||||
if c := a.digits[i]; c < '9' {
|
||||
a.digits[i]++;
|
||||
a.count = i+1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Number is just 9s
|
||||
a.d[0] = '1';
|
||||
a.ndu = 1;
|
||||
a.dp++;
|
||||
a.digits[0] = '1';
|
||||
a.count = 1;
|
||||
a.decimal_point++;
|
||||
}
|
||||
|
||||
round_down :: proc(a: ^Decimal, nd: int) {
|
||||
if nd < 0 || nd >= a.ndu { return; }
|
||||
a.ndu = nd;
|
||||
if nd < 0 || nd >= a.count { return; }
|
||||
a.count = nd;
|
||||
trim(a);
|
||||
}
|
||||
|
||||
|
||||
// Extract integer part, rounded appropriately. There are no guarantees about overflow.
|
||||
rounded_integer :: proc(a: ^Decimal) -> u64 {
|
||||
if a.dp > 20 {
|
||||
if a.decimal_point > 20 {
|
||||
return 0xffff_ffff_ffff_ffff;
|
||||
}
|
||||
i: int;
|
||||
n: u64 = 0;
|
||||
m := min(a.dp, a.ndu);
|
||||
m := min(a.decimal_point, a.count);
|
||||
for i = 0; i < m; i++ {
|
||||
n = n*10 + cast(u64)(a.d[i]-'0');
|
||||
n = n*10 + cast(u64)(a.digits[i]-'0');
|
||||
}
|
||||
for ; i < a.dp; i++ {
|
||||
for ; i < a.decimal_point; i++ {
|
||||
n *= 10;
|
||||
}
|
||||
if can_round_up(a, a.dp) {
|
||||
if can_round_up(a, a.decimal_point) {
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
|
||||
+55
-55
@@ -16,7 +16,7 @@ buffer_write :: proc(buf: ^Buffer, b: []byte) {
|
||||
if buf.length < buf.data.count {
|
||||
n := min(buf.data.count-buf.length, b.count);
|
||||
if n > 0 {
|
||||
copy(buf.data[buf.length:], b[:n]);
|
||||
copy(buf.data[buf.length..], b[..n]);
|
||||
buf.length += n;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ buffer_write_rune :: proc(buf: ^Buffer, r: rune) {
|
||||
}
|
||||
|
||||
b, n := utf8.encode_rune(r);
|
||||
buffer_write(buf, b[:n]);
|
||||
buffer_write(buf, b[..n]);
|
||||
}
|
||||
|
||||
Fmt_Info :: struct {
|
||||
@@ -61,46 +61,46 @@ Fmt_Info :: struct {
|
||||
|
||||
|
||||
|
||||
fprint :: proc(fd: os.Handle, args: ...any) -> int {
|
||||
fprint :: proc(fd: os.Handle, args: ..any) -> int {
|
||||
data: [_BUFFER_SIZE]byte;
|
||||
buf := Buffer{data[:], 0};
|
||||
bprint(^buf, ...args);
|
||||
os.write(fd, buf.data[:buf.length]);
|
||||
buf := Buffer{data[..], 0};
|
||||
bprint(^buf, ..args);
|
||||
os.write(fd, buf.data[..buf.length]);
|
||||
return buf.length;
|
||||
}
|
||||
|
||||
fprintln :: proc(fd: os.Handle, args: ...any) -> int {
|
||||
fprintln :: proc(fd: os.Handle, args: ..any) -> int {
|
||||
data: [_BUFFER_SIZE]byte;
|
||||
buf := Buffer{data[:], 0};
|
||||
bprintln(^buf, ...args);
|
||||
os.write(fd, buf.data[:buf.length]);
|
||||
buf := Buffer{data[..], 0};
|
||||
bprintln(^buf, ..args);
|
||||
os.write(fd, buf.data[..buf.length]);
|
||||
return buf.length;
|
||||
}
|
||||
fprintf :: proc(fd: os.Handle, fmt: string, args: ...any) -> int {
|
||||
fprintf :: proc(fd: os.Handle, fmt: string, args: ..any) -> int {
|
||||
data: [_BUFFER_SIZE]byte;
|
||||
buf := Buffer{data[:], 0};
|
||||
bprintf(^buf, fmt, ...args);
|
||||
os.write(fd, buf.data[:buf.length]);
|
||||
buf := Buffer{data[..], 0};
|
||||
bprintf(^buf, fmt, ..args);
|
||||
os.write(fd, buf.data[..buf.length]);
|
||||
return buf.length;
|
||||
}
|
||||
|
||||
|
||||
print :: proc(args: ...any) -> int {
|
||||
return fprint(os.stdout, ...args);
|
||||
print :: proc(args: ..any) -> int {
|
||||
return fprint(os.stdout, ..args);
|
||||
}
|
||||
println :: proc(args: ...any) -> int {
|
||||
return fprintln(os.stdout, ...args);
|
||||
println :: proc(args: ..any) -> int {
|
||||
return fprintln(os.stdout, ..args);
|
||||
}
|
||||
printf :: proc(fmt: string, args: ...any) -> int {
|
||||
return fprintf(os.stdout, fmt, ...args);
|
||||
printf :: proc(fmt: string, args: ..any) -> int {
|
||||
return fprintf(os.stdout, fmt, ..args);
|
||||
}
|
||||
|
||||
|
||||
fprint_type :: proc(fd: os.Handle, info: ^Type_Info) {
|
||||
data: [_BUFFER_SIZE]byte;
|
||||
buf := Buffer{data[:], 0};
|
||||
buf := Buffer{data[..], 0};
|
||||
buffer_write_type(^buf, info);
|
||||
os.write(fd, buf.data[:buf.length]);
|
||||
os.write(fd, buf.data[..buf.length]);
|
||||
}
|
||||
|
||||
buffer_write_type :: proc(buf: ^Buffer, ti: ^Type_Info) {
|
||||
@@ -176,7 +176,7 @@ buffer_write_type :: proc(buf: ^Buffer, ti: ^Type_Info) {
|
||||
buffer_write_string(buf, "]");
|
||||
buffer_write_type(buf, info.elem);
|
||||
case Dynamic_Array:
|
||||
buffer_write_string(buf, "[...]");
|
||||
buffer_write_string(buf, "[..]");
|
||||
buffer_write_type(buf, info.elem);
|
||||
case Slice:
|
||||
buffer_write_string(buf, "[");
|
||||
@@ -241,7 +241,7 @@ buffer_write_type :: proc(buf: ^Buffer, ti: ^Type_Info) {
|
||||
variant := union_cast(^Struct)variant_type;
|
||||
|
||||
vc := variant.names.count-cf.names.count;
|
||||
for j in 0..<vc {
|
||||
for j in 0..vc {
|
||||
if j > 0 {
|
||||
buffer_write_string(buf, ", ");
|
||||
}
|
||||
@@ -280,7 +280,7 @@ buffer_write_type :: proc(buf: ^Buffer, ti: ^Type_Info) {
|
||||
}
|
||||
|
||||
|
||||
bprint :: proc(buf: ^Buffer, args: ...any) -> int {
|
||||
bprint :: proc(buf: ^Buffer, args: ..any) -> int {
|
||||
fi: Fmt_Info;
|
||||
fi.buf = buf;
|
||||
|
||||
@@ -296,7 +296,7 @@ bprint :: proc(buf: ^Buffer, args: ...any) -> int {
|
||||
return buf.length;
|
||||
}
|
||||
|
||||
bprintln :: proc(buf: ^Buffer, args: ...any) -> int {
|
||||
bprintln :: proc(buf: ^Buffer, args: ..any) -> int {
|
||||
fi: Fmt_Info;
|
||||
fi.buf = buf;
|
||||
|
||||
@@ -310,23 +310,23 @@ bprintln :: proc(buf: ^Buffer, args: ...any) -> int {
|
||||
return buf.length;
|
||||
}
|
||||
|
||||
sprint :: proc(buf: []byte, args: ...any) -> string {
|
||||
sprint :: proc(buf: []byte, args: ..any) -> string {
|
||||
b: Buffer;
|
||||
b.data = buf;
|
||||
count := bprint(^b, ...args);
|
||||
return cast(string)b.data[:b.length];
|
||||
count := bprint(^b, ..args);
|
||||
return cast(string)b.data[..b.length];
|
||||
}
|
||||
sprintln :: proc(buf: []byte, args: ...any) -> string {
|
||||
sprintln :: proc(buf: []byte, args: ..any) -> string {
|
||||
b: Buffer;
|
||||
b.data = buf;
|
||||
count := bprintln(^b, ...args);
|
||||
return cast(string)b.data[:b.length];
|
||||
count := bprintln(^b, ..args);
|
||||
return cast(string)b.data[..b.length];
|
||||
}
|
||||
sprintf :: proc(buf: []byte, fmt: string, args: ...any) -> string {
|
||||
sprintf :: proc(buf: []byte, fmt: string, args: ..any) -> string {
|
||||
b: Buffer;
|
||||
b.data = buf;
|
||||
count := bprintf(^b, fmt, ...args);
|
||||
return cast(string)b.data[:b.length];
|
||||
count := bprintf(^b, fmt, ..args);
|
||||
return cast(string)b.data[..b.length];
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ parse_int :: proc(s: string, offset: int) -> (result: int, offset: int, ok: bool
|
||||
ok := true;
|
||||
|
||||
i := 0;
|
||||
for o in offset..<s.count {
|
||||
for o in offset..s.count {
|
||||
c := cast(rune)s[offset+i];
|
||||
if !is_digit(c) {
|
||||
break;
|
||||
@@ -366,7 +366,7 @@ _arg_number :: proc(fi: ^Fmt_Info,
|
||||
return 0, 1, false;
|
||||
}
|
||||
|
||||
for i in 1..<format.count {
|
||||
for i in 1..format.count {
|
||||
if format[i] == ']' {
|
||||
width, new_index, ok := parse_int(format, 1);
|
||||
if !ok || new_index != i {
|
||||
@@ -384,7 +384,7 @@ _arg_number :: proc(fi: ^Fmt_Info,
|
||||
return arg_index, offset, false;
|
||||
}
|
||||
fi.reordered = true;
|
||||
index, width, ok := parse_arg_number(format[offset:]);
|
||||
index, width, ok := parse_arg_number(format[offset..]);
|
||||
if ok && 0 <= index && index < arg_count {
|
||||
return index, offset+width, true;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ fmt_write_padding :: proc(fi: ^Fmt_Info, width: int) {
|
||||
|
||||
count := min(width, fi.buf.data.count-fi.buf.length);
|
||||
start := fi.buf.length;
|
||||
for i in start..<count {
|
||||
for i in start..count {
|
||||
fi.buf.data[i] = pad_byte;
|
||||
}
|
||||
fi.buf.length += count;
|
||||
@@ -503,11 +503,11 @@ _write_int :: proc(fi: ^Fmt_Info, u: u64, base: int, neg: bool, digits: string)
|
||||
if fi.hash { flags |= strconv.Int_Flag.PREFIX; }
|
||||
if fi.plus { flags |= strconv.Int_Flag.PLUS; }
|
||||
if fi.space { flags |= strconv.Int_Flag.SPACE; }
|
||||
s := strconv.format_bits(buf[:], u, base, neg, digits, flags);
|
||||
s := strconv.format_bits(buf[..], u, base, neg, digits, flags);
|
||||
|
||||
prev_zero := fi.zero;
|
||||
fi.zero = false;
|
||||
defer fi.zero = prev_zero;
|
||||
fi.zero = false;
|
||||
_pad(fi, s);
|
||||
}
|
||||
|
||||
@@ -570,10 +570,10 @@ fmt_float :: proc(fi: ^Fmt_Info, v: f64, bit_size: int, verb: rune) {
|
||||
prec = fi.prec;
|
||||
}
|
||||
buf: [128]byte;
|
||||
str := strconv.format_float(buf[1:], v, 'f', prec, bit_size);
|
||||
str = cast(string)buf[:str.count+1];
|
||||
str := strconv.format_float(buf[1..], v, 'f', prec, bit_size);
|
||||
str = cast(string)buf[..str.count+1];
|
||||
if str[1] == '+' || str[1] == '-' {
|
||||
str = str[1:];
|
||||
str = str[1..];
|
||||
} else {
|
||||
str[0] = '+';
|
||||
}
|
||||
@@ -591,12 +591,12 @@ fmt_float :: proc(fi: ^Fmt_Info, v: f64, bit_size: int, verb: rune) {
|
||||
if fi.zero && fi.width_set && fi.width > str.count {
|
||||
buffer_write_byte(fi.buf, str[0]);
|
||||
fmt_write_padding(fi, fi.width - str.count);
|
||||
buffer_write_string(fi.buf, str[1:]);
|
||||
buffer_write_string(fi.buf, str[1..]);
|
||||
} else {
|
||||
_pad(fi, str);
|
||||
}
|
||||
} else {
|
||||
_pad(fi, str[1:]);
|
||||
_pad(fi, str[1..]);
|
||||
}
|
||||
|
||||
default:
|
||||
@@ -747,7 +747,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
|
||||
buffer_write_byte(fi.buf, '[');
|
||||
defer buffer_write_byte(fi.buf, ']');
|
||||
for i in 0..<info.count {
|
||||
for i in 0..info.count {
|
||||
if i > 0 {
|
||||
buffer_write_string(fi.buf, ", ");
|
||||
}
|
||||
@@ -764,7 +764,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
buffer_write_byte(fi.buf, '[');
|
||||
defer buffer_write_byte(fi.buf, ']');
|
||||
array := cast(^Raw_Dynamic_Array)v.data;
|
||||
for i in 0..<array.count {
|
||||
for i in 0..array.count {
|
||||
if i > 0 {
|
||||
buffer_write_string(fi.buf, ", ");
|
||||
}
|
||||
@@ -786,7 +786,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
|
||||
entry_type := union_cast(^Struct)ed.elem;
|
||||
entry_size := ed.elem_size;
|
||||
for i in 0..<entries.count {
|
||||
for i in 0..entries.count {
|
||||
if i > 0 {
|
||||
buffer_write_string(fi.buf, ", ");
|
||||
}
|
||||
@@ -815,7 +815,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
buffer_write_byte(fi.buf, '[');
|
||||
defer buffer_write_byte(fi.buf, ']');
|
||||
slice := cast(^[]byte)v.data;
|
||||
for i in 0..<slice.count {
|
||||
for i in 0..slice.count {
|
||||
if i > 0 {
|
||||
buffer_write_string(fi.buf, ", ");
|
||||
}
|
||||
@@ -827,7 +827,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
buffer_write_byte(fi.buf, '<');
|
||||
defer buffer_write_byte(fi.buf, '>');
|
||||
|
||||
for i in 0..<info.count {
|
||||
for i in 0..info.count {
|
||||
if i > 0 {
|
||||
buffer_write_string(fi.buf, ", ");
|
||||
}
|
||||
@@ -920,7 +920,7 @@ fmt_arg :: proc(fi: ^Fmt_Info, arg: any, verb: rune) {
|
||||
}
|
||||
|
||||
|
||||
bprintf :: proc(b: ^Buffer, fmt: string, args: ...any) -> int {
|
||||
bprintf :: proc(b: ^Buffer, fmt: string, args: ..any) -> int {
|
||||
fi := Fmt_Info{};
|
||||
end := fmt.count;
|
||||
arg_index := 0;
|
||||
@@ -933,7 +933,7 @@ bprintf :: proc(b: ^Buffer, fmt: string, args: ...any) -> int {
|
||||
i++;
|
||||
}
|
||||
if i > prev_i {
|
||||
buffer_write_string(b, fmt[prev_i:i]);
|
||||
buffer_write_string(b, fmt[prev_i..i]);
|
||||
}
|
||||
if i >= end {
|
||||
break;
|
||||
@@ -1026,7 +1026,7 @@ bprintf :: proc(b: ^Buffer, fmt: string, args: ...any) -> int {
|
||||
break;
|
||||
}
|
||||
|
||||
verb, w := utf8.decode_rune(fmt[i:]);
|
||||
verb, w := utf8.decode_rune(fmt[i..]);
|
||||
i += w;
|
||||
|
||||
if verb == '%' {
|
||||
@@ -1043,7 +1043,7 @@ bprintf :: proc(b: ^Buffer, fmt: string, args: ...any) -> int {
|
||||
|
||||
if !fi.reordered && arg_index < args.count {
|
||||
buffer_write_string(b, "%!(EXTRA ");
|
||||
for arg, index in args[arg_index:] {
|
||||
for arg, index in args[arg_index..] {
|
||||
if index > 0 {
|
||||
buffer_write_string(b, ", ");
|
||||
}
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ murmur32 :: proc(data: []byte) -> u32 {
|
||||
h1 = h1*5 + 0xe6546b64;
|
||||
}
|
||||
|
||||
tail := data[nblocks*4:];
|
||||
tail := data[nblocks*4 ..];
|
||||
|
||||
k1: u32;
|
||||
match tail.count&3 {
|
||||
@@ -174,7 +174,7 @@ murmur64 :: proc(data: []byte) -> u64 {
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
data8 := slice_to_bytes(data32[i:])[:3];
|
||||
data8 := slice_to_bytes(data32[i..])[..3];
|
||||
match len {
|
||||
case 3:
|
||||
h2 ~= cast(u32)data8[2] << 16;
|
||||
|
||||
+4
-4
@@ -151,8 +151,8 @@ mat4_identity :: proc() -> Mat4 {
|
||||
}
|
||||
|
||||
mat4_transpose :: proc(m: Mat4) -> Mat4 {
|
||||
for j in 0..<4 {
|
||||
for i in 0..<4 {
|
||||
for j in 0..4 {
|
||||
for i in 0..4 {
|
||||
m[i][j], m[j][i] = m[j][i], m[i][j];
|
||||
}
|
||||
}
|
||||
@@ -161,8 +161,8 @@ mat4_transpose :: proc(m: Mat4) -> Mat4 {
|
||||
|
||||
mul :: proc(a, b: Mat4) -> Mat4 {
|
||||
c: Mat4;
|
||||
for j in 0..<4 {
|
||||
for i in 0..<4 {
|
||||
for j in 0..4 {
|
||||
for i in 0..4 {
|
||||
c[j][i] = a[0][i]*b[j][0] +
|
||||
a[1][i]*b[j][1] +
|
||||
a[2][i]*b[j][2] +
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ copy_non_overlapping :: proc(dst, src: rawptr, len: int) -> rawptr #link_name "_
|
||||
|
||||
compare :: proc(a, b: []byte) -> int #link_name "__mem_compare" {
|
||||
n := min(a.count, b.count);
|
||||
for i in 0..<n {
|
||||
for i in 0..n {
|
||||
match {
|
||||
case a[i] < b[i]:
|
||||
return -1;
|
||||
@@ -117,7 +117,7 @@ Arena_Temp_Memory :: struct {
|
||||
|
||||
init_arena_from_memory :: proc(using a: ^Arena, data: []byte) {
|
||||
backing = Allocator{};
|
||||
memory = data[:0];
|
||||
memory = data[..0];
|
||||
temp_count = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ open :: proc(path: string, mode: int, perm: u32) -> (Handle, Errno) {
|
||||
}
|
||||
|
||||
buf: [300]byte;
|
||||
copy(buf[:], cast([]byte)path);
|
||||
copy(buf[..], cast([]byte)path);
|
||||
|
||||
handle := cast(Handle)CreateFileA(^buf[0], access, share_mode, sa, create_mode, FILE_ATTRIBUTE_NORMAL, nil);
|
||||
if handle != INVALID_HANDLE {
|
||||
@@ -184,7 +184,7 @@ last_write_time_by_name :: proc(name: string) -> File_Time {
|
||||
|
||||
assert(buf.count > name.count);
|
||||
|
||||
copy(buf[:], cast([]byte)name);
|
||||
copy(buf[..], cast([]byte)name);
|
||||
|
||||
if win32.GetFileAttributesExA(^buf[0], win32.GetFileExInfoStandard, ^data) != 0 {
|
||||
last_write_time = data.last_write_time;
|
||||
@@ -201,7 +201,7 @@ last_write_time_by_name :: proc(name: string) -> File_Time {
|
||||
|
||||
read_entire_file :: proc(name: string) -> ([]byte, bool) {
|
||||
buf: [300]byte;
|
||||
copy(buf[:], cast([]byte)name);
|
||||
copy(buf[..], cast([]byte)name);
|
||||
|
||||
fd, err := open(name, O_RDONLY, 0);
|
||||
if err != ERROR_NONE {
|
||||
|
||||
+36
-37
@@ -1,6 +1,5 @@
|
||||
#import . "decimal.odin";
|
||||
#import "math.odin";
|
||||
#import format "fmt.odin";
|
||||
|
||||
Int_Flag :: enum {
|
||||
PREFIX = 1<<0,
|
||||
@@ -22,7 +21,7 @@ parse_bool :: proc(s: string) -> (result: bool, ok: bool) {
|
||||
format_bool :: proc(buf: []byte, b: bool) -> string {
|
||||
s := b ? "true" : "false";
|
||||
len := copy(buf, cast([]byte)s);
|
||||
return cast(string)buf[:len];
|
||||
return cast(string)buf[..len];
|
||||
}
|
||||
|
||||
format_uint :: proc(buf: []byte, u: u64, base: int) -> string {
|
||||
@@ -44,10 +43,10 @@ format_float :: proc(buf: []byte, f: f64, fmt: byte, prec, bit_size: int) -> str
|
||||
|
||||
|
||||
Decimal_Slice :: struct {
|
||||
d: []byte,
|
||||
ndu: int,
|
||||
dp: int,
|
||||
neg: bool,
|
||||
digits: []byte,
|
||||
count: int,
|
||||
decimal_point: int,
|
||||
neg: bool,
|
||||
}
|
||||
|
||||
Float_Info :: struct {
|
||||
@@ -89,7 +88,7 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, prec, bit_size: int) -> [
|
||||
s = "+Inf";
|
||||
}
|
||||
len := copy(buf, cast([]byte)s);
|
||||
return buf[:len];
|
||||
return buf[..len];
|
||||
|
||||
case 0: // denormalized
|
||||
exp++;
|
||||
@@ -108,19 +107,19 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, prec, bit_size: int) -> [
|
||||
shortest := prec < 0;
|
||||
if shortest {
|
||||
round_shortest(d, mant, exp, flt);
|
||||
digs = Decimal_Slice{d = d.d[:], ndu = d.ndu, dp = d.dp};
|
||||
digs = Decimal_Slice{digits = d.digits[..], count = d.count, decimal_point = d.decimal_point};
|
||||
match fmt {
|
||||
case 'e', 'E':
|
||||
prec = digs.ndu-1;
|
||||
prec = digs.count-1;
|
||||
case 'f', 'F':
|
||||
prec = max(digs.ndu-digs.dp, 0);
|
||||
prec = max(digs.count-digs.decimal_point, 0);
|
||||
case 'g', 'G':
|
||||
prec = digs.ndu;
|
||||
prec = digs.count;
|
||||
}
|
||||
} else {
|
||||
match fmt {
|
||||
case 'e', 'E': round(d, prec+1);
|
||||
case 'f', 'F': round(d, d.dp+prec);
|
||||
case 'f', 'F': round(d, d.decimal_point+prec);
|
||||
case 'g', 'G':
|
||||
if prec == 0 {
|
||||
prec = 1;
|
||||
@@ -128,7 +127,7 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, prec, bit_size: int) -> [
|
||||
round(d, prec);
|
||||
}
|
||||
|
||||
digs = Decimal_Slice{d = d.d[:], ndu = d.ndu, dp = d.dp};
|
||||
digs = Decimal_Slice{digits = d.digits[..], count = d.count, decimal_point = d.decimal_point};
|
||||
}
|
||||
return format_digits(buf, shortest, neg, digs, prec, fmt);
|
||||
}
|
||||
@@ -138,7 +137,7 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, prec, bit_size: int) -> [
|
||||
format_digits :: proc(buf: []byte, shortest: bool, neg: bool, digs: Decimal_Slice, prec: int, fmt: byte) -> []byte {
|
||||
match fmt {
|
||||
case 'f', 'F':
|
||||
add_bytes :: proc(dst: ^[]byte, w: ^int, bytes: ...byte) {
|
||||
add_bytes :: proc(dst: ^[]byte, w: ^int, bytes: ..byte) {
|
||||
for b in bytes {
|
||||
if dst.count <= w^ {
|
||||
break;
|
||||
@@ -148,7 +147,7 @@ format_digits :: proc(buf: []byte, shortest: bool, neg: bool, digs: Decimal_Slic
|
||||
}
|
||||
}
|
||||
|
||||
dst := buf[:];
|
||||
dst := buf[..];
|
||||
w := 0;
|
||||
if neg {
|
||||
add_bytes(^dst, ^w, '-');
|
||||
@@ -157,10 +156,10 @@ format_digits :: proc(buf: []byte, shortest: bool, neg: bool, digs: Decimal_Slic
|
||||
}
|
||||
|
||||
// integer, padded with zeros when needed
|
||||
if digs.dp > 0 {
|
||||
m := min(digs.ndu, digs.dp);
|
||||
add_bytes(^dst, ^w, ...digs.d[:m]);
|
||||
for ; m < digs.dp; m++ {
|
||||
if digs.decimal_point > 0 {
|
||||
m := min(digs.count, digs.decimal_point);
|
||||
add_bytes(^dst, ^w, ..digs.digits[..m]);
|
||||
for ; m < digs.decimal_point; m++ {
|
||||
add_bytes(^dst, ^w, '0');
|
||||
}
|
||||
} else {
|
||||
@@ -170,16 +169,16 @@ format_digits :: proc(buf: []byte, shortest: bool, neg: bool, digs: Decimal_Slic
|
||||
// fractional part
|
||||
if prec > 0 {
|
||||
add_bytes(^dst, ^w, '.');
|
||||
for i in 0..<prec {
|
||||
for i in 0..prec {
|
||||
c: byte = '0';
|
||||
if j := digs.dp + i; 0 <= j && j < digs.ndu {
|
||||
c = digs.d[j];
|
||||
if j := digs.decimal_point + i; 0 <= j && j < digs.count {
|
||||
c = digs.digits[j];
|
||||
}
|
||||
add_bytes(^dst, ^w, c);
|
||||
}
|
||||
}
|
||||
|
||||
return buf[:w];
|
||||
return buf[..w];
|
||||
|
||||
case 'e', 'E':
|
||||
return nil; // TODO
|
||||
@@ -191,13 +190,13 @@ format_digits :: proc(buf: []byte, shortest: bool, neg: bool, digs: Decimal_Slic
|
||||
c: [2]byte;
|
||||
c[0] = '%';
|
||||
c[1] = fmt;
|
||||
len := copy(buf, ...c[:]);
|
||||
return buf[:len];
|
||||
len := copy(buf, ..c[..]);
|
||||
return buf[..len];
|
||||
}
|
||||
|
||||
round_shortest :: proc(d: ^Decimal, mant: u64, exp: int, flt: ^Float_Info) {
|
||||
if mant == 0 { // If mantissa is zero, the number is zero
|
||||
d.ndu = 0;
|
||||
d.count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,7 +207,7 @@ round_shortest :: proc(d: ^Decimal, mant: u64, exp: int, flt: ^Float_Info) {
|
||||
332*(dp-nd) >= 100*(exp-mantbits)
|
||||
*/
|
||||
minexp := flt.bias+1;
|
||||
if exp > minexp && 332*(d.dp-d.ndu) >= 100*(exp - cast(int)flt.mantbits) {
|
||||
if exp > minexp && 332*(d.decimal_point-d.count) >= 100*(exp - cast(int)flt.mantbits) {
|
||||
// Number is already its shortest
|
||||
return;
|
||||
}
|
||||
@@ -232,19 +231,19 @@ round_shortest :: proc(d: ^Decimal, mant: u64, exp: int, flt: ^Float_Info) {
|
||||
|
||||
inclusive := mant%2 == 0;
|
||||
|
||||
for i in 0..<d.ndu {
|
||||
for i in 0..d.count {
|
||||
l: byte = '0'; // lower digit
|
||||
if i < lower.ndu {
|
||||
l = lower.d[i];
|
||||
if i < lower.count {
|
||||
l = lower.digits[i];
|
||||
}
|
||||
m := d.d[i]; // middle digit
|
||||
m := d.digits[i]; // middle digit
|
||||
u: byte = '0'; // upper digit
|
||||
if i < upper.ndu {
|
||||
u = upper.d[i];
|
||||
if i < upper.count {
|
||||
u = upper.digits[i];
|
||||
}
|
||||
|
||||
ok_round_down := l != m || inclusive && i+1 == lower.ndu;
|
||||
ok_round_up := m != u && (inclusive || m+1 < u || i+1 < upper.ndu);
|
||||
ok_round_down := l != m || inclusive && i+1 == lower.count;
|
||||
ok_round_up := m != u && (inclusive || m+1 < u || i+1 < upper.count);
|
||||
|
||||
if (ok_round_down && ok_round_up) {
|
||||
round(d, i+1);
|
||||
@@ -331,7 +330,7 @@ format_bits :: proc(buf: []byte, u: u64, base: int, neg: bool, digits: string, f
|
||||
}
|
||||
|
||||
|
||||
len := copy(buf, ...a[i:]);
|
||||
return cast(string)buf[:len];
|
||||
len := copy(buf, ..a[i..]);
|
||||
return cast(string)buf[..len];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ decode_last_rune :: proc(s: []byte) -> (rune, int) {
|
||||
}
|
||||
|
||||
start = max(start, 0);
|
||||
r, size = decode_rune(s[start:end]);
|
||||
r, size = decode_rune(s[start..end]);
|
||||
if start+size != end {
|
||||
return RUNE_ERROR, 1;
|
||||
}
|
||||
|
||||
+1
-2
@@ -715,8 +715,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
|
||||
|
||||
TokenKind op = Token_Lt;
|
||||
switch (ie->op.kind) {
|
||||
case Token_HalfOpenRange: op = Token_Lt; break;
|
||||
case Token_Ellipsis: op = Token_LtEq; break;
|
||||
case Token_Ellipsis: op = Token_Lt; break;
|
||||
default: error(ie->op, "Invalid range operator"); break;
|
||||
}
|
||||
bool ok = compare_exact_values(Token_Lt, a, b);
|
||||
|
||||
@@ -4742,8 +4742,7 @@ void ir_build_range_interval(irProcedure *proc, AstNodeIntervalExpr *node, Type
|
||||
|
||||
TokenKind op = Token_Lt;
|
||||
switch (node->op.kind) {
|
||||
case Token_HalfOpenRange: op = Token_Lt; break;
|
||||
case Token_Ellipsis: op = Token_LtEq; break;
|
||||
case Token_Ellipsis: op = Token_Lt; break;
|
||||
default: GB_PANIC("Invalid interval operator"); break;
|
||||
}
|
||||
irValue *cond = ir_emit_comp(proc, op, ir_emit_load(proc, value), upper);
|
||||
|
||||
+2
-7
@@ -1950,16 +1950,12 @@ AstNode *parse_atom_expr(AstFile *f, bool lhs) {
|
||||
f->expr_level++;
|
||||
open = expect_token(f, Token_OpenBracket);
|
||||
|
||||
// if (f->curr_token.kind != Token_Ellipsis &&
|
||||
// f->curr_token.kind != Token_HalfOpenRange) {
|
||||
if (f->curr_token.kind != Token_Colon) {
|
||||
if (f->curr_token.kind != Token_Ellipsis) {
|
||||
indices[0] = parse_expr(f, false);
|
||||
}
|
||||
bool is_index = true;
|
||||
|
||||
// if (f->curr_token.kind == Token_Ellipsis ||
|
||||
// f->curr_token.kind == Token_HalfOpenRange) {
|
||||
if (f->curr_token.kind == Token_Colon) {
|
||||
if (f->curr_token.kind == Token_Ellipsis) {
|
||||
is_index = false;
|
||||
interval = f->curr_token;
|
||||
next_token(f);
|
||||
@@ -2261,7 +2257,6 @@ AstNode *parse_simple_stmt(AstFile *f, bool in_stmt_ok) {
|
||||
allow_token(f, Token_in);
|
||||
AstNode *expr = parse_expr(f, false);
|
||||
switch (f->curr_token.kind) {
|
||||
case Token_HalfOpenRange:
|
||||
case Token_Ellipsis: {
|
||||
Token op = f->curr_token;
|
||||
next_token(f);
|
||||
|
||||
+31
-9
@@ -73,8 +73,8 @@ TOKEN_KIND(Token__ComparisonEnd, "_ComparisonEnd"), \
|
||||
TOKEN_KIND(Token_Semicolon, ";"), \
|
||||
TOKEN_KIND(Token_Period, "."), \
|
||||
TOKEN_KIND(Token_Comma, ","), \
|
||||
TOKEN_KIND(Token_Ellipsis, "..."), \
|
||||
TOKEN_KIND(Token_HalfOpenRange, "..<"), \
|
||||
TOKEN_KIND(Token_Ellipsis, ".."), \
|
||||
/* TOKEN_KIND(Token_HalfOpenRange, "..<"), */ \
|
||||
TOKEN_KIND(Token__OperatorEnd, "_OperatorEnd"), \
|
||||
\
|
||||
TOKEN_KIND(Token__KeywordBegin, "_KeywordBegin"), \
|
||||
@@ -225,6 +225,23 @@ void syntax_error_va(Token token, char *fmt, va_list va) {
|
||||
gb_mutex_unlock(&global_error_collector.mutex);
|
||||
}
|
||||
|
||||
void syntax_warning_va(Token token, char *fmt, va_list va) {
|
||||
gb_mutex_lock(&global_error_collector.mutex);
|
||||
global_error_collector.warning_count++;
|
||||
// NOTE(bill): Duplicate error, skip it
|
||||
if (!token_pos_eq(global_error_collector.prev, token.pos)) {
|
||||
global_error_collector.prev = token.pos;
|
||||
gb_printf_err("%.*s(%td:%td) Syntax Warning: %s\n",
|
||||
LIT(token.pos.file), token.pos.line, token.pos.column,
|
||||
gb_bprintf_va(fmt, va));
|
||||
} else if (token.pos.line == 0) {
|
||||
gb_printf_err("Warning: %s\n", gb_bprintf_va(fmt, va));
|
||||
}
|
||||
|
||||
gb_mutex_unlock(&global_error_collector.mutex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void warning(Token token, char *fmt, ...) {
|
||||
va_list va;
|
||||
@@ -247,6 +264,13 @@ void syntax_error(Token token, char *fmt, ...) {
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void syntax_warning(Token token, char *fmt, ...) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
syntax_warning_va(token, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
|
||||
void compiler_error(char *fmt, ...) {
|
||||
va_list va;
|
||||
@@ -834,13 +858,11 @@ Token tokenizer_get_token(Tokenizer *t) {
|
||||
token.kind = Token_Period; // Default
|
||||
if (t->curr_rune == '.') { // Could be an ellipsis
|
||||
advance_to_next_rune(t);
|
||||
if (t->curr_rune == '<') {
|
||||
advance_to_next_rune(t);
|
||||
token.kind = Token_HalfOpenRange;
|
||||
} else if (t->curr_rune == '.') {
|
||||
advance_to_next_rune(t);
|
||||
token.kind = Token_Ellipsis;
|
||||
}
|
||||
token.kind = Token_Ellipsis;
|
||||
// if (t->curr_rune == '<') {
|
||||
// advance_to_next_rune(t);
|
||||
// token.kind = Token_HalfOpenRange;
|
||||
// }
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user