@@ -137,27 +137,27 @@ pub impl Parser {
137137
138138 // A sanity check that the word we are asking for is a known keyword
139139 // NOTE: this could be done statically....
140- fn require_keyword ( & self , word : & ~ str ) {
141- if !self . keywords . contains ( word) {
142- self . bug ( fmt ! ( "unknown keyword: %s" , * word) ) ;
140+ fn require_keyword ( & self , word : & str ) {
141+ if !self . keywords . contains_equiv ( & word) {
142+ self . bug ( fmt ! ( "unknown keyword: %s" , word) ) ;
143143 }
144144 }
145145
146146 // return true when this token represents the given string, and is not
147147 // followed immediately by :: .
148- fn token_is_word ( & self , word : & ~ str , tok : & token:: Token ) -> bool {
148+ fn token_is_word ( & self , word : & str , tok : & token:: Token ) -> bool {
149149 match * tok {
150- token:: IDENT ( sid, false ) => { * self . id_to_str ( sid) == * word }
150+ token:: IDENT ( sid, false ) => { word == * self . id_to_str ( sid) }
151151 _ => { false }
152152 }
153153 }
154154
155- fn token_is_keyword ( & self , word : & ~ str , tok : & token:: Token ) -> bool {
155+ fn token_is_keyword ( & self , word : & str , tok : & token:: Token ) -> bool {
156156 self . require_keyword ( word) ;
157157 self . token_is_word ( word, tok)
158158 }
159159
160- fn is_keyword ( & self , word : & ~ str ) -> bool {
160+ fn is_keyword ( & self , word : & str ) -> bool {
161161 self . token_is_keyword ( word, & copy * self . token )
162162 }
163163
@@ -177,10 +177,10 @@ pub impl Parser {
177177 // if the given word is not a keyword, signal an error.
178178 // if the next token is the given keyword, eat it and return
179179 // true. Otherwise, return false.
180- fn eat_keyword ( & self , word : & ~ str ) -> bool {
180+ fn eat_keyword ( & self , word : & str ) -> bool {
181181 self . require_keyword ( word) ;
182182 let is_kw = match * self . token {
183- token:: IDENT ( sid, false ) => * word == * self . id_to_str ( sid) ,
183+ token:: IDENT ( sid, false ) => word == * self . id_to_str ( sid) ,
184184 _ => false
185185 } ;
186186 if is_kw { self . bump ( ) }
@@ -190,63 +190,63 @@ pub impl Parser {
190190 // if the given word is not a keyword, signal an error.
191191 // if the next token is not the given word, signal an error.
192192 // otherwise, eat it.
193- fn expect_keyword ( & self , word : & ~ str ) {
193+ fn expect_keyword ( & self , word : & str ) {
194194 self . require_keyword ( word) ;
195195 if !self . eat_keyword ( word) {
196196 self . fatal (
197197 fmt ! (
198198 "expected `%s`, found `%s`" ,
199- * word,
199+ word,
200200 self . this_token_to_str( )
201201 )
202202 ) ;
203203 }
204204 }
205205
206206 // return true if the given string is a strict keyword
207- fn is_strict_keyword ( & self , word : & ~ str ) -> bool {
208- self . strict_keywords . contains ( word)
207+ fn is_strict_keyword ( & self , word : & str ) -> bool {
208+ self . strict_keywords . contains_equiv ( & word)
209209 }
210210
211211 // signal an error if the current token is a strict keyword
212212 fn check_strict_keywords ( & self ) {
213213 match * self . token {
214214 token:: IDENT ( _, false ) => {
215215 let w = token_to_str ( self . reader , & copy * self . token ) ;
216- self . check_strict_keywords_ ( & w) ;
216+ self . check_strict_keywords_ ( w) ;
217217 }
218218 _ => ( )
219219 }
220220 }
221221
222222 // signal an error if the given string is a strict keyword
223- fn check_strict_keywords_ ( & self , w : & ~ str ) {
223+ fn check_strict_keywords_ ( & self , w : & str ) {
224224 if self . is_strict_keyword ( w) {
225225 self . span_err ( * self . last_span ,
226- fmt ! ( "found `%s` in ident position" , * w) ) ;
226+ fmt ! ( "found `%s` in ident position" , w) ) ;
227227 }
228228 }
229229
230230 // return true if this is a reserved keyword
231- fn is_reserved_keyword ( & self , word : & ~ str ) -> bool {
232- self . reserved_keywords . contains ( word)
231+ fn is_reserved_keyword ( & self , word : & str ) -> bool {
232+ self . reserved_keywords . contains_equiv ( & word)
233233 }
234234
235235 // signal an error if the current token is a reserved keyword
236236 fn check_reserved_keywords ( & self ) {
237237 match * self . token {
238238 token:: IDENT ( _, false ) => {
239239 let w = token_to_str ( self . reader , & copy * self . token ) ;
240- self . check_reserved_keywords_ ( & w) ;
240+ self . check_reserved_keywords_ ( w) ;
241241 }
242242 _ => ( )
243243 }
244244 }
245245
246246 // signal an error if the given string is a reserved keyword
247- fn check_reserved_keywords_ ( & self , w : & ~ str ) {
247+ fn check_reserved_keywords_ ( & self , w : & str ) {
248248 if self . is_reserved_keyword ( w) {
249- self . fatal ( fmt ! ( "`%s` is a reserved keyword" , * w) ) ;
249+ self . fatal ( fmt ! ( "`%s` is a reserved keyword" , w) ) ;
250250 }
251251 }
252252
0 commit comments