Created
July 5, 2011 17:51
-
-
Save tadzik/1065396 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
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