aboutsummaryrefslogtreecommitdiff
path: root/src/Markdown
diff options
context:
space:
mode:
Diffstat (limited to 'src/Markdown')
-rw-r--r--src/Markdown/MarkdownLexer.java10
-rw-r--r--src/Markdown/MarkdownProcessor.kt2
-rw-r--r--src/Markdown/_MarkdownLexer.flex14
-rw-r--r--src/Markdown/markdown.bnf43
4 files changed, 31 insertions, 38 deletions
diff --git a/src/Markdown/MarkdownLexer.java b/src/Markdown/MarkdownLexer.java
deleted file mode 100644
index 3486d795..00000000
--- a/src/Markdown/MarkdownLexer.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.jetbrains.dokka.Markdown;
-
-import com.intellij.lexer.FlexAdapter;
-import org.jetbrains.markdown.impl._MarkdownLexer;
-
-public class MarkdownLexer extends FlexAdapter {
- public MarkdownLexer() {
- super(new _MarkdownLexer());
- }
-}
diff --git a/src/Markdown/MarkdownProcessor.kt b/src/Markdown/MarkdownProcessor.kt
index 9843eb68..4453e750 100644
--- a/src/Markdown/MarkdownProcessor.kt
+++ b/src/Markdown/MarkdownProcessor.kt
@@ -8,7 +8,7 @@ import com.intellij.psi.tree.IFileElementType
import com.intellij.lang.LighterASTNode
import com.intellij.util.diff.FlyweightCapableTreeStructure
import com.intellij.openapi.util.Ref
-import org.jetbrains.dokka.Markdown.MarkdownLexer
+import org.jetbrains.markdown.lexer.MarkdownLexer
public class MarkdownProcessor {
class object {
diff --git a/src/Markdown/_MarkdownLexer.flex b/src/Markdown/_MarkdownLexer.flex
index 9c76da8f..0a15e41a 100644
--- a/src/Markdown/_MarkdownLexer.flex
+++ b/src/Markdown/_MarkdownLexer.flex
@@ -1,4 +1,4 @@
-package org.jetbrains.markdown.impl;
+package org.jetbrains.markdown.lexer;
import com.intellij.lexer.*;
import com.intellij.psi.tree.IElementType;
@@ -21,9 +21,9 @@ import static org.jetbrains.markdown.MarkdownElementTypes.*;
Newline="\r"|"\n"|"\r\n"
Spacechar=[\ \t\f]
-NUMBER=[0-9]+(\.[0-9]*)?
-STRING=[^~\*_`&\[\]()<!#\\ \t\n\r]+
-ANYCHAR=.
+Number=[0-9]+(\.[0-9]*)?
+String=[^~\*_`&\[\]()<!#\\ \t\n\r]+
+AnyChar=.
Line=!'\r' !'\n' .* {Newline}
%%
@@ -32,9 +32,9 @@ Line=!'\r' !'\n' .* {Newline}
{Newline} { return NEWLINE; }
"\\357\\273\\277" { return BOM; }
- {NUMBER} { return NUMBER; }
- {STRING} { return STRING; }
- {ANYCHAR} { return ANYCHAR; }
+ {Number} { return NUMBER; }
+ {String} { return STRING; }
+ {AnyChar} { return ANYCHAR; }
[^] { return com.intellij.psi.TokenType.BAD_CHARACTER; }
}
diff --git a/src/Markdown/markdown.bnf b/src/Markdown/markdown.bnf
index b0a3ede6..71100a6f 100644
--- a/src/Markdown/markdown.bnf
+++ b/src/Markdown/markdown.bnf
@@ -8,30 +8,32 @@
tokenTypeClass = 'org.jetbrains.dokka.Markdown.MarkdownTokenType'
+ generatePsi = false
+
tokens=[
LINE_WS='regexp:[\ \t\f]'
EOL='"\r"|"\n"|"\r\n"'
BOM = '\357\273\277'
- number='regexp:\d+(\.\d*)?'
+ Number='regexp:\d+(\.\d*)?'
String='regexp:[^~\*_`&\[\]()<!#\\ \t\n\r]+'
AnyChar='regexp:.'
]
+
}
Document ::= BOM? ( Block )*
-OptionalSpace ::= Spacechar*
-RequiredSpace ::= Spacechar+
-NonindentSpace ::= (" " | " " | " ")?
+private OptionalSpace ::= Spacechar*
+private RequiredSpace ::= Spacechar+
+private NonindentSpace ::= (" " | " " | " ")?
BlankLine ::= OptionalSpace Newline
Whitespace ::= Spacechar | Newline
-EndLine ::= LineBreak | TerminalEndline | NormalEndline
-NormalEndline ::= OptionalSpace Newline !BlankLine
-TerminalEndline ::= OptionalSpace Newline <<eof>>
-LineBreak ::= " " NormalEndline
-Indent ::= "\t" | " "
+EndLine ::= TerminalEndline | NormalEndline
+private NormalEndline ::= OptionalSpace Newline !BlankLine
+private TerminalEndline ::= OptionalSpace Newline <<eof>>
+private Indent ::= "\t" | " "
// ---- BLOCKS ----
Block ::= BlankLine* (
@@ -42,7 +44,7 @@ Block ::= BlankLine* (
)
Para ::= NonindentSpace Inlines (BlankLine+ | TerminalEndline)
-Plain ::= Inlines
+private Plain ::= Inlines
HorizontalRule ::= NonindentSpace
( '*' OptionalSpace '*' OptionalSpace '*' (OptionalSpace '*')*
@@ -51,12 +53,12 @@ HorizontalRule ::= NonindentSpace
OptionalSpace Newline BlankLine+
Bullet ::= !HorizontalRule NonindentSpace ('+' | '*' | '-') Spacechar+
-Enumerator ::= NonindentSpace number '.' Spacechar+
+Enumerator ::= NonindentSpace Number '.' Spacechar+
BulletList ::= &Bullet List
OrderedList ::= &Enumerator List
-List ::= (ListItem BlankLine*)+
+private List ::= (ListItem BlankLine*)+
ListItem ::= (Bullet | Enumerator) ListBlock ( ListContinuationBlock )*
ListBlock ::= !BlankLine Plain ( ListBlockLine )*
@@ -66,18 +68,19 @@ ListContinuationBlock ::= BlankLine* (Indent ListBlock)+
// ---- INLINES ----
-Inlines ::= (!EndLine Inline | EndLine &Inline )+ EndLine?
-Inline ::= String | EndLine | RequiredSpace | Strong | Emph | Link
+private Inlines ::= (!EndLine Inline | EndLine &Inline )+ EndLine?
+Inline ::= String | Number | EndLine | Spacechar+ | Strong | Emph | Link
Emph ::= EmphStar | EmphUnderscore
-EmphStar ::= '*' !Whitespace (!'*' Inline)+ '*'
-EmphUnderscore ::= '_' !Whitespace (!'_' Inline)+ '_'
+private EmphStar ::= '*' !Whitespace (!'*' Inline)+ '*'
+private EmphUnderscore ::= '_' !Whitespace (!'_' Inline)+ '_'
Strong ::= StrongStar | StrongUnderscore
StrongStar ::= '**' !Whitespace (!'**' Inline)+ '**'
StrongUnderscore ::= '__' !Whitespace (!'__' Inline)+ '__'
-Link ::= ReferenceLink
-ReferenceLink ::= ReferenceLinkSingle
-ReferenceLinkSingle ::= '[' Target ']'
-Target ::= String \ No newline at end of file
+Link ::= HrefLink | ReferenceLink
+private ReferenceLink ::= '[' Target ']'
+private HrefLink ::= '[' Target ']' '(' Href ')'
+Target ::= String
+Href ::= String \ No newline at end of file