[PlutoCommandParser] Code cleanup
This commit is contained in:
parent
c3bd358bed
commit
aa70f1bbe2
|
@ -17,6 +17,7 @@ can now only be modified only through public setters
|
||||||
* `[PlutoCore]` Refactored `InputBus` and added several convenience methods
|
* `[PlutoCore]` Refactored `InputBus` and added several convenience methods
|
||||||
* `[PlutoCore]` Refactored input callbacks
|
* `[PlutoCore]` Refactored input callbacks
|
||||||
* `[PlutoStatic]` Slight cleanup in the `Display` and `DisplayBuilder` classes
|
* `[PlutoStatic]` Slight cleanup in the `Display` and `DisplayBuilder` classes
|
||||||
|
* `[PlutoCommandParser]` Code cleanup
|
||||||
|
|
||||||
## 20.2.0.0-alpha.1
|
## 20.2.0.0-alpha.1
|
||||||
* `[PlutoLib#cz.tefek.pluto.io.logger]` Refactored the Logger subsystem
|
* `[PlutoLib#cz.tefek.pluto.io.logger]` Refactored the Logger subsystem
|
||||||
|
|
|
@ -4,7 +4,7 @@ import cz.tefek.pluto.command.CommandBase;
|
||||||
|
|
||||||
public class CommandContextBuilder
|
public class CommandContextBuilder
|
||||||
{
|
{
|
||||||
private CommandContext ctx;
|
private final CommandContext ctx;
|
||||||
|
|
||||||
public CommandContextBuilder()
|
public CommandContextBuilder()
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ import cz.tefek.pluto.command.registry.CommandRegistry;
|
||||||
|
|
||||||
public class CommandParser
|
public class CommandParser
|
||||||
{
|
{
|
||||||
private String text;
|
private final String text;
|
||||||
private Set<OfInt> prefixes;
|
private Set<OfInt> prefixes;
|
||||||
private EnumParserState state;
|
private EnumParserState state;
|
||||||
|
|
||||||
|
@ -196,7 +196,11 @@ public class CommandParser
|
||||||
this.state = EnumParserState.READING_PREFIX;
|
this.state = EnumParserState.READING_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.text.codePoints().takeWhile(this::readCodepoint);
|
var cps = this.text.codePoints();
|
||||||
|
|
||||||
|
for (var cpIt = cps.iterator(); cpIt.hasNext(); )
|
||||||
|
if (!this.readCodepoint(cpIt.next()))
|
||||||
|
break;
|
||||||
|
|
||||||
// Update the state for EOF
|
// Update the state for EOF
|
||||||
switch (this.state)
|
switch (this.state)
|
||||||
|
|
Loading…
Reference in New Issue