76 Commits

Author SHA1 Message Date
Tim Chevalier
8e15640ada Refactor operator precedence code
Use functions instead of a dynamically created table to determine
operator precedence. Gets rid of a FIXME in syntax::parse::prec.
Change precedences from int to uint while we're at it, since
don't use negative precedences.
2012-04-26 16:16:18 -07:00
Niko Matsakis
825fd1808e lots of work to make iface/impls parameterized by regions
- paths can now take region parameters, replacing the dirty hack
  I was doing before of abusing vstores.  vstores are now a bit
  of a hack though.

- fix various small bugs:
  - we never checked that iface types were compatible when casting
    to an iface with `as`
  - we allowed nonsense like int<int>
  - and more! (actually that may be it)
2012-04-25 19:26:56 -07:00
Marijn Haverbeke
9f99c3263b Rewrite exhaustiveness checker
Issue #2111
2012-04-25 09:15:17 +02:00
Brian Anderson
c9e3f387f4 syntax: Divide keywords into contextual/restricted. No bad words 2012-04-24 22:58:00 -07:00
Brian Anderson
08d0707556 syntax: Make 'true' and 'false' bad words
When these are idents they are always shadowed by the boolean
constants.
2012-04-24 22:00:32 -07:00
Brian Anderson
98ac8d4625 syntax: Clean up the bad_expr_word functions 2012-04-24 21:12:16 -07:00
Brian Anderson
7ee90cc7be syntax: Rename is_word to is_keyword, etc. 2012-04-24 21:08:49 -07:00
Tim Chevalier
f7641286b2 Allow classes to be cast to ifaces that are in the same crate
I had to xfail one existing test case (class-implements-int) because,
I think, of the same bug described in #2272.
2012-04-23 21:15:03 -07:00
Tim Chevalier
1c39fda0ea Rename option::get_or_default to get_default, for consistency 2012-04-23 20:52:50 -07:00
Marijn Haverbeke
9053f54498 Move map iface over to more for-friendly iteration methods 2012-04-23 15:18:19 +02:00
Marijn Haverbeke
a872a99bfe Simplify representation of ast::path 2012-04-23 13:04:46 +02:00
Marijn Haverbeke
a61f107684 pretty printer: Properly print explicity types for block params 2012-04-23 10:27:09 +02:00
Brian Anderson
512927573e syntax: Replace token::DOLLAR_PAREN, DOLLAR_NUM with just DOLLAR
Figure the rest out in the parser
2012-04-22 17:24:49 -07:00
Brian Anderson
7321c17171 syntax: Eliminate token::POUND_LT, POUND_LBRACE
Use lookahead in the parser
2012-04-22 15:19:14 -07:00
Brian Anderson
92b2113583 syntax: Move is_lit to mod token 2012-04-22 14:59:04 -07:00
Brian Anderson
fa86b5d67f syntax: Remove unused BRACEQUOTE, IDX, LIT_BOOL tokens 2012-04-22 14:58:10 -07:00
Brian Anderson
7235f3cee2 syntax: Eliminate 'mutable' keyword. Closes #2254 2012-04-21 14:27:20 -07:00
Tim Chevalier
37b0549730 Add new syntax for patterns that match the head constructor only
Adds a new kind of pattern C(*) where C is a constructor that may
have any number of fields. This pattern matches any value
constructed with C, without binding names for any of the fields.

Closes #1701.
2012-04-20 00:56:46 -07:00
Brian Anderson
087b12ac29 syntax: Reorganize mod parse 2012-04-19 21:58:45 -07:00
Brian Anderson
7fa7e56341 syntax: Move fn spanned into ast_util 2012-04-19 21:58:45 -07:00
Brian Anderson
bcbcbad774 syntax: Extract some functions into mod common 2012-04-19 21:58:45 -07:00
Brian Anderson
628e80d525 syntax: Extract attribute parsing to its own mod 2012-04-19 21:58:45 -07:00
Niko Matsakis
3d6c79109e update syntax to include a slash 2012-04-19 21:01:11 -07:00
Niko Matsakis
3c995fb8f3 make nominal types optionally parameterized by a self region.
Issue #2201.
2012-04-19 21:01:11 -07:00
Tim Chevalier
31ff64c62d Annotate FIXMEs in parser
Also, get rid of two FIXMEs by refactoring some code, and moving the
call_expr check for be expressions into typeck, where it seems to
make more sense.
2012-04-19 19:17:59 -07:00
Brian Anderson
b9ae0c555b syntax: Funnel all words through a single keyword table 2012-04-19 16:59:28 -07:00
Tim Chevalier
b0074c5a92 Disallow rebinding / matching against consts in alts
As per Issue #1193. Closes #1193.

