diff options
| author | bors <bors@rust-lang.org> | 2013-08-21 20:21:32 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-21 20:21:32 -0700 |
| commit | 8e776c75e9694c2e1711943652c64a5e076afa8f (patch) | |
| tree | 8ea396f883ba818f1db86ef523803aeac2e1568c /src/libsyntax/parse/parser.rs | |
| parent | 3ddfb725127a49e03593c0c56542f12826713bd6 (diff) | |
| parent | a9aa4ad2a017f5ed1655917fe8a6bb66591d7025 (diff) | |
| download | rust-8e776c75e9694c2e1711943652c64a5e076afa8f.tar.gz rust-8e776c75e9694c2e1711943652c64a5e076afa8f.zip | |
auto merge of #8570 : catamorphism/rust/2013-08-16-rollup, r=catamorphism
Nothing arguable here, as far as I can tell.
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") } } |
