Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created July 5, 2011 17:51
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 tadzik/1065396 to your computer and use it in GitHub Desktop.
Save tadzik/1065396 to your computer and use it in GitHub Desktop.
I struggle with the following
=table
Superhero | Secret |
| Identity | Superpower
==============|=================|================================
The Shoveller | Eddie Stevens | King Arthur's singing shovel
Blue Raja | Geoffrey Smith | Master of cutlery
Mr Furious | Roy Orson | Ticking time bomb of fury
The Bowler | Carol Pinnsler | Haunted bowling ball
I'm matching a single row with:
token table_row:sym<content> {
\h* <table_cell> ** [ \h+'|'\h+ || \h+'+'\h+ || \h\h+ ] \n
}
Where table_cell is:
token table_cell {
<!before '=' \w> # no pod directives
[
<!before \h\h+ || \h'|'\h || \h'+'\h> \N
]+
}
Now in the example above, the headers get parsed as:
(("Superhero", "Secret", "| "), ("| Identity", "Superpower"))
Can you think of any sensemaking way to allow an empty cell so this example will work?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment