X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=tests%2Ftibdoc.g;h=1df3fb80ee6e86e142fe9fb181b3bc49c5f24aa8;hb=92632cd2b60dc20e157128696edc81e3a07eaec6;hp=e1f8a86b5fef6b1e246a547eec09f195a8242150;hpb=06d4d872050cac83ebd1a0abbf0e00d18ed3c44d;p=sbp.git diff --git a/tests/tibdoc.g b/tests/tibdoc.g index e1f8a86..1df3fb8 100644 --- a/tests/tibdoc.g +++ b/tests/tibdoc.g @@ -24,7 +24,7 @@ s ::= Doc => top Doc ::= {Header} Body /ws => doc Header ::= "header" { kv */ ws } /ws => header -Body ::= Section*/ws => body +Body ::= Section*/ws => body Section ::= { SectionHeader Paragraph* /ws => section } SectionHeader ::= "==" SectionHeaderBody "==" SectionHeaderBody ::= "=" SectionHeaderBody "=" @@ -34,29 +34,30 @@ sp !::= " "** blank ::= sp "\n" sp "\n" ws kv ::= word "=" text /ws => kv1 - +wp !::= w++ num !::= [0-9]++ -Paragraph ::= { "\"\"" ws text } => "blockquote" - > { "*" " " ws text } => "ul" - > { "#" " " ws text } => "ol" +Paragraph ::= { "\"\"" ws text } => "blockquote" + > uli+/ws => "ul" + > { "# " text } => "ol" > { num " " ws text } => "ol" > { "---" "-"* } => "hr" > { text } => "p" +uli ::= { "* " text } => "li" -text ::= Item -Itemx ::= ws Item | () +text ::= Item => text +Itemx ::= ws Item + | () Item ::= blockquote - > pre Itemx => [] - > structured Itemx => [] - > structuredx Itemx => [] - > styled Itemx => [] - > qtext Itemx => [] + > pre Itemx => [] + > structured Itemx => [] + > structuredx Itemx => [] + > styled Itemx => [] + > qtext Itemx => [] > (alphanum++ => stringify) Itemx => [] - > symbol Itemx => [] -// > sym++ Itemx => [] - > Paragraph Itemx => [] - -symbol ::= sym++ + > symbol Itemx => [] + > (sym++ => stringify) Itemx => [] + > Paragraph => "" + > Paragraph Itemx => [] blockquote ::= "\"\"" text "\"\"" => "blockquote" | "\"\"" block => "blockquote" @@ -64,10 +65,10 @@ blockquote ::= "\"\"" text "\"\"" => "blockquote" qtext ::= "\"" text "\"" => "quoted" pre ::= "[verbatim]" { ~[]+ } /ws => "verbatim" // FIXME doesn't work -styled ::= "__" text "__" => ul +styled ::= "__" text "__" => underline | "((" text "))" => footnote - | ( "[[" text "]]" => tt - > "[" word "]" => citation + | ( "[[" text "]]" => tt + > "[" word "]" => citation ) | "!!" text "!!" => strikethrough | "^^" (word|block) => superscript @@ -95,29 +96,29 @@ glyph ::= "(r)" | "(c)" | "(tm)" | "--" // euro symbol? // only gets parsed once urlpath ::= urlchar* -username ::= [a-zA-Z0-9;/?:&=$\-_.+]++ -password ::= [a-zA-Z0-9;/?:&=$\-_.+]++ +username ::= [a-zA-Z0-9;/?:&=$\-_.+]++ => stringify +password ::= [a-zA-Z0-9;/?:&=$\-_.+]++ => stringify urlchar ::= [a-zA-Z0-9;/?:&=$\-_.+@] | "%" [0-9] [0-9] => "%" url ::= "mailto" ":" email - > method "://" url_login? host (":" port)? ("/" urlpath)? => "url" -url_login ::= username (":" password) "@" => "login" -method ::= [+\-.a-z0-9]+ -port ::= [0-9]+ - -domain ::= (part +/ ".") -> ~"." -part ::= [a-zA-Z0-9\-]++ // interesting use of boolean grammars + > method "://" url_login? host (":" nums)? ("/" urlpath)? => "url" +url_login ::= username (":" password) "@" => "login" +method ::= [+\-.a-z0-9]+ => stringify +domain ::= (part +/ ".") -> ~"." => domain +part ::= [a-zA-Z0-9\-]++ => stringify +// interesting use of boolean grammars // &~ ([\-0-9] ~[]* | ~[]* [\-0-9]) email ::= username "@" host -> ~[.] => emailaddr -host ::= [0-9]+ "." [0-9]+ "." [0-9]+ "." [0-9]+ => "ip" +nums ::= [0-9]++ => stringify +host ::= nums "." nums "." nums "." nums => "ip" | domain // Tokens /////////////////////////////////////////////////////////////////// -word ::= alphanum++ +word ::= alphanum++ => stringify | quoted quoted ::= "\"" ((~[\"\\] | escaped)+) "\""