Commit graph

60 commits

Author SHA1 Message Date
Graydon Hoare
223c7dfb11 Fix comment-scanning logic in lexer. 2011-05-31 15:31:50 -07:00
Graydon Hoare
d12ea39896 Improve comment handling in pp. 2011-05-31 11:00:47 -07:00
Brian Anderson
81fc2d8728 rustc: Remove unneeded type params from alt patterns 2011-05-31 01:23:53 -04:00
Michael Sullivan
2119e3b5b9 Fix missing bump in RECV lexer case. 2011-05-27 12:01:20 -07:00
Michael Sullivan
55b40e6894 Lex '|>' as the RECV token. 2011-05-27 12:01:20 -07:00
Marijn Haverbeke
86d51ec24b Get test-pass/utf8.rs to run
This involved a small fix to the unicode-escape character lexing and
to the pretty-printer.
2011-05-23 23:25:55 +02:00
Patrick Walton
7e43a31f08 rustc: Move the interner to a new module intended to be used for general data structures 2011-05-20 13:57:53 -07:00
Marijn Haverbeke
a90df393f9 Alias-ify the parser and lexer
This only shaves a measly 19k off the rustc binary... but hey, every
little thing helps.
2011-05-17 20:45:49 +02:00
Marijn Haverbeke
09d8ef8d51 Finally rename std::_xxx to std::xxx
Except for _task, which is still a keyword.
2011-05-17 20:41:41 +02:00
Graydon Hoare
fbbc1a77d2 Rewrite everything to use [] instead of vec() in value position. 2011-05-16 18:21:22 -07:00
Patrick Walton
3ea3d9eed6 rustc: Make the parser use the interner 2011-05-16 14:54:10 -07:00
Marijn Haverbeke
ee45fd80c6 Mark IDENT tokens that are followed by ::
So that the type parser won't go off and try to parse a vec
type when it sees vec::init_op.
2011-05-14 12:57:42 +02:00
Marijn Haverbeke
57ffa2a487 Make the parser more careful about keywords
Keywords are now only recognized in contexts where they are valid. The
lexer no longer recognizes them, all words are lexed as IDENT tokens,
that get interpreted by the parser.
2011-05-13 22:00:13 +02:00
Marijn Haverbeke
3816e57fd2 Downcase std modules again, move to :: for module dereferencing
This should be a snapshot transition.
2011-05-12 21:30:44 +02:00
Marijn Haverbeke
6510f1ce7c Change module dereference syntax from . to ::
This will need to be a snapshot.
2011-05-12 21:30:35 +02:00
Marijn Haverbeke
079512494f Properly lex block comments followed by EOF 2011-05-12 09:31:06 +02:00
Brian Anderson
353ed4bdff Remove unused filename parameter from lexer.new_reader 2011-05-11 23:38:20 -04:00
Brian Anderson
a459bcd127 Give the lexer a session so that it can fail more informatively 2011-05-11 23:04:16 -04:00
Graydon Hoare
b00f3074d4 Remove boxes from token.t. 2011-05-09 14:17:45 -07:00
Marijn Haverbeke
a3ec0b1f64 Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
2011-05-06 22:51:19 +02:00
Tim Chevalier
e3a68e235c Bring back "pred" syntax for writing predicates for check
This commit reinstates the requirement that the predicate in a
"check" must be a manifest call to a special kind of function
declared with the new "pred" keyword instead of "fn". Preds must
have a boolean return type and can only call other preds; they
can't have any effects (as enforced by the typechecker).
The arguments to a predicate in a check expression must be
slot variables or literals.
2011-05-05 11:26:07 -07:00
Marijn Haverbeke
1f45dda9d2 Remove 'deprecated mutable...' from our code
This should make compilation a bit less noisy.
2011-05-05 20:19:43 +02:00
Patrick Walton
147a2d655f Un-revert "Use different syntax for checks that matter to typestate", fixing the problem.
This reverts commit d08b443fff.
2011-05-02 17:50:46 -07:00
Graydon Hoare
d08b443fff Revert "Use different syntax for checks that matter to typestate"
This reverts commit aa25f22f19. It broke stage2, not sure why yet.
2011-05-02 17:35:33 -07:00
Tim Chevalier
aa25f22f19 Use different syntax for checks that matter to typestate
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.

Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
2011-05-02 12:16:29 -07:00
Graydon Hoare
3d9cf15d0b Remove half-baked 'opacity' layer qualifier. 2011-04-19 14:00:04 -07:00
Graydon Hoare
d2bd07dcb0 Remove effect system from src. 2011-04-19 13:35:49 -07:00
Marijn Haverbeke
6511d471ba replace error logging with log_err in stdlib and rustc 2011-04-19 16:57:13 +02:00
Marijn Haverbeke
6d3a423094 add log_err to rustc 2011-04-19 16:57:13 +02:00
Graydon Hoare
8e0ecb4d1a Lex numeric escapes, needed for lib-str.rs (which now passes). 2011-04-13 11:25:11 -07:00
Marijn Haverbeke
1af3174fe3 Move to single-uint file-position representation.
This makes passing them around cheaper. There is now a table (see
front/codemap.rs) that is needed to transform such an uint into an
actual filename/line/col location.

