Created
July 22, 2017 23:28
-
-
Save maximvl/2e2c1ad4f81652cb5deae720186ec6ab to your computer and use it in GitHub Desktop.
Red parse + states example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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