Add short options into valid tokens
- Add short options as valid tokens in a `CommandModel` so that Lexer create tokens with accurate info and doesn't then cascade this issue in Ast and Parser. - Previously with a command `command -a aaa -b bbb` tokenisation resulted `COMMAND OPTION ARGUMENT ARGUMENT ARGUMENT` with multiple short options while it should have been `COMMAND OPTION ARGUMENT OPTION ARGUMENT`. - Relates #757
This commit is contained in:
@@ -196,6 +196,9 @@ public class CommandModel {
|
||||
for (String longName : commandOption.getLongNames()) {
|
||||
tokens.put("--" + longName, new Token(longName, TokenType.OPTION));
|
||||
}
|
||||
for (Character shortName : commandOption.getShortNames()) {
|
||||
tokens.put("-" + shortName, new Token(shortName.toString(), TokenType.OPTION));
|
||||
}
|
||||
});
|
||||
}
|
||||
return tokens;
|
||||
|
||||
Reference in New Issue
Block a user