about summary refs log tree commit diff
path: root/src/comp/front/parser.rs
AgeCommit message (Collapse)AuthorLines
2011-07-05Move everything syntax-related to syntax/, break deps on rest of compilerMarijn Haverbeke-2465/+0
src/comp/syntax is currently just a sub-module of rustc, but it will, in the near future, be its own crate. This includes: - The AST data structure - The parser - The pretty-printer - Visit, walk, and fold - The syntax extension system - Some utility stuff that should be in the stdlib* *) Stdlib extensions currently require a snapshot before they can be used, and the win build is very broken right now. This is temporary and will be cleaned up when one of those problems goes away. A lot of code was moved by this patch, mostly towards a more organized layout. Some package paths did get longer, and I guess the new layout will take some getting used to. Sorry about that! Please try not to re-introduce any dependencies in syntax/ on any of the other src/comp/ subdirs.
2011-07-04Move the ids of pat AST nodes into their structMarijn Haverbeke-6/+5
Just like it was done with items and exprs. Simplifies some code.
2011-07-03Handle fail as an argument; parse fail expressions unambiguouslyTim Chevalier-9/+8
An expression like: foo(1, fail, 2) was failing to parse, because the parser was interpreting the comma as the start of an expression that was an argument to fail, rather than recognizing that the fail here has no arguments Fixed this by using can_begin_expr to determine whether the next token after a fail token suggests that this is a nullary fail or a unary fail. In addition, when translating calls, check before translating each argument that the block still isn't terminated. This has the effect that if an argument list includes fail, the back-end won't keep trying to generate code for successive arguments and trip the !*terminated assertion.
2011-07-02Fix assertion failure when syntax extension name is missing.Josh Matthews-0/+3
2011-07-02Allow any string expression to be used with fail.Josh Matthews-4/+7
2011-07-01Remove the concept of crate directive let statements. Issue #604Brian Anderson-11/+0
2011-07-01Remove the concept of crate directive expressions. Issue #604Brian Anderson-3/+1
2011-07-01Remove the environment concept from front::evalBrian Anderson-18/+5
This is the old method of conditional compilation. It is going away. Issue #489
2011-07-01Allow 'newtype' syntax for tagsMarijn Haverbeke-1/+16
Doing this: tag foo = mytype; is now equivalent to doing this: tag foo { foo(mytype); }
2011-06-30Kill unused variablesTim Chevalier-12/+3
2011-06-30Convert the eval::env to an ast::crate_cfgBrian Anderson-4/+19
crate_cfg will replace eval::env as the mechanism for conditional compilation. This is a transitional step so they can both exist together. Issue #489
2011-06-30Introduce a config property to the crate AST nodeBrian Anderson-2/+4
This represents the compilation environment, defined as AST meta_items, Used for driving conditional compilation and will eventually replace the environment used by the parser for the current conditional compilation scheme. Issue #489
2011-06-29Eliminate the --check-claims compiler flagTim Chevalier-6/+1
The option can only be toggled at runtime now.
2011-06-28Support attaching attributes to modules via the crate file. Issue #487Brian Anderson-27/+44
2011-06-28Implement "claim"Tim Chevalier-2/+15
Implement "claim" (issue #14), which is a version of "check" that doesn't really do the check at runtime. It's an unsafe feature. The new flag --check-claims turns claims into checks automatically -- but it's off by default, so by default, the assertion in a claim doesn't execute at runtime.
2011-06-28Teach the parser and typechecker to understand port[int](). Closes #588Eric Holk-2/+8
2011-06-28Write metadata for more meta_item types. Issue #487Brian Anderson-1/+1
2011-06-28Use 'resource' rather than 'res' as a keywordMarijn Haverbeke-2/+2
Resources are now defined like... resource fd(int n) { close(n); } Calling fd with an int will then produce a non-copyable value that, when dropped, will call close on the given int.
2011-06-28Add simple syntax extension (#simplext)Paul Stansifer-1/+10
2011-06-28Use "" in the native_name as an indication that no extra options have toRafael Ávila de Espíndola-1/+1
be passed to the "linker". Use that for libc.
2011-06-27Record and link with used native libraries.Rafael Ávila de Espíndola-15/+3
2011-06-25Partial implementation of resourcesMarijn Haverbeke-3/+25
Non-copyability is not enforced yet, and something is still flaky with dropping of the internal value, so don't actually use them yet. I'm merging this in so that I don't have to keep merging against new patches.
2011-06-24Fix inexhaustive match in parserTim Chevalier-0/+7
2011-06-24Remove uses of variable name 'res' from rustcMarijn Haverbeke-7/+7
This in preparation of making 'res' a keyword for defining resources. Please don't introduce too many new ones in the meantime...
2011-06-23rustc: Pretty-print ternary operatorBrian Anderson-0/+2
2011-06-23rustc: Add ternary operator. Closes #565Brian Anderson-1/+15
The implementation is so simple it might be considered cheating: at almost every step the expr_ternary is just converted to expr_if.
2011-06-23Remove parse_str_lit_or_env_ident.Rafael Ávila de Espíndola-29/+13
We decided to use metadata for the more complex cases, and a simple string is enough for rustc right now.
2011-06-22rustc: Handle valueless ret expressions as block results. Closes #521Brian Anderson-0/+2
2011-06-22rustc: Introduce and parse additional meta_item formsBrian Anderson-8/+23
Examples: #[test], #[link(name = "vers")] Issue #487
2011-06-22rustc: Rename parser.err to parser.fatalBrian Anderson-29/+29
2011-06-23Remove a simidgeon of dead code.Paul Stansifer-8/+1
2011-06-21Move names and ids of native items into their recs, rather than their tagsMarijn Haverbeke-5/+8
2011-06-21Puts out burning tinderbox (oops, AST nodes don't have def_ids/anns).Lindsey Kuper-2/+1
2011-06-21Some progress on support for extending objects with new fields (issueLindsey Kuper-5/+13
into four separate issues (#538, #539, #540, #543) with corresponding tests.
2011-06-21Move expr ids into the expr record typeMarijn Haverbeke-127/+115
This simplifies the tag variants a bit and makes expr_node_id obsolete.
2011-06-20Get rid of def_ids and anns in AST nodes, use single node_idMarijn Haverbeke-110/+98
This reduces some redundancy in the AST data structures and cruft in the code that works with them. To get a def_id from a node_id, apply ast::local_def, which adds the local crate_num to the given node_id. Most code only deals with crate-local node_ids, and won't have to create def_ids at all.
2011-06-19Remove various rustboot workaroundsBrian Anderson-7/+3
2011-06-19rustc: Rename session.span_err -> span_fatal, err -> fatalBrian Anderson-2/+2
Issue #440
2011-06-19Revert previous 6 commits. Hopefully put out Windows fire.Brian Anderson-2/+2
Revert "rustc: Export only what's needed from middle::ty" This reverts commit 4255d58aa5db2a05362c4435a0e807205e1b8ed7. Revert "rustc: Make name resolution errors less fatal" This reverts commit b8ab9ea89c16c60237e7660804f4321f59ae0435. Revert "rustc: Make import resolution errors less fatal" This reverts commit 92a8ae94b971206bf0502da3dc5f416fcb24cc36. Revert "rustc: Export only what's used from middle::resolve" This reverts commit 4539a2cf7ad99851a165c98ed2f4e4a475cffd7d. Revert "rustc: Re-introduce session.span_err, session.err" This reverts commit 7fe9a88e31ae07f2fd89f6715efedd7e3edf49e6. Revert "rustc: Rename session.span_err -> span_fatal, err -> fatal" This reverts commit c394a7f49ac29a099994e243017065de2ff97f2a.
2011-06-19rustc: Rename session.span_err -> span_fatal, err -> fatalBrian Anderson-2/+2
Issue #440
2011-06-18rustc: Store the lhs and rhs of receive exprs in left to right orderBrian Anderson-1/+1
With the changing of receive semantics the parser has been putting the rhs expression in the first argument of expr_recv and the lhs in the second, and all subsequent passes have been referring to them backwords (but still doing the right thing because they were assuming that lhs was the port and rhs was the receiver). This makes all code agree on what lhs and rhs mean for receive expressions.
2011-06-18rustc: Remove the meta keywordBrian Anderson-7/+0
Issue #487
2011-06-16Consistify ast::local.Paul Stansifer-14/+18
2011-06-16Add better error messages for bad attributes in .rc filesBrian Anderson-1/+2
Issue #487
2011-06-16rustc: Fix regressed handling of bad attributesBrian Anderson-1/+6
Issue #487
2011-06-16rustc: Change print_file to print_crateBrian Anderson-5/+7
The pretty-printer needs access to the crate attributes in order to reproduce inner crate attributes in standalone .rs files Issue #487
2011-06-16rustc: Parse crate attributes in standalone .rs filesBrian Anderson-1/+5
Issue #487
2011-06-16rustc: Parse attributes in crate filesBrian Anderson-3/+13
Issue #487
2011-06-16rustc: Parse T[mutable?]Patrick Walton-1/+6
2011-06-16rustc: Correctly mark attributes as inner attributesBrian Anderson-8/+14
Issue #487