I had to rename a few variables ("info" and "epsilon") to avoid
clashing with in-scope constants, which is responsible for all the
changes other than resolve and issue-1193.rs.
2012-04-19 16:21:15 -07:00
Tim Chevalier
cd2effe022 Annotate FIXMEs (comments only) 2012-04-19 15:30:59 -07:00
Tim Chevalier
37ea010b0d Move some functions from pprust to classify
As per a FIXME in syntax::parse::classify, move predicates on exprs
and stmts into classify, out of pprust
2012-04-19 15:30:58 -07:00
Tim Chevalier
1da18c70ac Clean up FIXMEs in syntax::fold
Eta-reduce a function, fold over ty constrs, and annotate a FIXME.
2012-04-19 15:30:58 -07:00
Tim Chevalier
030404c793 Cleanup FIXMEs in syntax::ext::qquote
Inline some one-off functions, add an error message, annotate a FIXME
2012-04-19 15:30:58 -07:00
Tim Chevalier
e6b5b4827b Removed a FIXME from librustcsyntax/ext/build.rs
I removed a FIXME about cleaning up function names because I
couldn't tell what needed cleaning up. If you know, please add a
FIXME and a corresponding issue tracker issue that explains the
problem!
2012-04-19 15:30:58 -07:00
Tim Chevalier
df28ab1bd1 Comments only: annotate FIXMEs in lexer 2012-04-19 15:24:49 -07:00
Graydon Hoare
956bc773c6 Fix [] on str to exclude the trailing null. 2012-04-18 17:50:58 -07:00
Brian Anderson
9a8a04629e syntax: Put the main parser interface in mod parse 2012-04-18 10:50:50 -07:00
Brian Anderson
2c0cb901c8 syntax: Begin moving functions from mod parser to mod classify 2012-04-18 10:50:50 -07:00
Brian Anderson
d51973a6a6 syntax: Move some functions from parser to token 2012-04-18 10:50:50 -07:00
Brian Anderson
476d5a099d syntax: Extract prec mod from parser mod 2012-04-18 10:50:50 -07:00
Brian Anderson
321ccc123d syntax: Add explicit exports in parser mods 2012-04-17 20:10:58 -07:00
Brian Anderson
fac7fcc123 syntax: Remove extra 'mut' from bad word table 2012-04-17 14:22:47 -07:00
Niko Matsakis
35a93e61d4 rewrite region resolution so it takes place in typeck 2012-04-16 19:48:00 -07:00
Brian Anderson
b78ca38380 syntax: Remove unused lexer field 2012-04-15 05:13:10 -07:00
Brian Anderson
3df37c3c45 syntax: Cleanup in diagnostic 2012-04-15 04:40:05 -07:00
Brian Anderson
e88b17c3b2 syntax: Limit exports in codemap 2012-04-15 04:34:51 -07:00
Brian Anderson
34ba1850b9 syntax: Some minor lexer refactoring 2012-04-15 04:19:52 -07:00
Brian Anderson
4b4f064315 syntax: lexer doesn't need to store the src length 2012-04-15 04:02:25 -07:00
Brian Anderson
2319c2d1ba syntax: lexer doesn't need a codemap 2012-04-15 03:57:24 -07:00
Brian Anderson
aa8dc0175d syntax: Limit exports from lexer 2012-04-15 03:49:59 -07:00
Brian Anderson
0e87f9ed02 syntax: Eliminate token's dependency on lexer 2012-04-15 03:44:32 -07:00
Brian Anderson
932aa893fd syntax: Move comment-extraction code to its own module 2012-04-15 03:27:24 -07:00