Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2012 16:29
Show Gist options
  • Save anonymous/4381280 to your computer and use it in GitHub Desktop.
Save anonymous/4381280 to your computer and use it in GitHub Desktop.
%lex
%%
\n+ { process.stdout.write('[ENDLINE(S)]\n'); return 'ENDLINE'; }
<<EOF>> { process.stdout.write('[EOF]'); return 'EOF'; }
(.*?)":" { process.stdout.write('[KEY]'); return 'KEY'; }
\s { process.stdout.write('[SPACE]'); return 'SPACE'; }
[^\Z|\n]+ { process.stdout.write('[VALUE]'); return 'VALUE'; }
/lex
%%
start
: KEY SPACE VALUE ENDLINE
| VALUE ENDLINE
| KEY SPACE VALUE EOF
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment