From 6e62cdb6e0f89ccb532012bf57c0e18dae813123 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 19 Feb 2020 08:23:35 +0100 Subject: [PATCH] Correctly handle unicode names --- src/edu/kit/informatik/ui/command/CommandFactory.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/edu/kit/informatik/ui/command/CommandFactory.java b/src/edu/kit/informatik/ui/command/CommandFactory.java index 5fdc66b..eeaf48f 100644 --- a/src/edu/kit/informatik/ui/command/CommandFactory.java +++ b/src/edu/kit/informatik/ui/command/CommandFactory.java @@ -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";