Skip to content

Commit

Permalink
Fixer for more unified kqueue/epoll based NetEvent. Removed ICU depen…
Browse files Browse the repository at this point in the history
…dency

Former-commit-id: 3654b2c
  • Loading branch information
kjessup committed Apr 20, 2016
1 parent 963bdca commit abedaea
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 321 deletions.
6 changes: 3 additions & 3 deletions Sources/PerfectLib/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public class HTTPServer {
let headerKey = transformHeaderName(UTF8Encoding.encode(h[h.startIndex..<i]))
var i2 = i + 1
while i2 < h.endIndex {
if !ICU.isWhiteSpace(UnicodeScalar(h[i2])) {
if !UnicodeScalar(h[i2]).isWhiteSpace() {
break
}
i2 += 1
Expand All @@ -617,7 +617,7 @@ public class HTTPServer {
return false
}
for i in 0..<h.count {
if !ICU.isWhiteSpace(UnicodeScalar(h[i])) {
if !UnicodeScalar(h[i]).isWhiteSpace() {
let extens = UTF8Encoding.encode(h[i..<h.count])
self.requestParams[self.lastHeaderKey] = found + " " + extens
return true
Expand Down Expand Up @@ -660,7 +660,7 @@ public class HTTPServer {
if segment.count == 0 {
callback(true)
return
} else if ICU.isWhiteSpace(UnicodeScalar(segment.first!)) {
} else if UnicodeScalar(segment.first!).isWhiteSpace() {
if !self.processHeaderContinuation(segment) {
callback(false)
return
Expand Down
172 changes: 0 additions & 172 deletions Sources/PerfectLib/ICU.swift

This file was deleted.

16 changes: 7 additions & 9 deletions Sources/PerfectLib/Mustache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
//===----------------------------------------------------------------------===//
//

import ICU

let mustacheExtension = "mustache"

enum MustacheTagType {
Expand Down Expand Up @@ -734,7 +732,7 @@ public class MustacheParser {
var scalars = s.unicodeScalars
var idx = scalars.endIndex.predecessor()

while ICU.isWhiteSpace(scalars[idx]) {
while scalars[idx].isWhiteSpace() {
scalars.remove(at: idx)
idx = idx.predecessor()
}
Expand All @@ -745,7 +743,7 @@ public class MustacheParser {
func skipWhiteSpace() -> UnicodeScalar? {
var e = next()
while e != nil {
if !ICU.isWhiteSpace(e!) {
if !(e!).isWhiteSpace() {
return e
}
e = next()
Expand All @@ -763,20 +761,20 @@ public class MustacheParser {
while true {

e = next()
if e != nil && !ICU.isWhiteSpace(e!) {
if e != nil && !(e!).isWhiteSpace() {
openD.append(e!)
} else {
break
}
}

guard e != nil && ICU.isWhiteSpace(e!) else {
guard e != nil && (e!).isWhiteSpace() else {
throw MustacheError.SyntaxError(errorMsg)
}

e = skipWhiteSpace()

guard e != nil && !ICU.isWhiteSpace(e!) else {
guard e != nil && !(e!).isWhiteSpace() else {
throw MustacheError.SyntaxError(errorMsg)
}

Expand All @@ -785,14 +783,14 @@ public class MustacheParser {
while true {

e = next()
if e != nil && !ICU.isWhiteSpace(e!) && e! != "=" {
if e != nil && !(e!).isWhiteSpace() && e! != "=" {
closeD.append(e!)
} else {
break
}
}

if e != nil && ICU.isWhiteSpace(e!) {
if e != nil && (e!).isWhiteSpace() {
e = skipWhiteSpace()
guard e != nil && e! == "=" else {
throw MustacheError.SyntaxError(errorMsg)
Expand Down
Loading

0 comments on commit abedaea

Please sign in to comment.