File tree Expand file tree Collapse file tree
stack-control/src/compiletime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,9 +77,14 @@ pub fn split_to_tokens<'a>(mut symbols: Peekable<impl Iterator<Item = char> + Cl
7777
7878 // Or whitespace
7979 . or_else ( || {
80- if symbols. peek ( ) ?. is_whitespace ( ) { return Some ( Token :: WhiteSpace ( symbols. next ( ) ?) ) }
80+ if symbols. peek ( ) ?. is_whitespace ( ) { return Some ( Token :: WhiteSpace ( symbols. next ( ) ?) ) }
8181 None
8282 } )
83+ . or_else ( || {
84+ if !symbols. peek ( ) ?. is_alphanumeric ( ) {
85+ return Some ( Token :: CommandToken ( CommandToken :: CommandOrAlias ( String :: from ( symbols. next ( ) ?) ) ) )
86+ } None
87+ } )
8388 // Or one of "complex" tokens
8489 . or_else ( || parse_number ( & mut symbols) )
8590 . unwrap_or_else ( || parse_command_or_alias ( & mut symbols) . expect ( "Internal exception!" ) )
@@ -99,7 +104,7 @@ fn parse_command_or_alias<'a>(iter: &mut Peekable<impl Iterator<Item = char> + C
99104 if p. is_numeric ( ) || p. is_whitespace ( ) || p == '.' { return None }
100105 let mut result = String :: new ( ) ;
101106 while let Some ( symbol) = iter. peek ( ) {
102- if symbol. is_whitespace ( ) { break ; }
107+ if ! symbol. is_alphanumeric ( ) { break ; }
103108 result. push ( * symbol) ;
104109 iter. next ( ) ;
105110 } ;
You can’t perform that action at this time.
0 commit comments