Skip to content

Instantly share code, notes, and snippets.

@maximvl
Created July 22, 2017 23:28
Show Gist options
  • Save maximvl/2e2c1ad4f81652cb5deae720186ec6ab to your computer and use it in GitHub Desktop.
Save maximvl/2e2c1ad4f81652cb5deae720186ec6ab to your computer and use it in GitHub Desktop.
Red parse + states example
Red []
parser: context [
state: []
rules: [
any [
number! (append state 'number) |
word! (append state 'word) |
time! (append state 'time)
]
]
run: func [input] [
state: copy []
parse input rules
state
]
]
probe parser/run [1 2 3]
probe parser/run [x 5 y 10:30]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment