about summary refs log tree commit diff
path: root/src/comp/pretty
AgeCommit message (Collapse)AuthorLines
2011-05-31Add span to field to catch per-field comments in rec exprs.Graydon Hoare-5/+7
2011-05-31Improve comment handling in pp.Graydon Hoare-147/+170
2011-05-31Differentiate consistency of commasep boxesGraydon Hoare-27/+35
2011-05-31new pretty printerGraydon Hoare-398/+729
2011-05-27Change the syntax for RECV from "var <- port" to "port |> var".Michael Sullivan-3/+3
2011-05-26Fix typoTim Chevalier-1/+1
2011-05-25Pretty print view items with :: rather than :.Graydon Hoare-1/+1
2011-05-23Get test-pass/utf8.rs to runMarijn Haverbeke-1/+2
This involved a small fix to the unicode-escape character lexing and to the pretty-printer.
2011-05-20More work on anonymous objects.Lindsey Kuper-2/+2
2011-05-20Make controlflow part of a function typeTim Chevalier-5/+14
Change ty_fn to have a controlflow field. A 'controlflow' is essentially a bit of data that says whether or not this function never returns to the caller (if it never returns, that means it calls "fail" or another "never-returns" function on every control path). Also add syntax for annotating functions that never return: fn foo() -> ! { fail; } for example. Functions marked with ! implicitly have a result type of ty_bot, which is a new type that this commit also adds.
2011-05-19Move type cache and node type table into type context.Graydon Hoare-6/+7
2011-05-17rustc: Print the types of declarations in --typed-pretty modePatrick Walton-0/+9
2011-05-17rustc: Add a typed pretty-printing mode for debuggingPatrick Walton-6/+36
2011-05-17Finally rename std::_xxx to std::xxxMarijn Haverbeke-31/+31
Except for _task, which is still a keyword.
2011-05-17Switch pretty printer to new vec syntaxMarijn Haverbeke-3/+4
2011-05-16Merge remote branch 'origin/master' into HEADGraydon Hoare-0/+1
Conflicts: src/comp/middle/trans.rs
2011-05-16Rewrite everything to use [] instead of vec() in value position.Graydon Hoare-8/+8
2011-05-16make the return-checker happy about pretty::pp::base_indentTim Chevalier-0/+1
2011-05-13More work toward anonymous objects.Lindsey Kuper-0/+5
2011-05-13Make the parser more careful about keywordsMarijn Haverbeke-3/+2
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-12Downcase std modules again, move to :: for module dereferencingMarijn Haverbeke-271/+273
This should be a snapshot transition.
2011-05-12Change module dereference syntax from . to ::Marijn Haverbeke-2/+2
This will need to be a snapshot.
2011-05-12Keep resolve data in external hash table, rather than embedded defsMarijn Haverbeke-2/+2
One step closer to removing fold and having a single, immutable AST. Resolve still uses fold, because it has to detect and transform expr_field expressions. If we go through on our plan of moving to a different syntax for module dereferencing, the parser can spit out expr_field expressions, and resolve can move to walk. (I am truly sorry for the things I did in typestate_check.rs. I expect we'll want to change that to walk as well in the near future, at which point it should probably pass around a context record, which could hold the def_map.)
2011-05-11Give the lexer a session so that it can fail more informativelyBrian Anderson-2/+3
2011-05-11Rewrite comp/middle/resolve.rsMarijn Haverbeke-1/+1
* Cleans up the algorithm * Move first pass to walk (second still folds) * Support part of a type/value namespace split (crate metadata and module indices still need to be taught about this) * Remove a few blatant inefficiencies (import tables being recreated for every lookup, most importantly)
2011-05-09rustc: Alias fix part 1 -- Separate out AST modes from typechecker modes, ↵Patrick Walton-1/+1
and introduce an "either value or alias" mode
2011-05-06Rename std modules to be camelcasedMarijn Haverbeke-71/+71
(Have fun mergining your stuff with this.)
2011-05-05Consolidating expr_to_str functions.Lindsey Kuper-9/+0
2011-05-05Bring back "pred" syntax for writing predicates for checkTim Chevalier-1/+8
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-03rustc: Stub support for Rust intrinsicsPatrick Walton-0/+3
2011-05-03Revert "Rename the "llvm" API to "llvm-intrinsic"" due to tinderbox bustagePatrick Walton-1/+0
This reverts commit 6871c245a67fab222eccc2a21dcb620d11d3b0d0.
2011-05-03Rename the "llvm" API to "llvm-intrinsic"Patrick Walton-0/+1
2011-05-02Un-revert "Use different syntax for checks that matter to typestate", fixing ↵Patrick Walton-1/+7
the problem. This reverts commit d08b443fffb1181d8d45ae5d061412f202dd4118.
2011-05-02Revert "Use different syntax for checks that matter to typestate"Graydon Hoare-7/+1
This reverts commit aa25f22f197682de3b18fc4c8ba068d1feda220f. It broke stage2, not sure why yet.
2011-05-02Use different syntax for checks that matter to typestateTim Chevalier-1/+7
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-04-19Handle nested items correctly in typestate_checkTim Chevalier-0/+17
Summary says it all. Actually, only nested objects and functions are handled, but that's better than before. The fold that I was using before to traverse a crate wasn't working correctly, because annotations have to reflect the number of local variables of the nearest enclosing function (in turn, because annotations are represented as bit vectors). The fold was traversing the AST in the wrong order, first filling in the annotations correctly, but then re-traversing them with the bit vector length for any outer nested functions, and so on. Remedying this required writing a lot of tedious boilerplate code because I scrapped the idea of using a fold altogether. I also made typestate_check handle unary, field, alt, and fail. Also, some miscellaneous changes: * added annotations to blocks in typeck * fix pprust so it can handle spawn * added more logging functions in util.common * fixed _vec.or * added maybe and from_maybe in option * removed fold_block field from ast_fold, since it was never used
2011-04-19Remove effect system from src.Graydon Hoare-80/+70
2011-04-19add log_err to rustcMarijn Haverbeke-2/+5
2011-04-14Work on destructors, not entirely functional yet (no tydesc integration).Graydon Hoare-2/+2
2011-04-14rustc: Remove generalize_ty. Instead, maintain an explicit type parameter ↵Patrick Walton-0/+9
substitution list.
2011-04-12rustc: Switch to indices for type parametersPatrick Walton-1/+1
2011-04-12rustc: Add "float" as a type to the pretty printerPatrick Walton-0/+1
2011-04-09Move to single-uint file-position representation.Marijn Haverbeke-15/+4
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-07Support for self-calls that take arguments.Lindsey Kuper-4/+1
Nicer parsing of self-calls (expr_self_method nodes inside expr_call nodes, rather than a separate expr_call_self) makes typechecking tractable. We can now write self-calls that take arguments and return values (see: test/run-pass/obj-self-*.rs).
2011-04-06Continued sketching out code for checking states against preconditions.Tim Chevalier-2/+2
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-05Further on the path toward self-awareness.Lindsey Kuper-2/+6
Mostly: * Merciless refactoring of trans.rs so that trans_call can work for self-calls as well as other kinds of calls Also: * Various changes to go with having idents, rather than exprs, in expr_call_self AST nodes * Added missing case for SELF token to token.to_str()
2011-04-05Oops -- if we're going to use the pretty-printer, we need it to work.Lindsey Kuper-0/+5
2011-04-01Started adding support for typestate checking.Tim Chevalier-8/+8
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-03-31Add block_to_str and expr_to_str methods to the pprust module.Brian Anderson-0/+18
Since pprust is authed impure these can be used for debug logging.
2011-03-31rustc: Add a type annotation to tag itemsPatrick Walton-1/+1