https://github.com/luizzak/minilexer
A teeny-tiny-weeny lexer written in Swift available as a Swift Package.
https://github.com/luizzak/minilexer
lexing swift swiftpm
Last synced: 6 months ago
JSON representation
A teeny-tiny-weeny lexer written in Swift available as a Swift Package.
- Host: GitHub
- URL: https://github.com/luizzak/minilexer
- Owner: LuizZak
- License: mit
- Created: 2018-01-05T23:10:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-06T15:28:48.000Z (7 months ago)
- Last Synced: 2025-03-21T19:04:10.319Z (7 months ago)
- Topics: lexing, swift, swiftpm
- Language: Swift
- Homepage:
- Size: 186 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## MiniLexer
[](https://dev.azure.com/luiz-fs/MiniLexer/_build/latest?definitionId=2&branchName=master)
A teeny-tiny-weeny lexer written in Swift available as a Swift Package.
Should be present in any programmer-who-likes-to-write-quick-script's toolbelt.Sample usage:
```swift
let text = "123 test"
let lexer = Lexer(input: text)do {
let oneTwoThree = try lexer.parseInt()
lexer.skipWhitespace()
let test = try lexer.nextIdent()
print("\(oneTwoThree) \(test)")
} catch {
print("Oopsie! Error: \(error)")
}
```There's also a sample URL-parsing example under Sources/URLParseSample, with tests over at Tests/URLParseSampleTests.