aboutsummaryrefslogtreecommitdiff
path: root/src/Markdown/_MarkdownLexer.flex
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-09-25 22:20:58 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-09-25 22:20:58 +0400
commitf7bab78839cea5674658a6a0298f88ef5ccca019 (patch)
tree51d17c02f8f935b26a9c9d85905fc33c18ebd6a1 /src/Markdown/_MarkdownLexer.flex
parenta070217e942a16ed7b5ee63e98a4183788c8e660 (diff)
downloaddokka-f7bab78839cea5674658a6a0298f88ef5ccca019.tar.gz
dokka-f7bab78839cea5674658a6a0298f88ef5ccca019.tar.bz2
dokka-f7bab78839cea5674658a6a0298f88ef5ccca019.zip
Markdown, sections, styles and lots more.
Diffstat (limited to 'src/Markdown/_MarkdownLexer.flex')
-rw-r--r--src/Markdown/_MarkdownLexer.flex40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Markdown/_MarkdownLexer.flex b/src/Markdown/_MarkdownLexer.flex
new file mode 100644
index 00000000..9c76da8f
--- /dev/null
+++ b/src/Markdown/_MarkdownLexer.flex
@@ -0,0 +1,40 @@
+package org.jetbrains.markdown.impl;
+
+import com.intellij.lexer.*;
+import com.intellij.psi.tree.IElementType;
+import static org.jetbrains.markdown.MarkdownElementTypes.*;
+
+%%
+
+%{
+ public _MarkdownLexer() {
+ this((java.io.Reader)null);
+ }
+%}
+
+%public
+%class _MarkdownLexer
+%implements FlexLexer
+%function advance
+%type IElementType
+%unicode
+
+Newline="\r"|"\n"|"\r\n"
+Spacechar=[\ \t\f]
+NUMBER=[0-9]+(\.[0-9]*)?
+STRING=[^~\*_`&\[\]()<!#\\ \t\n\r]+
+ANYCHAR=.
+Line=!'\r' !'\n' .* {Newline}
+
+%%
+<YYINITIAL> {
+ {Spacechar} { return SPACECHAR; }
+ {Newline} { return NEWLINE; }
+ "\\357\\273\\277" { return BOM; }
+
+ {NUMBER} { return NUMBER; }
+ {STRING} { return STRING; }
+ {ANYCHAR} { return ANYCHAR; }
+
+ [^] { return com.intellij.psi.TokenType.BAD_CHARACTER; }
+}