Init
This commit is contained in:
commit
c9f61c4e06
16 changed files with 1366 additions and 0 deletions
88
Grammar.ebnf
Normal file
88
Grammar.ebnf
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
document ::= paragraph*
|
||||
|
||||
paragraph ::= ( text_paragraph | code_block | header | list | table ) newline?
|
||||
|
||||
text_paragraph ::= text_element+
|
||||
|
||||
text_element ::= emphasis | bold | monospace | link | anchor | identifier |
|
||||
inline_math | image | plain_text | escaped_char
|
||||
|
||||
emphasis ::= '/' text_no_newline '/'
|
||||
bold ::= '__' text_no_newline '__'
|
||||
monospace ::= '@' text_content '@'
|
||||
|
||||
link ::= module_link | hyperlink | markdown_link
|
||||
module_link ::= '"' module_name ( '#' anchor_name )? '"'
|
||||
hyperlink ::= '<' url ( ' ' link_text )? '>'
|
||||
markdown_link ::= '[' link_text '](' ( url | module_link ) ')'
|
||||
|
||||
anchor ::= '#' anchor_name '#'
|
||||
identifier ::= "'" haskell_id "'"
|
||||
|
||||
inline_math ::= '\(' math_expr '\)'
|
||||
image ::= '<<' image_path ( ' ' image_title )? '>>' |
|
||||
''
|
||||
|
||||
code_block ::= at_block | bird_tracks | example_block | property_block
|
||||
at_block ::= '@' newline code_content newline '@'
|
||||
bird_tracks ::= ( '>' ' '? code_line newline )+
|
||||
example_block ::= ( '>>>' ' ' expression newline result_line* )+
|
||||
property_block ::= 'prop>' ' ' property_desc newline
|
||||
|
||||
header ::= header_marker ' ' header_text newline
|
||||
header_marker ::= '=' | '==' | '===' | '====' | '=====' | '======'
|
||||
|
||||
list ::= unordered_list | ordered_list | definition_list
|
||||
unordered_list ::= ( list_marker ' ' list_content )+
|
||||
list_marker ::= '*' | '-'
|
||||
ordered_list ::= ( number_marker ' ' list_content )+
|
||||
number_marker ::= digit+ '.' | '(' digit+ ')'
|
||||
definition_list ::= ( '[' term ']' ':'? ' ' definition_content )+
|
||||
|
||||
table ::= table_border header_row header_sep data_row* table_border
|
||||
table_border ::= '+' ( '-' | '+' )* newline
|
||||
header_row ::= '|' ( table_cell '|' )* newline
|
||||
header_sep ::= '+' ( '=' | '+' )* newline
|
||||
data_row ::= '|' ( table_cell '|' )* newline
|
||||
|
||||
plain_text ::= text_char+
|
||||
text_char ::= letter | digit | ' ' | punctuation
|
||||
text_no_newline ::= ( letter | digit | ' ' | safe_punctuation )+
|
||||
text_content ::= ( letter | digit | ' ' | newline | punctuation )*
|
||||
code_content ::= code_char*
|
||||
code_char ::= letter | digit | ' ' | newline | punctuation
|
||||
code_line ::= ( letter | digit | ' ' | punctuation )*
|
||||
list_content ::= text_element* ( newline ' ' text_element* )?
|
||||
table_cell ::= ' ' table_char* ' '
|
||||
table_char ::= letter | digit | ' ' | safe_punctuation
|
||||
header_text ::= ( letter | digit | ' ' | punctuation )+
|
||||
link_text ::= link_char+
|
||||
link_char ::= letter | digit | ' ' | safe_punctuation
|
||||
alt_text ::= alt_char+
|
||||
alt_char ::= letter | digit | ' ' | safe_punctuation
|
||||
image_path ::= ( letter | digit | '.' | '/' | '-' | '_' )+
|
||||
image_title ::= image_title_char+
|
||||
image_title_char ::= letter | digit | ' ' | safe_punctuation
|
||||
anchor_name ::= letter ( letter | digit | '-' )*
|
||||
haskell_id ::= letter ( letter | digit | '_' | "'" )*
|
||||
module_name ::= haskell_id ( '.' haskell_id )*
|
||||
url ::= ( 'http://' | 'https://' | 'ftp://' ) url_char+
|
||||
url_char ::= letter | digit | '/' | '.' | ':' | '-' | '_' | '?' | '&' | '='
|
||||
math_expr ::= math_char+
|
||||
math_char ::= letter | digit | ' ' | math_punctuation
|
||||
property_desc ::= ( letter | digit | ' ' | punctuation )+
|
||||
expression ::= ( letter | digit | ' ' | punctuation )+
|
||||
result_line ::= result_char* newline
|
||||
result_char ::= letter | digit | ' ' | safe_punctuation
|
||||
term ::= term_char+
|
||||
term_char ::= letter | digit | ' ' | safe_punctuation
|
||||
definition_content ::= text_element+
|
||||
escaped_char ::= '\' special_char
|
||||
|
||||
special_char ::= '/' | '*' | '@' | "'" | '"' | '#' | '<' | '>' | '[' | ']' | '(' | ')' | '|' | '=' | '-' | '+'
|
||||
safe_punctuation ::= '!' | '$' | '%' | '^' | '&' | '(' | ')' | '_' | '+' | '{' | '}' | ';' | ':' | ',' | '.' | '`' | '~'
|
||||
math_punctuation ::= '+' | '-' | '*' | '/' | '^' | '_' | '=' | '(' | ')' | '{' | '}' | '[' | ']'
|
||||
punctuation ::= '!' | '@' | '#' | '$' | '%' | '^' | '&' | '*' | '(' | ')' | '-' | '_' | '+' | '=' | '{' | '}' | '[' | ']' | '|' | '\' | ':' | ';' | '"' | "'" | '<' | '>' | '?' | ',' | '.' | '/' | '`' | '~'
|
||||
letter ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'
|
||||
digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
|
||||
newline ::= #xA | #xD #xA | #xD
|
||||
Loading…
Add table
Add a link
Reference in a new issue