about summary refs log tree commit diff
path: root/src/comp/syntax/parse
AgeCommit message (Collapse)AuthorLines
2012-02-01make boxes self-describing (fixes #1493)Niko Matsakis-0/+2
2012-02-01Remove support for native typesMarijn Haverbeke-15/+1
Issue #1673
2012-01-31Change option::t to optionTim Chevalier-15/+15
Now that core exports "option" as a synonym for option::t, search-and- replace option::t with option. The only place that still refers to option::t are the modules in libcore that use option, because fixing this requires a new snapshot (forthcoming).
2012-01-31Require alts to be exhaustiveTim Chevalier-12/+7
middle::check_alt does the work. Lots of changes to add default cases into alts that were previously inexhaustive.
2012-01-30rustc: Allow attributes on methods. Closes #1709Brian Anderson-3/+6
2012-01-30Remove ternary operatorPaul Woolcock-20/+1
`expr_ternary`, `ternary_to_if`, and all parses & lexer definitions have been removed.
2012-01-30Change all ternary ops to if/then/elsePaul Woolcock-20/+44
All the files below had at least one instance of the ternary operator present in the source. All have been changed to the equivalent if/then/else expression.
2012-01-30Revert self typesMarijn Haverbeke-3/+2
2012-01-27Merge remote-tracking branch 'killerswan/fixing_strings_2'Brian Anderson-1/+1
Conflicts: src/comp/driver/driver.rs src/comp/middle/trans/base.rs src/comp/syntax/parse/lexer.rs
2012-01-27Use the method name 'unary-' for overloading negationMarijn Haverbeke-1/+5
It's less likely to clash with something than 'neg'. Issue #1520
2012-01-26Use operator names for operator methodsMarijn Haverbeke-2/+11
The methods used to implement operators now simply use the name of the operator itself, except for unary -, which is called min to not clash with binary -. Index is called []. Closes #1520
2012-01-26Allow operator overloading of the indexing operatorMarijn Haverbeke-0/+1
The method `op_index` (which takes a single argument) is used for this. Issue #1520
2012-01-26First stab at operator overloadingMarijn Haverbeke-0/+4
When no built-in interpretation is found for one of the operators mentioned below, the typechecker will try to turn it into a method call with the name written next to it. For binary operators, the method will be called on the LHS with the RHS as only parameter. Binary: + op_add - op_sub * op_mul / op_div % op_rem & op_and | op_or ^ op_xor << op_shift_left >> op_shift_right >>> op_ashift_right Unary: - op_neg ! op_not Overloading of the indexing ([]) operator isn't finished yet. Issue #1520
2012-01-25rustc: Allow attributes on enum variants. Closes #1663Brian Anderson-1/+5
2012-01-25Correctly increment sess.byte_pos.Kevin Atkinson-6/+6
2012-01-25Keep source file around after parsing.Kevin Atkinson-19/+20
Specifically box the string (to avoid unnecessary copies) and store it in codemap::filemap. Remove the hack in driver::diagnostic that rereads the source from the file and instead just get the source from the filemap. (This commit is also a prerequisite for issue #1612)
2012-01-25Implement implicit self type parameters for ifacesMarijn Haverbeke-2/+3
Closes #1661
2012-01-25Rename tag to enum throughout the compilerMarijn Haverbeke-15/+15
This should reduce confusion of people trying to read the code.
2012-01-25Repair zero-variant tagsMarijn Haverbeke-51/+24
The parser no longer parsed them.
2012-01-25Replacing str::unsafe_from_bytes with str::from_bytes (part 4)Kevin Cantu-1/+1
2012-01-24rustc: Split diagnostics into "span diagnostics" and "diagnostics".Patrick Walton-16/+18
The former contain a codemap (which is per-crate), and the latter don't. This will be useful in order to allow more than one crate to be compiled in one run of the compiler.
2012-01-24comp: Fix syntax error in parserBrian Anderson-1/+1
2012-01-23Added to bad_expr_word_table reserved wordsJoshua Clark-2/+3
2012-01-23s/block()/fn()/gNiko Matsakis-14/+8
2012-01-23Don't reset the chpos/byte_pos to 0 in new_parser_from_source_str.Kevin Atkinson-20/+29
This correctly fixes issue #1362. chpos/byte_pos are now the offsets within a particular file, but rather the offsets within a virtual file with is formed by combing all of the modules within a crate. Thus, resetting them to 0 causes an overlap and hence, bogus source locations. Fix #1362 by moving chpos/byte_pos to parse_sess so that new_parser_from_source_str has access to them and hence can chose an initial value that is not already been used in the crate. Note that the trigger for bug 1361 was that syntax/ext/expand.rs calls parse_expr_from_source_str (which calls new_parser_from_source_str) using the same codemap as the current crate (and hence causing overlap with files in the crate as new_parser_from_source_str resets the chpos/byte_pos to 0).
2012-01-23Export all enum variants by default; new syntax for selectively exporting ↵Tim Chevalier-11/+12
variants See issue 1426 for details. Now, the semantics of "export t;" where t is a tag are to export all of t's variants as well. "export t{};" exports t but not its variants, while "export t{a, b, c};" exports only variants a, b, c of t. To do: - documentation - there's currently no checking that a, b, c are actually variants of t in the above example - there's also no checking that t is an enum type, in the second two examples above - change the modules listed in issue 1426 that should have the old export semantics to use the t{} syntax I deleted the test export-no-tag-variants since we're doing the opposite now, and other tests cover the same behavior.
2012-01-20WIP on issue 1426 (exporting all tags)Tim Chevalier-4/+28
Support Lenny222's proposed syntax for exporting a tag without its variants, or selected tags from a variant, in the AST and parser. No support further down the line yet. Tests are xfailed.
2012-01-19Additional ; to , changes, disable "tag" and ";" in parser. Close #1430. ↵Graydon Hoare-1/+1
Close #1428.
2012-01-19rustc: Stop parsing "tag"Patrick Walton-2/+2
2012-01-19rustc: ";" to "," in enumsPatrick Walton-64/+64
2012-01-19rustc: "tag" -> "enum"Patrick Walton-10/+10
2012-01-19Rename fn*() to fn() as originally planned.Niko Matsakis-7/+9
2012-01-19treat fn*() as fn&()Niko Matsakis-8/+2
This is not my ideal way of going about things. I'd prefer not to have expressions typed as fn*(), for example, but I couldn't get that to work together with inferring the modes of arguments and other corner cases.
2012-01-19Remove support for the '.' after a nullary tag in a patternTim Chevalier-4/+0
(Commit also includes lots of changes to remove '.'s that a git merge messed up, or else it was monkeys.)
2012-01-18Remove '.' after nullary tags in patternsTim Chevalier-123/+123
Does what it says on the tin. The next commit will remove support for this syntax.
2012-01-18Allow any alternative (not just a block) to follow a nullary tag patternTim Chevalier-3/+1
2012-01-18allow dotless nullary patterns inside or-patternsTim Chevalier-1/+2
2012-01-18Another minor parser fix for nullary-tag patternsTim Chevalier-1/+1
2012-01-18Allow nullary tag names to be qualifiedTim Chevalier-3/+2
2012-01-18rustc: Assert that the parser doesn't assign node id 0Brian Anderson-0/+2
It is reserved for indicating the crate, but doesn't exist in the AST
2012-01-18rustc: Accept commas to separate tag variantsPatrick Walton-3/+12
2012-01-17Allow omission of the '.' after nullary tag patternsTim Chevalier-6/+23
This commit allows patterns like: alt x { some(_) { ... } none { } } without the '.' after none. The parser suspends judgment about whether a bare ident is a tag or a new bound variable; instead, the resolver disambiguates. This means that any code after resolution that pattern-matches on patterns needs to call pat_util::normalize_pat, which consults an environment to do this disambiguation. In addition, local variables are no longer allowed to shadow tag names, so this required changing some code (e.g. renaming variables named "mut", and renaming ast::sub to subtract). The parser currently accepts patterns with and without the '.'. Once the compiler and libraries are changed, it will no longer accept the '.'.
2012-01-16Don't evaluate discriminator value constants when parsing.Kevin Atkinson-27/+2
Remove disr_val from ast::variant_ and always use ty::variant_info when the value is needed. Move what was done during parsing into other passes, primary typeck.rs. This move also correctly type checks the disr. value expression; thus, fixing rustc --pretty=typed when disr. values are used.
2012-01-15rustc: Parse fn inner attributes. Closes #1506Brian Anderson-29/+96
2012-01-15rustc: Extract comman parts of view parsingBrian Anderson-7/+13
2012-01-13rustc: Rename the lexer's err message to fatal and make it failBrian Anderson-17/+12
2012-01-13rustc: Replace the lexer's error handling with diagnostic implBrian Anderson-8/+18
2012-01-13rustc: Replace parser's error handling with diagnostic implBrian Anderson-9/+10
2012-01-13rustc: Extract driver::diagnostic from syntax::codemapBrian Anderson-5/+7
2012-01-13rustc: Refactor codemap::emit_* functionsBrian Anderson-7/+6
A codemap is only needed when we have a span so put them both into the option.