Commit Graph

30 Commits

Author SHA1 Message Date
2e425571ca Update. 2026-01-25 04:58:39 +01:00
Bob Nystrom
64eccdd9be Reorganize tests and benchmark scripts.
Mainly to get rid of one top level directory. But this will
also be useful when there are tests of the embedding API.
2015-03-14 12:45:56 -07:00
Bob Nystrom
69567c5eb5 Control string representation of infinity. 2015-03-13 07:35:10 -07:00
Marco Lizza
d56e2d6398 Removing old tests. 2015-03-05 11:27:56 +01:00
Marco Lizza
130d0df957 Fixing the test a bit. 2015-03-05 11:24:54 +01:00
Marco Lizza
fde6f74d15 Adding tests. 2015-03-04 16:12:08 +01:00
Bob Nystrom
28005ed47a Refactor number parsing a bit. 2015-03-03 07:17:56 -08:00
Gavin Schulz
0ec31433c8 Generate an error if a number literal is too large to be represented with the Num class. 2015-03-03 00:07:55 -08:00
Bob Nystrom
fc2ed6f6e1 Don't allow trailing non-number characters when parsing a string to a number. 2015-02-25 07:07:54 -08:00
Gavin Schulz
f4a39bc943 Code review changes. 2015-02-25 01:20:53 -08:00
Gavin Schulz
03a5b96040 Add a fromString static method on Num that converts strings to numbers. 2015-02-22 20:06:17 -08:00
Marco Lizza
00cdef303c Adding new bitwise operands tests. 2015-02-16 11:30:15 +01:00
Gavin Schulz
0ad7a7d9ff Code review changes. 2015-01-25 13:02:44 -08:00
Gavin Schulz
12102b19ef Adds support for hexadecimal literals. 2015-01-24 22:07:46 -08:00
Evan Shaw
513af6df65 Fix precedence of % operator
It previously had the same precedence as + and -.
2015-01-22 09:49:53 +13:00
Bob Nystrom
64c2bd7633 Make all types support "!" so "if (!foo)" works reliably for all objects. 2015-01-15 21:50:01 -08:00
Evan Shaw
75d28c083c Don't treat negative numbers as literals
Fixes #93.

Previously, "1 -1" was lexed as two number tokens: a positive literal and
a negative literal. This caused problems when it came to parsing.

Now the '-' and the second number are separate tokens.

Note this is a breaking change, since `-16.sqrt` is now parsed as `-(16.sqrt)`,
as opposed to `(-16).sqrt`.

There is a small bit of overhead to doing it this way, but it might be possible
to optimize that out in the compiler at some point in the future.
2015-01-09 20:17:40 +13:00
Bob Nystrom
44e68a5db9 Fix #31. Bitwise operators on numbers. 2014-02-24 07:27:43 -08:00
Bob Nystrom
635d695083 Validate number comparison operand types. 2014-01-21 07:44:11 -08:00
Bob Nystrom
97bf314f4b Make Range a native object type.
Still need to implement better semantics, but this is an 
important first step. It's much faster now too, which is good.
2014-01-20 08:45:15 -08:00
Bob Nystrom
a8b51f6c8b Fill in some more mathematical functions. 2014-01-08 07:47:14 -08:00
Bob Nystrom
b979272305 Clean up text handling a bit:
- Rename IO.write -> IO.print.
- Make IO.write not print a newline.
- Support \u Unicode escapes in strings.
2014-01-05 12:27:12 -08:00
Bob Nystrom
a89386b4e8 Better argument validation for some list methods. 2014-01-02 07:32:00 -08:00
Bob Nystrom
48db3a9620 Start adding support for runtime errors:
- Primitives can now signal an error.
- An error prints a callstack and ends the current (and right 
  now only) fiber.
- Arithmetic operators error if the operand is not a number.
- Real error for method not found.
- Associate source file name, and method names with functions.
- Debug line number info for functions.

Unfortunately, this regresses perf on fib about 15%, mostly
because of the better checking in arithmetic ops.

There's still a bunch of clean up to do, but this is a big step
in the right direction.
2014-01-01 13:25:24 -08:00
Bob Nystrom
507e89d3b3 Range operators!
Added ".." and "..." infix operators. Num implements them to
return Range objects. Those in turn implement the iterator
protocol, so now numeric for loops are easy:

    for (i in 1..10) { ... }

I also cleaned up the Wren benchmarks to use this.

In the process, I discovered the method_call benchmark really
just showed loop peformance, so I unrolled the loops in all of
the languages to stress method calls.
2013-12-25 15:01:45 -08:00
Bob Nystrom
6c3aa85228 Make IO a static class instead of a singleton. 2013-12-21 19:25:09 -08:00
Bob Nystrom
f2b036420d Fix a bunch of test TODOs.
- Added a bunch of tests.
- Removed some TODOs for stuff that's already done.
- Made list literals handle newlines better.
2013-12-20 12:42:11 -08:00
Bob Nystrom
7fe60499db Get rid of my name from TODOs. Anyone can do them. 2013-12-14 15:28:18 -08:00
Bob Nystrom
6a0d550562 Bitwise ~ operator. 2013-12-04 22:09:31 -08:00
Bob Nystrom
56449cdbef Reorganize tests. 2013-11-26 22:52:00 -08:00