aboutsummaryrefslogtreecommitdiff
path: root/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex
blob: b4c5c9a71d533025df706748d477a34a0fbbe4db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.jetbrains.markdown.lexer;

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

LineTerminator = \r|\n|\r\n
Word = {Letter}+
Number = [:digit:]+
Space     = [ \t\f]
Letter = [^~:{}$\*_`&\[\]()<!#\\ \t\n\r]
Special = [~:{}$\*_`&\[\]()<!#\\ \t\n\r]
EOL = {Space}* {LineTerminator}
EOP = {Space}* {LineTerminator} {Space}* {LineTerminator}

%%
<YYINITIAL> {
  {Space}                           { return SPACE; }
  {EOP}                             { return EOP; }
  {EOL}                             { return EOL; }
  "\\357\\273\\277"                 { return BOM; }

  {Number}                          { return NUMBER; }

  {Special}                         { return SPECIAL; }
  {Word}                          { return WORD; }

  [^] { return com.intellij.psi.TokenType.BAD_CHARACTER; }
}