Brian Anderson
7f90000ab6
Precision overrides 0-padding in #fmt
2011-04-18 22:53:26 -04:00
Brian Anderson
59d5267936
Rearrange ExtFmt.RT.pad to recover some horizontal space
2011-04-18 21:36:04 -04:00
Brian Anderson
869b28e393
Left-justification overrides 0-padding in #fmt
2011-04-18 21:36:04 -04:00
Brian Anderson
d4f1a48111
Support 0 flag in #fmt
2011-04-18 21:36:04 -04:00
Brian Anderson
9976bb93d6
Support the space flag in #fmt
2011-04-17 19:50:58 -04:00
Brian Anderson
86a43c24d6
Support + flag in #fmt
2011-04-17 18:19:26 -04:00
Brian Anderson
1bec738c56
Support #fmt precision for bools, with same rules as strings
...
Not totally confident this is desirable. The alternative would be to make it a
compile error.
2011-04-17 17:24:17 -04:00
Brian Anderson
685e820465
Treat char #fmt conversions just like str conversions
...
Add missing tests
2011-04-17 17:06:55 -04:00
Brian Anderson
8f6603f58e
Support #fmt precision for signed types
2011-04-17 16:51:17 -04:00
Brian Anderson
4c0aea69da
Support #fmt precision for unsigned types
2011-04-17 16:18:25 -04:00
Brian Anderson
c7edcb3a72
Support #fmt precision for string types
2011-04-17 13:10:02 -04:00
Brian Anderson
96e3e29e88
Support left-justification in #fmt conversions
2011-04-16 19:43:29 -04:00
Brian Anderson
dcfdb02fab
Make #fmt support explicit conversion widths
2011-04-16 18:01:17 -04:00
Patrick Walton
3e922e2ecf
stdlib: Add some vector functions: empty, empty_mut, grow_set, and freeze. Change _vec.grow to use uint arguments.
2011-04-15 17:46:16 -07:00
Patrick Walton
ec5a60d5e2
rustc: Use union-find for variable substitution
2011-04-14 11:24:25 -07:00
Brian Anderson
99a697b56a
Add support for upper-case hex and binary output to #fmt.
...
Only works for uints at present. Necessitated the addition of _str.to_upper.
2011-04-13 22:14:54 -04:00
Brian Anderson
5c0f4c1939
Add more commentary about ExtFmt
2011-04-13 22:14:40 -04:00
Brian Anderson
4844e1c08a
Add support for printing uints as lower-case hex to ExtFmt.
...
Begin passing an ExtFmt.RT.conv parsed format description to each of the
ExtFmt.RT.conv* functions.
2011-04-13 22:14:24 -04:00
Brian Anderson
aebdef0cd6
Move #fmt conversion model into ExtFmt.CT namespace
2011-04-13 22:13:21 -04:00
Tim Chevalier
7c6e6fc5d4
Make expr_while work in typestate_check
...
Also did some refactoring in typestate_check. All test cases in
compile-fail that involve uninitialized vars now fail correctly!
(All eight of them, that is.)
2011-04-13 15:50:34 -07:00
Graydon Hoare
80a4b1ba53
Slight updates to match API drift in io, lib-io.rs passes.
2011-04-13 12:05:15 -07:00
Tim Chevalier
d7e8818414
Further work on typestate. Handles expr_rec and expr_assign now.
...
Also changed the ts_ann field on statements to be an ann instead,
which explains most of the changes.
As well, got rid of the "warning: no type for expression" error
by filling in annotations for local decls in typeck (not sure whether
this was my fault or not).
Finally, in bitv, added a clone() function to copy a bit vector,
and fixed is_true, is_false, and to_str to not be nonsense.
2011-04-12 14:31:46 -07:00
Brian Anderson
73eecbd0ca
Factor out creation of calls into ExtFmt.RT
2011-04-11 21:55:03 -04:00
Brian Anderson
bba245f3e6
Add support for bool, char to extfmt.
...
XFAIL syntax-extension-fmt in rustboot.
2011-04-11 21:54:03 -04:00
Brian Anderson
37f87161cc
Move ExtFmt compile-time functions into their own module
2011-04-11 21:51:23 -04:00
Brian Anderson
c41796f2ca
Use correct indentation for ExtFmt.rs
2011-04-11 21:51:23 -04:00
Brian Anderson
ce85b9eb7b
Make ExtFmt call its own functions instead of others defined in std
2011-04-11 21:51:23 -04:00
Brian Anderson
d4d0144bcf
Move extfmt parsing into standard library
2011-04-11 21:51:23 -04:00
Brian Anderson
5a36786634
Move the extfmt data model into the standard library.
2011-04-11 21:51:23 -04:00
Marijn Haverbeke
094d31f5e4
Make lexer buffer the whole file
...
This way, it won't have to go through a bunch of calls for each
byte fetched.
2011-04-09 01:05:18 +02:00
Tim Chevalier
9c001af07c
Implemented computing prestates and poststates for a few expression forms.
...
The typestate checker (if it's uncommented) now correctly rejects a
trivial example program that has an uninitialized variable.
2011-04-08 17:46:46 +00:00
Patrick Walton
afa6d85d61
stdlib: Add a simple union-find data structure
2011-04-07 18:02:01 -07:00
Marijn Haverbeke
53cc673db1
Re-add a read_byte() method to buf_reader objs
...
This was removed because of the repetition, but doing single-byte
reads in terms of read_bytes (which allocates a vec) is needlessly
slow. This change speeds up parsing by 22%.
(Eventually, we won't be able to escape handling the buffering in the
stdlib itself.)
2011-04-08 02:23:14 +02:00
Marijn Haverbeke
ac3026412b
Revise EBML reader API
...
New one is less stateful, easier to work with.
2011-04-07 14:19:16 -07:00
Tim Chevalier
2e90bd94de
Continued sketching out code for checking states against preconditions.
...
It's still sketchy. I added a typestate annotation field to statements
tagged stmt_decl or stmt_expr, because a stmt_decl statement has a typestate
that's different from that of its child node. This necessitated trivial
changes to a bunch of other files all over to the compiler. I also added a
few small standard library functions, some of which I didn't actually end
up using but which I thought might be useful anyway.
2011-04-06 17:58:18 -07:00
Tim Chevalier
3130348ee1
Started adding support for typestate checking.
...
I added a new field to the ast "ann" type for typestate information.
Currently, the field contains a record of a precondition bit vector and
postcondition vector, but I tried to structure things so as to make
it easy to change the representation of the typestate annotation type.
I also had to add annotations to some syntactic forms that didn't have
them before (fail, ret, be...), with all the boilerplate changes
that that would imply.
The main call to the typestate_check entry point is commented out and
the actual pre-postcondition algorithm only has a few cases
implemented, though the overall AST traversal is there. The rest of
the typestate algorithm isn't implemented yet.
2011-04-01 11:27:32 -07:00
Patrick Walton
3c1de96cda
rustc: Use the crate index to look up defs
2011-03-31 14:37:44 -07:00
Patrick Walton
dec92d392e
stdlib: Add a write_be_uint() function to writers
2011-03-31 11:54:52 -07:00
Graydon Hoare
e99feabf47
Add a result_str method to std.sha1.sha1.
2011-03-26 17:36:08 -07:00
Patrick Walton
24a75eeccc
rustc: Parse definition IDs from crates; add a function to parse unsigned ints to the standard library
2011-03-25 18:35:30 -07:00
Patrick Walton
94c19a18ae
rustc: Look up names in "use"d crates
2011-03-25 17:54:48 -07:00
Patrick Walton
864e2ab24e
stdlib: Implement a memory buffer reader, untested at the moment
2011-03-25 15:01:21 -07:00
Patrick Walton
739c4aedf1
stdlib: Separate basic I/O reading functionality into a separate buf_reader object, like writing
2011-03-25 14:06:18 -07:00
Marijn Haverbeke
a045514477
Start making the standard-lib utf-8 aware
...
Finally implements _str.is_utf8, adds from_chars, from_char, to_chars,
char_at, char_len, (push|pop|shift|unshift)_char. Also, proper
character I/O for streams.
2011-03-25 08:22:52 -07:00
Patrick Walton
af3d0d1848
rustc: Open "use"d crates; add a _vec.vec_from_buf() method along the way; XFAIL use-import-export.rs in rustc
2011-03-24 17:22:07 -07:00
Patrick Walton
c1bc0101ca
stdlib: Provide a function to extract the underlying buf_writer from a writer
2011-03-22 17:53:43 -07:00
Patrick Walton
d56971d5b4
stdlib: Add EBML writing functionality
2011-03-22 17:29:23 -07:00
Patrick Walton
e890383db1
stdlib: Add a convenience method for opening paths as a FILE
2011-03-22 17:29:23 -07:00
Patrick Walton
b33f0df152
stdlib: Make writers seekable; switch file writers to the C FILE interface to make this work
2011-03-22 16:40:22 -07:00
Patrick Walton
bcf04e253f
Revert "Remove usages of case(_) { fail; } since the compiler does this automatically". When we have exhaustiveness checking, "case(_) { fail; }" will be useful to silence warnings.
...
This reverts commit 92a716d862
.
2011-03-22 14:02:52 -07:00