Skip to content

Commit

Permalink
Change Character -> String to the proper way, closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
marciok committed Nov 11, 2016
1 parent 9809782 commit 26dd008
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
It's a playground explaining how to create a tiny programming language (Mu).

You can download the playground [here](https://github.com/marciok/Mu/releases/download/1.0/WriteYourLanguage.playground.zip)
or check the source code live [here](http://swiftlang.ng.bluemix.net/#/repl/582204a53c6b8052ec3e3b07)
or check the source code live [here](http://swiftlang.ng.bluemix.net/#/repl/5825fba6dee52b5745935831)

Or follow the tutorial below.

Expand Down Expand Up @@ -53,10 +53,10 @@ struct Lexer {
switch $0 {
case "(": return Token.parensOpen
case ")": return Token.parensClose
case "s": return Token.op($0.description)
case "s": return Token.op(String($0))
default:
if "0"..."9" ~= $0 {
return Token.number(Int($0.description)!)
return Token.number(Int(String($0))!)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public struct Lexer {
switch $0 {
case "(": return Token.parensOpen
case ")": return Token.parensClose
case "s": return Token.op($0.description)
case "s": return Token.op(String($0))
default:
if "0"..."9" ~= $0 {
return Token.number(Int($0.description)!)
return Token.number(Int(String($0))!)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public struct Lexer {
switch $0 {
case "(": return Token.parensOpen
case ")": return Token.parensClose
case "s": return Token.op($0.description)
case "s": return Token.op(String($0))
default:
if "0"..."9" ~= $0 {
return Token.number(Int($0.description)!)
return Token.number(Int(String($0))!)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ struct Lexer {
switch $0 {
case "(": return Token.parensOpen
case ")": return Token.parensClose
case "s": return Token.op($0.description)
case "s": return Token.op(String($0))
default:
if "0"..."9" ~= $0 {
return Token.number(Int($0.description)!)
return Token.number(Int(String($0))!)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public struct Lexer {
switch $0 {
case "(": return Token.parensOpen
case ")": return Token.parensClose
case "s": return Token.op($0.description)
case "s": return Token.op(String($0))
default:
if "0"..."9" ~= $0 {
return Token.number(Int($0.description)!)
return Token.number(Int(String($0))!)
}
}

Expand Down

0 comments on commit 26dd008

Please sign in to comment.