Correctly handle unicode names

This commit is contained in:
Arne Keller 2020-02-19 08:23:35 +01:00
parent a8367d84b3
commit 6e62cdb6e0

View File

@ -28,7 +28,7 @@ public final class CommandFactory {
= Pattern.compile(" \\+?(\\d+) position \\(([+-]?\\d+,[+-]?\\d+)\\)");
private static final String CREATE_ENGINE = "create engine";
private static final Pattern CREATE_ENGINE_ARGUMENTS
= Pattern.compile(" (electrical|diesel|steam) (\\w+) (\\w+) \\+?(\\d+) (true|false) (true|false)");
= Pattern.compile(" (electrical|diesel|steam) ([\\p{L}\\p{N}]+) ([\\p{L}\\p{N}]+) \\+?(\\d+) (true|false) (true|false)");
private static final String LIST_ENGINES = "list engines";
private static final String CREATE_COACH = "create coach";
private static final Pattern CREATE_COACH_ARGUMENTS
@ -36,14 +36,14 @@ public final class CommandFactory {
private static final String LIST_COACHES = "list coaches";
private static final String CREATE_TRAIN_SET = "create train-set";
private static final Pattern CREATE_TRAIN_SET_ARGUMENTS
= Pattern.compile(" (\\w+) (\\w+) \\+?(\\d+) (true|false) (true|false)");
= Pattern.compile(" ([\\p{L}\\p{N}]+) ([\\p{L}\\p{N}]+) \\+?(\\d+) (true|false) (true|false)");
private static final String LIST_TRAIN_SETS = "list train-sets";
private static final String DELETE_ROLLING_STOCK = "delete rolling stock";
private static final Pattern DELETE_ROLLING_STOCK_ARGUMENT
= Pattern.compile(" (\\w+(-\\w*)?)");
= Pattern.compile(" ([\\p{L}\\p{N}]++(-[\\p{L}\\p{N}]+)?)");
private static final String ADD_TRAIN = "add train";
private static final Pattern ADD_TRAIN_ARGUMENTS
= Pattern.compile(" \\+?(\\d+) ((\\w+-\\w+)|(W\\+?\\d+))");
= Pattern.compile(" \\+?(\\d+) (([\\p{L}\\p{N}]+-[\\p{L}\\p{N}]+)|(W\\+?\\d+))");
private static final String DELETE_TRAIN = "delete train";
private static final String LIST_TRAINS = "list trains";
private static final String SHOW_TRAIN = "show train";