Created
November 21, 2010 00:30
-
-
Save ruoso/708304 to your computer and use it in GitHub Desktop.
This file contains 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
grammar MyApp { | |
token TOP { | |
( <public> | <auth> ) | |
( ( "/json" $ { c.forward("View::JSON") } ) | | |
{ c.forward("View::HTML") } | |
) | |
} | |
token public { | |
<main> | | |
<about> | | |
<contact> | |
} | |
token auth { | |
{ fail unless c.user } | |
<customers> | |
} | |
token customers { | |
"/customer" | |
( <customer> | | |
<list_customers ) | |
} | |
token customer { | |
"/" $customer_id := (\d+) { c.stash<customer> = c.model("Customer").find($customer_id) } | |
<view_customer> | |
} | |
token list_customers { | |
{ c.stash<template> = "list_customers" } | |
} | |
token view_customer { | |
{ c.stash<template> = "view_customer" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment