(anonymous guest) (logged out)

Copyright (C) by the contributors. Some rights reserved, license BY-SA.

Sponsored by the Wiki Symposium and the Nuveon GmbH.

 
This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Key:#

 <foo> -- this is a varibale
 | -- alternative
 * -- this repeats variable zero or more times
 + -- this repeats variable one or more times
 ? -- this repeats variable zero or one time
 ^ -- beginning of the line
 $ -- end of the line
 . -- any character but end-of-line
 "foo" -- literal string
 \s -- space, tab, vertical tab or line feed
 [bar] -- like in regular expressions, any one character of "b", "a" or "r"

Grammar:#

<page> := <block>*
<block> := <paragraph> | <list> | <preformatted> | <heading> | <horizontal line> | <empty line>
<empty line> := ^ \s* $
<horizontal line> := ^ "----" "-"* \s* $
<heading> := <heading 1> | <heading 2> | <heading 3>
<heading 1> := ^ "==" \s* <heading text> \s* "="* \s* $
<heading 2> := ^ "===" \s* <heading text> \s* "="* \s* $
<heading 3> := ^ "====" \s* <heading text> \s* "="* \s* $
<heading text> := <text part>+
<preformatted> := ^ "{{{" \s* $ <preformatted line>* ^ \s* "}" "}" "}" \s* $
<preformatted line> ^ .* $
<paragraph> := <text line>+
<text line> := ^ <text part>+ $    (cannot start with a "-")
<text part> := <normal text> | <italic text> | <bold text> | <link> | <image> | <placeholder>
<italic text> := "//" <text part>+ "//"
<bold text> := "**" <text part>+ "**"
<normal text> := .+
<placeholder> := "<<" \d+ ">>"
<image> := <image with alt> | <image without alt>
<image with alt> := "{{" <image address> "|" <alt> "}" "}"
<image without alt> := "{{" <image address> "}" "}"
<image address> := <image file> | <page name> | <url>
<image file> := .* "." <image file extension>
<image file extension> := "gif" | "jpg" | "jpeg" | "png" | "svg"
<link> := <link with text> | <link without text>
<link with text> := "[[" <link address> "|" <link text> "]]"
<link without text> := "[[" <link address> "]]"
<link address> := <page name> | <url>
<url> := <url protocol> ":" <rest of url>  ;)
<url protocol> := "http" | "https" | "ftp" | "mailto" | "news" | "irc"
<rest of url> := .+
<page name> := [a-zA-Z0-9.?!_ -]+
<list> := <first list element> <list element>*
<first list element> := <first bullet> | <first number>
<first bullet element> := ^ "-" \s <text part>* $
<first number element> := ^ "#" \s <text part>* $
<bullet element> := ^ "-"+ \s <text part>* $
<number element> := ^ "#"+ \s <text part>* $
<paragraph> := <text line>*
}}}

!Note:

This grammar is ambigious.

Some rules will conflict with others (reduce-reduce conflicts). Avoiding it
would require to increase the number of productions considerably. Maybe I
shlould include priorities instead, to be used to resolve the conflicts?

There are also some shift-reduce conflicts. For example, this could be parsed
as being all bold:

{{{
**bold** not bold **bold**
}}} 

The lists grammar here doesn't enforce one-by-one increasing of list levels.

Some assumption are made about the syntax available inside headings and
link text. __This must be specified!__

Add new attachment

Only authorized users are allowed to upload new attachments.

« This particular version was published on 04-Sep-2006 19:50 by Radomir Dopieralski.