Skip to content

Commit 2b077d6

Browse files
committed
check keyword existance on first token check
1 parent 9e082d6 commit 2b077d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

parser/src/command/shortcut.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ impl ShortcutCommand {
4242

4343
let mut toks = input.clone();
4444
if let Some(Token::Word(word)) = toks.peek_token()? {
45+
if !shortcuts.contains_key(word) {
46+
return Ok(None);
47+
}
4548
toks.next_token()?;
4649
if let Some(Token::Dot) | Some(Token::EndOfLine) = toks.peek_token()? {
47-
if !shortcuts.contains_key(word) {
48-
return Ok(None);
49-
}
5050
toks.next_token()?;
5151
*input = toks;
5252
let command = shortcuts.get(word).unwrap();

0 commit comments

Comments
 (0)