diff --git a/.idea/artifacts/UMLClassParser_jar.xml b/.idea/artifacts/UMLClassParser_jar.xml
new file mode 100644
index 0000000..fe3e856
--- /dev/null
+++ b/.idea/artifacts/UMLClassParser_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/UMLClassParser_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5428727
--- /dev/null
+++ b/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: UMLConverterMain
+
diff --git a/src/Regex.java b/src/Regex.java
new file mode 100644
index 0000000..99b45ec
--- /dev/null
+++ b/src/Regex.java
@@ -0,0 +1,55 @@
+public class Regex {
+
+ /**
+ * Matches any method in the UML format, including a constructor
+ *
+ *
Examples:
+ *
+ * - + doStuff(foo: int, foo: int): int
+ * - + getFoo(): int
+ * - - work()
+ *
+ *
+ * Groups:
+ *
+ * - 1 The encapsulate modifier (+-~#)
+ * - 2 The name
+ * - 3 All Arguments
+ * - 4 The return type, "" if no return type is specified (void)
+ *
+ *
+ */
+ public static final String METHOD_FIND_REGEX = " *(?[+\\-~#]) *(?\\w+) *\\( *(?(?: *\\w+ *: *\\w+ *,? *)*) *\\) *(?:: *(?\\w+))?";
+
+ /**
+ * Matches any Field in the UML format, including a constructor
+ *
+ * Examples:
+ *
+ * - - age: int
+ * - - name: String
+ * - # date: LocalDate
+ *
+ *
+ * Groups:
+ *
+ * - 1 The encapsulate modifier (+-~#)
+ * - 2 The name
+ * - 3 The datatype
+ *
+ *
+ */
+ public static final String FIELD_FIND_REGEX = " *(?[+\\-~#]) *(?\\w+) *: *(?\\w+)";
+
+ /**
+ * Matches a single arg in a method
+ *
+ * Groups:
+ *
+ * - 1 The name
+ * - 2 The datatype
+ *
+ */
+ public static final String ARG_SPLIT_REGEX = " ?(\\w+): (\\w+)";
+
+}
diff --git a/src/UMLClass.java b/src/UMLClass.java
index b5075f8..cacc554 100644
--- a/src/UMLClass.java
+++ b/src/UMLClass.java
@@ -21,9 +21,9 @@ public class UMLClass {
for (String line : linesBeheaded) {
if(line != null) {
- if (line.matches("([+\\-~#]) ?(.+)\\((.*: .*,?)?\\):? ?(.+)?")) { //MATCHES METHOD
+ if (line.matches(Regex.METHOD_FIND_REGEX)) { //MATCHES METHOD
methods.add(new UMLMethod(line, name));
- } else if (line.matches("([+\\-~#]) ?((?:[a-z]|[A-Z]|[0-1])+): (.*)")) { //MATCHES FIELD
+ } else if (line.matches(Regex.FIELD_FIND_REGEX)) { //MATCHES FIELD
fields.add(new UMLField(line));
}
}
diff --git a/src/UMLClassView.form b/src/UMLClassView.form
index b62c513..c6a73e1 100644
--- a/src/UMLClassView.form
+++ b/src/UMLClassView.form
@@ -1,7 +1,7 @@