Skip to content

Instantly share code, notes, and snippets.

@ruoso
Created November 21, 2010 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruoso/708304 to your computer and use it in GitHub Desktop.
Save ruoso/708304 to your computer and use it in GitHub Desktop.
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