505 Commits

Author SHA1 Message Date
0ad7a7d9ff Code review changes. 2015-01-25 13:02:44 -08:00
0e6a90443e Add containsKey() to Map, and validate key types. 2015-01-25 12:39:19 -08:00
492c730e6f Key and value iteration for maps. Also toString. 2015-01-25 10:27:38 -08:00
251b623c65 Map "clear" method. 2015-01-25 08:39:44 -08:00
e740a4c95a Map literals! 2015-01-24 23:21:50 -08:00
abe80e6d4b Initial map implementation.
Still lots of methods missing and clean up and tests to do.
Also still no literal syntax.

But the core hash table code is there and working. The supported
key types are all, uh, supported.
2015-01-24 22:27:35 -08:00
12102b19ef Adds support for hexadecimal literals. 2015-01-24 22:07:46 -08:00
cff08f989b Rename a couple of tests. 2015-01-24 14:42:25 -08:00
438e7bae3f Merge branch 'list-join' of git://github.com/gsmaverick/wren into gsmaverick-list-join 2015-01-24 14:39:45 -08:00
4977083904 Abstract List's toString method to a more general join method on Sequence. 2015-01-24 14:01:16 -08:00
efd161cea2 Add "arity" getter to Fn. 2015-01-23 20:33:05 -08:00
eb424f5c1a Make strings iterable over their code points.
I'm not sure why, but this also regresses perf:

binary_trees - wren            ..........  3290  0.30s   96.68% relative to baseline
delta_blue - wren              ..........  7948  0.13s   99.06% relative to baseline
fib - wren                     ..........  3165  0.32s   95.90% relative to baseline
for - wren                     ..........  8242  0.12s   96.00% relative to baseline
method_call - wren             ..........  5417  0.18s   78.74% relative to baseline

Need to investigate.
2015-01-22 20:58:22 -08:00
a5b00cebe7 Clarify how string subscripting handles UTF-8. 2015-01-22 16:38:03 -08:00
a92e58c804 Add tests for string methods that support UTF-8 already. 2015-01-22 15:28:54 -08:00
c5e67953b8 Allow non-ASCII UTF-8 characters in string literals. 2015-01-22 15:18:30 -08:00
513af6df65 Fix precedence of % operator
It previously had the same precedence as + and -.
2015-01-22 09:49:53 +13:00
9453acf1e6 User-defined subscript operators. 2015-01-20 18:25:54 -08:00
b55eb7de7a Merge branch 'string-range-subscript' of git://github.com/gsmaverick/wren into gsmaverick-string-range-subscript 2015-01-20 15:01:14 -08:00
bfc2f9c0ee Adds range subscripting for strings. 2015-01-18 22:55:30 -08:00
d8b678356e Raise precedence of "is". Fix #119. 2015-01-18 10:20:13 -08:00
82740d2668 Add a test demonstrating folding order 2015-01-16 09:48:59 +01:00
4bc06a3acc Add reduce test for ranges 2015-01-16 09:33:23 +01:00
d764581a3d Add test for empty reduce 2015-01-16 09:29:45 +01:00
5cfb638fd1 Use @munificent's single-argument reduce 2015-01-16 09:26:19 +01:00
4c6b819ed1 Add reduce function on Sequence 2015-01-16 09:24:59 +01:00
64c2bd7633 Make all types support "!" so "if (!foo)" works reliably for all objects. 2015-01-15 21:50:01 -08:00
2ddf0a9586 Fix some overlooked references to forall. 2015-01-15 19:05:58 -08:00
4249f92571 Rename tests. 2015-01-15 06:54:16 -08:00
78e99c6c99 Merge branch 'list-forall' of git://github.com/gsmaverick/wren into gsmaverick-list-forall 2015-01-15 06:52:43 -08:00
b829ce67af Rename forall to all. 2015-01-14 23:19:31 -08:00
c50e46725f Implicitly define nonlocal names.
If a capitalized name cannot be resolved, a new top-level
variable with its name is implicitly declared. If a real
definition is not found later, a compile time error is raised.

Mutual recursion at the top level works now!

Fix #101. Fix #106.
2015-01-14 23:08:25 -08:00
f2b334d7d2 Add more forall test cases. 2015-01-14 22:51:34 -08:00
7716ad6263 Adds forall method on Sequences. 2015-01-13 23:47:01 -08:00
a8e2ba233c Add support for "nonlocal" (capitalized) names, and change how variable lookup works.
Inside a method, all local variable lookup stops at the method boundary. In other
words, methods, do not close over outer local variables.

If a name is not found inside a method and is lowercase, it's a method on this.
If it's capitalized, it's a global variable.
2015-01-13 21:36:42 -08:00
1d9445d9bc Tests for IO.read(). 2015-01-11 21:47:29 -08:00
73b041a78a Merge branch 'master' of git://github.com/Alek900/wren into Alek900-master
Conflicts:
	src/wren_compiler.c
2015-01-11 20:01:30 -08:00
21e740d5c3 Test that carriage returns are treated like whitespace. 2015-01-11 19:58:30 -08:00
be0032cc40 Merge branch 'segfault_on_top_level_super_with_no_args' of git://github.com/zeckalpha/wren into zeckalpha-segfault_on_top_level_super_with_no_args 2015-01-11 19:42:26 -08:00
bc29e0929e Rename a couple of files and tweak some docs. 2015-01-11 19:13:15 -08:00
7557c91b3c Adds some common methods to strings. 2015-01-11 16:06:56 -08:00
c376d88e61 super at top level: Allow the compiler to continue compilation after erroring. Added two more tests. 2015-01-11 17:44:10 -06:00
3490c8d2f3 Segfault when calling super at top-level with no arguments.
If enclosingClass is null, we can't proceed with compilation since we don't have its name.
2015-01-09 15:14:06 -06:00
3116bf97de Use correct buffer size in string subscript operator. 2015-01-09 07:12:25 -08:00
bcf052436f Merge pull request #94 from edsrzf/fix-neg-number
Don't treat negative numbers as literals
2015-01-09 07:00:12 -08:00
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
a9f1d52ef7 Merge branch 'improve-debugging' of git://github.com/gsmaverick/wren into gsmaverick-improve-debugging 2015-01-08 21:49:20 -08:00
15b0d8777c Handle toString not returning a string in IO.print and IO.write.
Fix #67.
2015-01-08 07:53:37 -08:00
09bb28735c Merge branch 'feature-shebang-support' of git://github.com/mauvm/wren into mauvm-feature-shebang-support 2015-01-04 13:02:42 -08:00
a9bb2387a1 Handle empty (or comment-only) files. Fix #57. 2015-01-04 13:00:53 -08:00
7f90485cff Let the user know the arity of a missing method in the error message. 2015-01-04 14:42:11 -05:00