-
- Downloads
Separate command parsing into splitting and validation steps
The splitting step splits the argument string into separate arguments according to a Parameters object, and associates the split arguments with the corresponding parameters. However, it performs absolutely no checking - splitArgs will split any input string without errors. (Any excess arguments that cannot be associated with a parameter are returned as a separate string.) The validation step takes the output of the splitting step and validates it against the Parameters object. Currently this only involves checking that there is no excess input and validating argument count constraints. This separation will make it easier to work with potentially incomplete or invalid command arguments, which is necessary for the completion and inspection features. It also makes the parsing code a little more organized. For now this change is purely internal to the command parsing code. The external API of Parameters and related classes has not changed (although they may be changed in the future).
Showing
- src/main/java/de/prob2/jupyter/CommandUtils.java 37 additions, 29 deletionssrc/main/java/de/prob2/jupyter/CommandUtils.java
- src/main/java/de/prob2/jupyter/Parameter.java 11 additions, 9 deletionssrc/main/java/de/prob2/jupyter/Parameter.java
- src/main/java/de/prob2/jupyter/PositionalParameter.java 65 additions, 60 deletionssrc/main/java/de/prob2/jupyter/PositionalParameter.java
- src/main/java/de/prob2/jupyter/SplitArguments.java 40 additions, 0 deletionssrc/main/java/de/prob2/jupyter/SplitArguments.java
- src/main/java/de/prob2/jupyter/SplitResult.java 23 additions, 0 deletionssrc/main/java/de/prob2/jupyter/SplitResult.java
Loading
Please register or sign in to comment