notedown_parser 0.2.0

Notedown Text parser and formatter
Documentation
TextMode = _{SOI ~ TextStatement*  ~  EOI}
TextStatement = _{StyleStatement|LineStatement|MathStatement|RawStatement|SPACE_SEPARATOR|NEWLINE|Escaped|Command|English|Word}
/*====================================================================================================================*/
MathStatement = _{Math|MathRest}
///#E06C75
Math = {MathLevel ~ MathText ~ POP ~ Dollar}
MathLevel = {Dollar~PUSH (Dollar*)}
MathText = {(Escape~Dollar|!(Dollar ~ PEEK) ~ ANY)*}
///Gray
MathRest = {Dollar+}
Dollar = _{"$"}
/*====================================================================================================================*/
RawStatement = _{Raw|RawRest}
///#98C379
Raw = {RawLevel ~ RawText ~ POP ~ Accent}
RawLevel = {Accent~PUSH (Accent*)}
RawText = {(Escape~Accent|!(Accent ~ PEEK) ~ ANY)*}
///Gray
RawRest = {Accent+}
Accent = _{"`"}
/*====================================================================================================================*/
StyleStatement = _{Style|StyleRest}
///#D19A66
Style = {StyleLevel ~ StyleText ~ POP ~ Asterisk}
StyleLevel = {Asterisk~PUSH (Asterisk*)}
StyleText = {(Escape~Asterisk|!(Asterisk ~ PEEK) ~ ANY)*}
///Gray
StyleRest = {Asterisk+}
Asterisk = _{"*"}
/*====================================================================================================================*/
LineStatement = _{Line|LineRest}
///#61AFEF
Line = {LineLevel ~ LineText ~ POP ~ Tilde}
LineLevel = {Tilde~PUSH (Tilde*)}
LineText = {(Escape~Tilde|!(Tilde ~ PEEK) ~ ANY)*}
///Gray
LineRest = {Tilde+}
Tilde = _{"~"}
/*====================================================================================================================*/
//!#C678DD: Function|Escaped
Command = {Function~arguments*}
Function = @{Escape ~ ASCII_ALPHA+}
arguments = _{"{" ~(String|!"}"~ANY)*~ "}"}
///#98C379
String = ${StringSingle|LiteralString}
StringSingle = ${S2  ~  (!S2 ~  ANY)*  ~  S2 }
LiteralString = ${S1  ~  (!S1 ~  ANY)*  ~  S1 }
S1 = _{"'"}
S2 = _{"\""}
/*====================================================================================================================*/
Word = {(!(Escape|English)~SYMBOL)+|Escape}
English = {(ASCII_ALPHA|ASCII_DIGIT)+|PUNCTUATION}
Escaped = @{Escape~(Escape|Tilde|Asterisk|Dollar|Accent)}
PUNCTUATION = @{","|"."|"?"|"!"}
SYMBOL = _{!NonCharacter~ANY}
/*====================================================================================================================*/
Escape = _{"\\"}
NonCharacter = _{Asterisk|Tilde|Dollar|Accent|SPACE_SEPARATOR|NEWLINE}
/*====================================================================================================================*/
SPACE_SEPARATOR = {" "|"\t"}
NEWLINE = @{CR ~ LF|CR|LF}
CR = @{"\r"}
LF = @{"\n"}