Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active January 26, 2021 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasdev/009695f6865774884e60b3a63f3ed86e to your computer and use it in GitHub Desktop.
Save jasdev/009695f6865774884e60b3a63f3ed86e to your computer and use it in GitHub Desktop.
Initial sketch of a timecode line parser to be used in an SRT file parser.
let timecodeParser = timecodeHours
.skip(StartsWith(":"))
.take(timecodeMinutes)
.skip(StartsWith(":"))
.take(timecodeSeconds)
.skip(StartsWith(","))
.take(timecodeMilliseconds) // ⇒ Parser<Substring, (Int, Int, Int, Int)>.
let timecodeLineParser = timecodeParser
.skip(StartsWith(" --> "))
.take(timecodeParser) // ⇒ Parser<Substring, (Int, Int, Int, Int, (Int, Int, Int, Int))>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment