diff options
| author | Lindsey Kuper <lindsey@rockstargirl.org> | 2012-06-12 10:17:36 -0700 |
|---|---|---|
| committer | Lindsey Kuper <lindsey@rockstargirl.org> | 2012-06-12 11:18:31 -0700 |
| commit | bffb7db8aec094f6adbf7c68a7c02e8b1332a704 (patch) | |
| tree | d5762fb0cc2f1a4c296f4b2942df15fc02641ca4 /src/libsyntax/parse/common.rs | |
| parent | d04ed0c4931f36f15e18f46b233d13572f4c9107 (diff) | |
| download | rust-bffb7db8aec094f6adbf7c68a7c02e8b1332a704.tar.gz rust-bffb7db8aec094f6adbf7c68a7c02e8b1332a704.zip | |
syntax: clarify that trailing separators are never required
Diffstat (limited to 'src/libsyntax/parse/common.rs')
| -rw-r--r-- | src/libsyntax/parse/common.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 0c2718c3b4b..0520993de74 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -4,25 +4,23 @@ import parser::parser; type seq_sep = { sep: option<token::token>, - trailing_opt: bool // is trailing separator optional? + trailing_sep_allowed: bool }; -fn seq_sep(t: token::token) -> seq_sep { - ret {sep: option::some(t), trailing_opt: false}; +fn seq_sep_trailing_disallowed(t: token::token) -> seq_sep { + ret {sep: option::some(t), trailing_sep_allowed: false}; } -fn seq_sep_opt(t: token::token) -> seq_sep { - ret {sep: option::some(t), trailing_opt: true}; +fn seq_sep_trailing_allowed(t: token::token) -> seq_sep { + ret {sep: option::some(t), trailing_sep_allowed: true}; } fn seq_sep_none() -> seq_sep { - ret {sep: option::none, trailing_opt: false}; + ret {sep: option::none, trailing_sep_allowed: false}; } - fn token_to_str(reader: reader, ++token: token::token) -> str { token::to_str(*reader.interner, token) } - // This should be done with traits, once traits work impl parser_common for parser { @@ -203,7 +201,7 @@ impl parser_common for parser { else { self.expect(t); } } _ { } } - if sep.trailing_opt && self.token == ket { break; } + if sep.trailing_sep_allowed && self.token == ket { break; } v += [f(self)]; } ret v; |
