Skip to content

Instantly share code, notes, and snippets.

@dustinknopoff
Created October 30, 2020 16:31
Show Gist options
  • Save dustinknopoff/30608fa09925ba3715b4b8dc57451512 to your computer and use it in GitHub Desktop.
Save dustinknopoff/30608fa09925ba3715b4b8dc57451512 to your computer and use it in GitHub Desktop.
If I ever decide to go back to generating rust structs/definitions for Schema.org
WHITESPACE = _{NEWLINE | " " | "\n" | "\t"}
SchemaString = {"\"" ~ (("\\" ~ "\"") | (!"\"" ~ ANY))+ ~ "\"" ~ ("@" ~ ASCII_ALPHA+)? }
UrlNode = {(!(">" | "<") ~ ANY)+}
TAG = { "<" ~ UrlNode ~ ">"}
// Use url = "2.1" to parse out URLs...need to extract protocol, hostname, path, search, fragment
// A UrlNode is "subClassOf" "http://www.w3.org/2000/01/rdf-schema" "http://www.w3.org/2000/01/rdf-schema#subClassOf"
TRIPLE = { TAG ~ TAG ~ (TAG | SchemaString) ~ "." }
parse = {
SOI ~ TRIPLE*
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment