Skip to content

Commit

Permalink
Merge pull request #5 from jkrukowski/swift-6-support
Browse files Browse the repository at this point in the history
Fix compilation with Xcode >= 16.0
  • Loading branch information
johnmai-dev authored Oct 31, 2024
2 parents b435eb6 + 1708140 commit 6dbe4c4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Sources/Lexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,23 @@ func preprocess(template: String, options: PreprocessOptions = PreprocessOptions
template.removeLast()
}

template = template.replacing(/{#.*?#}/, with: "{##}")
template = template.replacing(#/{#.*?#}/#, with: "{##}")

if options.lstripBlocks == true {
template = template.replacing(/(?m)^[ \t]*({[#%])/, with: { $0.output.1 })
template = template.replacing(#/(?m)^[ \t]*({[#%])/#, with: { $0.output.1 })
}

if options.trimBlocks == true {
template = template.replacing(/([#%]})\n/, with: { $0.output.1 })
template = template.replacing(#/([#%]})\n/#, with: { $0.output.1 })
}

return
template
.replacing(/{##}/, with: "")
.replacing(/-%}\s*/, with: "%}")
.replacing(/\s*{%-/, with: "{%")
.replacing(/-}}\s*/, with: "}}")
.replacing(/\s*{{-/, with: "{{")
.replacing(#/{##}/#, with: "")
.replacing(#/-%}\s*/#, with: "%}")
.replacing(#/\s*{%-/#, with: "{%")
.replacing(#/-}}\s*/#, with: "}}")
.replacing(#/\s*{{-/#, with: "{{")
}

func tokenize(_ source: String, options: PreprocessOptions = PreprocessOptions()) throws -> [Token] {
Expand Down

0 comments on commit 6dbe4c4

Please sign in to comment.