From 1ec7f2c6deb64f5b13b32fae2bf74ae2d8aaaabb Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Wed, 9 Jul 2025 08:34:19 +0200 Subject: Account for CRLF/CR/LF. Lex note text. Use Wmap Parser for renderer. --- Map/Business/WmapParser/Parser.swift | 87 +++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'Map/Business/WmapParser/Parser.swift') diff --git a/Map/Business/WmapParser/Parser.swift b/Map/Business/WmapParser/Parser.swift index f04998c..9418263 100644 --- a/Map/Business/WmapParser/Parser.swift +++ b/Map/Business/WmapParser/Parser.swift @@ -56,15 +56,15 @@ extension Wmap { case .vertexLabel: return try parseVertexOrEdge() case .noteKeyword: - return try parseNote() + return .note(try parseNote()) case .stageNumber: - return try parseStage() + return .stage(try parseStage()) case .groupKeyword: - return try parseGroup() + return .group(try parseGroup()) case .inertiaKeyword: - return try parseInertia() + return .inertia(try parseInertia()) case .evolutionKeyword: - return try parseEvolution() + return .evolution(try parseEvolution()) case .error: // Error tokens should cause the line to be ignored throw ParseError.invalidLine @@ -97,19 +97,20 @@ extension Wmap { vertexLabelMap[secondLabel.lowercased()] = secondLabel advance() - return Edge( - from: firstLabel, - to: secondLabel, - isDirected: isDirected, - position: startPos, - range: SourceRange( - start: startPos, end: endPos, - stringRange: firstLabelRange.stringRange - .lowerBound..