src/parser.cpp

changeset 340
e17e07661f4c
parent 335
c5830bce1c23
child 358
ef90ed0a5720
--- a/src/parser.cpp	Sat Jul 23 01:38:06 2022 +0300
+++ b/src/parser.cpp	Sat Jul 23 01:38:43 2022 +0300
@@ -22,9 +22,9 @@
 #include "src/model.h"
 #include "src/parser.h"
 
-#define NUMBER_REGEX R"([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+)))"
+#define NUMBER_REGEX R"(([+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))))"
 #define SPACE_REGEX R"(\s+)"
-#define VEC3_REGEX "(" NUMBER_REGEX SPACE_REGEX NUMBER_REGEX SPACE_REGEX NUMBER_REGEX ")"
+#define VEC3_REGEX NUMBER_REGEX SPACE_REGEX NUMBER_REGEX SPACE_REGEX NUMBER_REGEX
 #define TWO_VECTORS VEC3_REGEX SPACE_REGEX VEC3_REGEX
 #define THREE_VECTORS TWO_VECTORS SPACE_REGEX VEC3_REGEX
 #define FOUR_VECTORS THREE_VECTORS SPACE_REGEX VEC3_REGEX
@@ -64,6 +64,7 @@
 {
 	const int index = attribIndex<LineType<T, Attribs...>, Attrib>;
 	const TextRange& range = parsed.positions[index];
+	const QString content = parsed.content;
 	return parsed.content.mid(range.start, range.length);
 }
 
@@ -103,6 +104,7 @@
 				.length = match.capturedLength(i + 1),
 			};
 		}
+		parsed->content = match.captured(0);
 		return parsed;
 	};
 	if (auto line1Match = tryRe(exprs().subfileRe)) {

mercurial