diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-07-12 14:43:57 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-08-21 17:17:41 -0700 |
| commit | 5da4b4d928c6507f6e67b2d2a4289eef4b8de0ea (patch) | |
| tree | 36503ae5a3f77bc69cd23dc331f3639994d496bd /src/libsyntax/parse/parser.rs | |
| parent | 77279a73cbafb1735e5cf53820fde65d5cd05957 (diff) | |
| download | rust-5da4b4d928c6507f6e67b2d2a4289eef4b8de0ea.tar.gz rust-5da4b4d928c6507f6e67b2d2a4289eef4b8de0ea.zip | |
std/extra: changing XXX to FIXME; cleanup
* Get rid of by-value-self workarounds; it works now * Remove type annotations, they're not needed anymore
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2b977153b03..135f7162157 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5061,12 +5061,19 @@ impl Parser { } } - pub fn parse_str(&self) -> @str { + pub fn parse_optional_str(&self) -> Option<@str> { match *self.token { token::LIT_STR(s) => { self.bump(); - ident_to_str(&s) + Some(ident_to_str(&s)) } + _ => None + } + } + + pub fn parse_str(&self) -> @str { + match self.parse_optional_str() { + Some(s) => { s } _ => self.fatal("expected string literal") } } |
