aboutsummaryrefslogtreecommitdiff
path: root/src/Markdown/markdown.bnf
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-09-29 22:18:51 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-09-29 22:18:51 +0400
commit36a96fb39589c13ec7062e70bc71279a20b446a0 (patch)
treeef4bc73383d899e61d28d0e48e8b0e995e3ef54b /src/Markdown/markdown.bnf
parent1835f2f4ce7fb2f50676fec5198e653e24cb5c97 (diff)
downloaddokka-36a96fb39589c13ec7062e70bc71279a20b446a0.tar.gz
dokka-36a96fb39589c13ec7062e70bc71279a20b446a0.tar.bz2
dokka-36a96fb39589c13ec7062e70bc71279a20b446a0.zip
Lexing/parsing better.
Diffstat (limited to 'src/Markdown/markdown.bnf')
-rw-r--r--src/Markdown/markdown.bnf39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/Markdown/markdown.bnf b/src/Markdown/markdown.bnf
index 79e9e0b4..d26b18a6 100644
--- a/src/Markdown/markdown.bnf
+++ b/src/Markdown/markdown.bnf
@@ -11,12 +11,12 @@
generatePsi = false
tokens=[
- LINE_WS='regexp:[\ \t\f]'
- EOL='"\r"|"\n"|"\r\n"'
- BOM = '\357\273\277'
- Number='regexp:\d+(\.\d*)?'
- String='regexp:[^~\*_`&\[\]()<!#\\ \t\n\r]+'
- AnyChar='regexp:.'
+ BOM
+ EOL
+ EOP
+ Number
+ SPECIAL
+ Word
]
}
@@ -26,18 +26,19 @@ Document ::= BOM? Whitespace* AnonymousSection? (Whitespace* NamedSection)*
AnonymousSection ::= SectionBody
NamedSection ::= SectionHeader SectionBody
private SectionHeader ::= '$' SectionName OptionalSpace ':' OptionalSpace
-SectionName ::= SectionNameStart | '{' OptionalSpace SectionNameStart (Spacechar+ String)* OptionalSpace '}'
-private SectionNameStart ::= '$'? String
+SectionName ::= SectionNameStart | '{' OptionalSpace SectionNameStart (Space+ Word)* OptionalSpace '}'
+private SectionNameStart ::= '$'? Word
SectionBody::= Block*
-BlankLine ::= OptionalSpace Newline
+Unused ::= Special
+BlankLine ::= OptionalSpace EOL
-Whitespace ::= Spacechar | Newline
-private OptionalSpace ::= Spacechar*
+Whitespace ::= Space | EOL | EOP
+private OptionalSpace ::= Space*
private NonindentSpace ::= (" " | " " | " ")?
EndLine ::= TerminalEndline | NormalEndline
-private NormalEndline ::= Newline !BlankLine
+private NormalEndline ::= EOL !BlankLine
private TerminalEndline ::= OptionalSpace <<eof>>
private Indent ::= "\t" | " "
@@ -49,16 +50,16 @@ Block ::= BlankLine* (
| Para
)
-Para ::= Inlines (BlankLine | TerminalEndline)?
+Para ::= Inlines (EOP | Space* <<eof>>)?
HorizontalRule ::= NonindentSpace
( '*' OptionalSpace '*' OptionalSpace '*' (OptionalSpace '*')*
| '-' OptionalSpace '-' OptionalSpace '-' (OptionalSpace '-')*
| '_' OptionalSpace '_' OptionalSpace '_' (OptionalSpace '_')*)
- OptionalSpace Newline BlankLine+
+ OptionalSpace EOL BlankLine+
-Bullet ::= !HorizontalRule NonindentSpace ('+' | '*' | '-') Spacechar+
-Enumerator ::= NonindentSpace Number '.' Spacechar+
+Bullet ::= !HorizontalRule NonindentSpace ('+' | '*' | '-') Space+
+Enumerator ::= NonindentSpace Number '.' Space+
BulletList ::= &Bullet List
OrderedList ::= &Enumerator List
@@ -75,7 +76,7 @@ ListContinuationBlock ::= BlankLine* (Indent ListBlock)+
// ---- INLINES ----
private Inlines ::= (!EndLine Inline | EndLine &Inline )+ EndLine?
Inline ::= Strong | Emph | Link | PlainText
-PlainText ::= (String | Number | Spacechar+)+
+PlainText ::= (Word | Number | Space+)+
Emph ::= EmphStar | EmphUnderscore
private EmphStar ::= '*' !Whitespace (!'*' Inline)+ '*'
@@ -88,5 +89,5 @@ StrongUnderscore ::= '__' !Whitespace (!'__' Inline)+ '__'
Link ::= HrefLink | ReferenceLink
private ReferenceLink ::= '[' Target ']'
private HrefLink ::= '[' Target ']' '(' Href ')'
-Target ::= String
-Href ::= String \ No newline at end of file
+Target ::= Word+
+Href ::= Word+ \ No newline at end of file