diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-14 20:21:24 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-15 00:10:39 +0100 |
| commit | 0d5e6636405dbe332c33c0fb82c7ccccb20f96cb (patch) | |
| tree | a9cda2b711bbfc9277d66310440dd965b16682fc /Map/Data/MapDocument.swift | |
| parent | a5ae7aedc840a38505b3181f4e5ba92e90d94fa1 (diff) | |
Use wmap-parser-swift and tree-sitter-wmap for parsing and highlighting.
Diffstat (limited to 'Map/Data/MapDocument.swift')
| -rw-r--r-- | Map/Data/MapDocument.swift | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Map/Data/MapDocument.swift b/Map/Data/MapDocument.swift index 3c19ca1..813b81d 100644 --- a/Map/Data/MapDocument.swift +++ b/Map/Data/MapDocument.swift @@ -14,6 +14,7 @@ // along with this program. If not, see https://map.tranquil.systems. import SwiftUI import UniformTypeIdentifiers +import WmapParser struct MapDocument: FileDocument { var text: String @@ -40,10 +41,8 @@ struct MapDocument: FileDocument { static var readableContentTypes: [UTType] { [.wmap] } - var parsed: Wmap.ParsedMap { - let lexer = Wmap.Lexer(self.text) - let parser = Wmap.Parser(lexer: lexer) - return parser.parse() + var parsed: WmapParser.Map { + return WmapParser.parse(self.text) } init(configuration: ReadConfiguration) throws { @@ -63,7 +62,7 @@ struct MapDocument: FileDocument { @MainActor func exportAsImage(withEvolution selectedEvolution: StageType) -> NSImage? { let renderView = MapRenderView( - entities: self.parsed.entities, + parsedMap: self.parsed, evolution: .constant(selectedEvolution)) let renderer = ImageRenderer(content: renderView) |