Skip to content

Instantly share code, notes, and snippets.

@whitfin
Created October 8, 2020 03:46
Show Gist options
  • Save whitfin/78338d417db86586fbbe5f4d8fc6baf5 to your computer and use it in GitHub Desktop.
Save whitfin/78338d417db86586fbbe5f4d8fc6baf5 to your computer and use it in GitHub Desktop.
path = _{ SOI ~ base ~ accessor* ~ EOI }
base = @{ ("$" | "_" | ASCII_ALPHA) ~ identifier }
accessor = _{ ("." ~ identifier ) | ("[\"" ~ inner ~ "\"]") | index }
identifier = { ("$" | "_" | ASCII_ALPHANUMERIC)* }
inner = @{ char* }
char = {
!("\"" | "\\") ~ ANY
| "\\" ~ ("\"" | "\\" | "/" | "b" | "f" | "n" | "r" | "t")
| "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4})
}
number = { ASCII_DIGIT+ }
index = _{ "[" ~ number ~ "]" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment