File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -242,9 +242,18 @@ make_parser!(
242
242
) ;
243
243
244
244
make_parser ! (
245
- NameP ( input: char ) -> Name {
245
+ NameP ( input: char ) -> String {
246
246
or( letter( ) , char ( '_' ) )
247
- . with( many( alpha_num( ) . or( char ( '_' ) ) ) )
247
+ . map( |c| {
248
+ let mut result = String :: new( ) ;
249
+ result. push( c) ;
250
+ result
251
+ } )
252
+ . and( many:: <String , _>( alpha_num( ) . or( char ( '_' ) ) ) )
253
+ . map( |( mut f, r) | {
254
+ f. push_str( & r) ;
255
+ f
256
+ } )
248
257
. parse_stream( input)
249
258
}
250
259
) ;
@@ -304,5 +313,9 @@ mod tests {
304
313
#[ test]
305
314
fn test_parse_name ( ) {
306
315
assert_sucessful_parse ! ( NameP , "_asd" , String :: from( "_asd" ) ) ;
316
+ assert_sucessful_parse ! ( NameP , "aasd" , String :: from( "aasd" ) ) ;
317
+ assert_sucessful_parse ! ( NameP , "zasd" , String :: from( "zasd" ) ) ;
318
+ assert_sucessful_parse ! ( NameP , "Aasd" , String :: from( "Aasd" ) ) ;
319
+ assert_sucessful_parse ! ( NameP , "Zasd" , String :: from( "Zasd" ) ) ;
307
320
}
308
321
}
You can’t perform that action at this time.
0 commit comments