Also cleans up the span building in the parser a bit.
2011-04-09 01:05:18 +02: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
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
Marijn Haverbeke
6a75740e96 handle unterminated block comments and line comment at eof 2011-03-31 14:41:40 +00:00
Marijn Haverbeke
e7e6f396d8 Preserve comments when pretty-printing.
The patch also includes a number of smaller fixes to the
pretty-printer that were encountered on the way.
2011-03-31 14:41:39 +00:00
Lindsey Kuper
55fbed3d8d Beginnings of support for magical self prefix; nothing profound happening yet. 2011-03-29 15:59:15 -07:00
Marijn Haverbeke
6ecdc04788 Add support for break and cont to rustc
Testing proper cleanup is hampered by
https://github.com/graydon/rust/issues/293
2011-03-27 14:11:23 +02:00
Graydon Hoare
b2427509e2 Another go at changing compile-command, this time using RBUILD env var. 2011-03-25 15:07:27 -07:00
Graydon Hoare
91c2b82b09 Revert "Bulk-edit compile commands in emacs chatter to point to assumed build/ dir off src root."
This reverts commit 846f2e2ba9.
2011-03-25 14:05:38 -07:00
Graydon Hoare
846f2e2ba9 Bulk-edit compile commands in emacs chatter to point to assumed build/ dir off src root. 2011-03-25 13:48:37 -07:00
Tim Chevalier
a47cd50dfb Parse FP literals without coercing to int. This allows parsing 64-bit
floats. However, if someone writes a literal that can't be represented
precisely in 64 bits, the front-end will accept it while the back-end
will (presumably) complain.
2011-03-25 11:20:30 -07:00
Marijn Haverbeke
d4c3059e1e make lexer unicode-aware for strings and char literals 2011-03-25 08:23:00 -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
Tim Chevalier
23e23bd762 Further support for floating-point. Literals with exponents work
and literals with the 'f32' or 'f64' suffixes work as well. In
addition, logging things with the f32 or f64 type works. (float is
still assumed to be a synonym for f64).
2011-03-22 17:31:27 -07:00
Tim Chevalier
caa22c9341 Started adding support for floating-point type, floating-point literals, and logging of floats. Other operations on float probably don't work yet. 2011-03-21 18:10:34 -07:00
Graydon Hoare
54587bdccb Switch all vases of vec += elt to vec += vec. Prohibit former in rustboot. Tweak std lib vec fns in process. 2011-03-16 14:58:02 -07:00
Marijn Haverbeke
441697ab35 Extend stream functionality
Writer and reader streams now come with methods to write and read
little-endian numbers. Whether that is the right place for such
methods is debatable, but for now, that's where they live.
2011-03-14 14:57:13 -07:00
Graydon Hoare
d97c800e31 Make ret and fail stmts have 0 out-edges, Closes #250. 2011-03-05 20:05:02 +00:00
Brian Anderson
eac75b7648 Teach rustc about reserved keywords 2011-02-22 21:52:23 -05:00
Brian Anderson
c4df39609c Rename std._io to std.io since 'io' is no longer a keyword 2011-02-22 21:52:23 -05:00