diff options
-rw-r--r-- | gen/org/jetbrains/markdown/MarkdownElementTypes.java | 14 | ||||
-rw-r--r-- | gen/org/jetbrains/markdown/MarkdownParser.java | 148 | ||||
-rw-r--r-- | gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex | 24 | ||||
-rw-r--r-- | gen/org/jetbrains/markdown/lexer/_MarkdownLexer.java | 85 | ||||
-rw-r--r-- | src/Markdown/markdown.bnf | 39 |
5 files changed, 188 insertions, 122 deletions
diff --git a/gen/org/jetbrains/markdown/MarkdownElementTypes.java b/gen/org/jetbrains/markdown/MarkdownElementTypes.java index 8c2d77ba..e8910c7b 100644 --- a/gen/org/jetbrains/markdown/MarkdownElementTypes.java +++ b/gen/org/jetbrains/markdown/MarkdownElementTypes.java @@ -32,14 +32,14 @@ public interface MarkdownElementTypes { IElementType STRONG_STAR = new IElementType("STRONG_STAR", null); IElementType STRONG_UNDERSCORE = new IElementType("STRONG_UNDERSCORE", null); IElementType TARGET = new IElementType("TARGET", null); + IElementType UNUSED = new IElementType("UNUSED", null); IElementType WHITESPACE = new IElementType("WHITESPACE", null); - IElementType ANYCHAR = new MarkdownTokenType("AnyChar"); - IElementType BOM = new MarkdownTokenType("\\357\\273\\277"); - IElementType EOL = new MarkdownTokenType("\"\\r\"|\"\\n\"|\"\\r\\n\""); - IElementType LINE_WS = new MarkdownTokenType("LINE_WS"); - IElementType NEWLINE = new MarkdownTokenType("Newline"); + IElementType BOM = new MarkdownTokenType("BOM"); + IElementType EOL = new MarkdownTokenType("EOL"); + IElementType EOP = new MarkdownTokenType("EOP"); IElementType NUMBER = new MarkdownTokenType("Number"); - IElementType SPACECHAR = new MarkdownTokenType("Spacechar"); - IElementType STRING = new MarkdownTokenType("String"); + IElementType SPACE = new MarkdownTokenType("Space"); + IElementType SPECIAL = new MarkdownTokenType("Special"); + IElementType WORD = new MarkdownTokenType("Word"); } diff --git a/gen/org/jetbrains/markdown/MarkdownParser.java b/gen/org/jetbrains/markdown/MarkdownParser.java index 09c4a0f9..2ca6dffd 100644 --- a/gen/org/jetbrains/markdown/MarkdownParser.java +++ b/gen/org/jetbrains/markdown/MarkdownParser.java @@ -100,6 +100,9 @@ public class MarkdownParser implements PsiParser { else if (root_ == TARGET) { result_ = Target(builder_, 0); } + else if (root_ == UNUSED) { + result_ = Unused(builder_, 0); + } else if (root_ == WHITESPACE) { result_ = Whitespace(builder_, 0); } @@ -125,14 +128,14 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // OptionalSpace Newline + // OptionalSpace EOL public static boolean BlankLine(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "BlankLine")) return false; - if (!nextTokenIs(builder_, "<blank line>", NEWLINE, SPACECHAR)) return false; + if (!nextTokenIs(builder_, "<blank line>", EOL, SPACE)) return false; boolean result_; Marker marker_ = enter_section_(builder_, level_, _NONE_, "<blank line>"); result_ = OptionalSpace(builder_, level_ + 1); - result_ = result_ && consumeToken(builder_, NEWLINE); + result_ = result_ && consumeToken(builder_, EOL); exit_section_(builder_, level_, marker_, BLANK_LINE, result_, false, null); return result_; } @@ -183,7 +186,7 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // !HorizontalRule NonindentSpace ('+' | '*' | '-') Spacechar+ + // !HorizontalRule NonindentSpace ('+' | '*' | '-') Space+ public static boolean Bullet(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Bullet")) return false; boolean result_; @@ -218,15 +221,15 @@ public class MarkdownParser implements PsiParser { return result_; } - // Spacechar+ + // Space+ private static boolean Bullet_3(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Bullet_3")) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, SPACECHAR); + result_ = consumeToken(builder_, SPACE); int pos_ = current_position_(builder_); while (result_) { - if (!consumeToken(builder_, SPACECHAR)) break; + if (!consumeToken(builder_, SPACE)) break; if (!empty_element_parsed_guard_(builder_, "Bullet_3", pos_)) break; pos_ = current_position_(builder_); } @@ -478,7 +481,7 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // NonindentSpace Number '.' Spacechar+ + // NonindentSpace Number '.' Space+ public static boolean Enumerator(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Enumerator")) return false; boolean result_; @@ -491,15 +494,15 @@ public class MarkdownParser implements PsiParser { return result_; } - // Spacechar+ + // Space+ private static boolean Enumerator_3(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Enumerator_3")) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, SPACECHAR); + result_ = consumeToken(builder_, SPACE); int pos_ = current_position_(builder_); while (result_) { - if (!consumeToken(builder_, SPACECHAR)) break; + if (!consumeToken(builder_, SPACE)) break; if (!empty_element_parsed_guard_(builder_, "Enumerator_3", pos_)) break; pos_ = current_position_(builder_); } @@ -512,7 +515,7 @@ public class MarkdownParser implements PsiParser { // ( '*' OptionalSpace '*' OptionalSpace '*' (OptionalSpace '*')* // | '-' OptionalSpace '-' OptionalSpace '-' (OptionalSpace '-')* // | '_' OptionalSpace '_' OptionalSpace '_' (OptionalSpace '_')*) - // OptionalSpace Newline BlankLine+ + // OptionalSpace EOL BlankLine+ public static boolean HorizontalRule(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "HorizontalRule")) return false; boolean result_; @@ -520,7 +523,7 @@ public class MarkdownParser implements PsiParser { result_ = NonindentSpace(builder_, level_ + 1); result_ = result_ && HorizontalRule_1(builder_, level_ + 1); result_ = result_ && OptionalSpace(builder_, level_ + 1); - result_ = result_ && consumeToken(builder_, NEWLINE); + result_ = result_ && consumeToken(builder_, EOL); result_ = result_ && HorizontalRule_4(builder_, level_ + 1); exit_section_(builder_, level_, marker_, HORIZONTAL_RULE, result_, false, null); return result_; @@ -671,13 +674,19 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // String + // Word+ public static boolean Href(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Href")) return false; - if (!nextTokenIs(builder_, STRING)) return false; + if (!nextTokenIs(builder_, WORD)) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, STRING); + result_ = consumeToken(builder_, WORD); + int pos_ = current_position_(builder_); + while (result_) { + if (!consumeToken(builder_, WORD)) break; + if (!empty_element_parsed_guard_(builder_, "Href", pos_)) break; + pos_ = current_position_(builder_); + } exit_section_(builder_, marker_, HREF, result_); return result_; } @@ -1120,13 +1129,13 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // Newline !BlankLine + // EOL !BlankLine static boolean NormalEndline(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "NormalEndline")) return false; - if (!nextTokenIs(builder_, NEWLINE)) return false; + if (!nextTokenIs(builder_, EOL)) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, NEWLINE); + result_ = consumeToken(builder_, EOL); result_ = result_ && NormalEndline_1(builder_, level_ + 1); exit_section_(builder_, marker_, null, result_); return result_; @@ -1143,12 +1152,12 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // Spacechar* + // Space* static boolean OptionalSpace(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "OptionalSpace")) return false; int pos_ = current_position_(builder_); while (true) { - if (!consumeToken(builder_, SPACECHAR)) break; + if (!consumeToken(builder_, SPACE)) break; if (!empty_element_parsed_guard_(builder_, "OptionalSpace", pos_)) break; pos_ = current_position_(builder_); } @@ -1178,7 +1187,7 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // Inlines (BlankLine | TerminalEndline)? + // Inlines (EOP | Space* <<eof>>)? public static boolean Para(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Para")) return false; boolean result_; @@ -1189,26 +1198,49 @@ public class MarkdownParser implements PsiParser { return result_; } - // (BlankLine | TerminalEndline)? + // (EOP | Space* <<eof>>)? private static boolean Para_1(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Para_1")) return false; Para_1_0(builder_, level_ + 1); return true; } - // BlankLine | TerminalEndline + // EOP | Space* <<eof>> private static boolean Para_1_0(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Para_1_0")) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = BlankLine(builder_, level_ + 1); - if (!result_) result_ = TerminalEndline(builder_, level_ + 1); + result_ = consumeToken(builder_, EOP); + if (!result_) result_ = Para_1_0_1(builder_, level_ + 1); exit_section_(builder_, marker_, null, result_); return result_; } + // Space* <<eof>> + private static boolean Para_1_0_1(PsiBuilder builder_, int level_) { + if (!recursion_guard_(builder_, level_, "Para_1_0_1")) return false; + boolean result_; + Marker marker_ = enter_section_(builder_); + result_ = Para_1_0_1_0(builder_, level_ + 1); + result_ = result_ && eof(builder_, level_ + 1); + exit_section_(builder_, marker_, null, result_); + return result_; + } + + // Space* + private static boolean Para_1_0_1_0(PsiBuilder builder_, int level_) { + if (!recursion_guard_(builder_, level_, "Para_1_0_1_0")) return false; + int pos_ = current_position_(builder_); + while (true) { + if (!consumeToken(builder_, SPACE)) break; + if (!empty_element_parsed_guard_(builder_, "Para_1_0_1_0", pos_)) break; + pos_ = current_position_(builder_); + } + return true; + } + /* ********************************************************** */ - // (String | Number | Spacechar+)+ + // (Word | Number | Space+)+ public static boolean PlainText(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "PlainText")) return false; boolean result_; @@ -1224,27 +1256,27 @@ public class MarkdownParser implements PsiParser { return result_; } - // String | Number | Spacechar+ + // Word | Number | Space+ private static boolean PlainText_0(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "PlainText_0")) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, STRING); + result_ = consumeToken(builder_, WORD); if (!result_) result_ = consumeToken(builder_, NUMBER); if (!result_) result_ = PlainText_0_2(builder_, level_ + 1); exit_section_(builder_, marker_, null, result_); return result_; } - // Spacechar+ + // Space+ private static boolean PlainText_0_2(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "PlainText_0_2")) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, SPACECHAR); + result_ = consumeToken(builder_, SPACE); int pos_ = current_position_(builder_); while (result_) { - if (!consumeToken(builder_, SPACECHAR)) break; + if (!consumeToken(builder_, SPACE)) break; if (!empty_element_parsed_guard_(builder_, "PlainText_0_2", pos_)) break; pos_ = current_position_(builder_); } @@ -1296,7 +1328,7 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // SectionNameStart | '{' OptionalSpace SectionNameStart (Spacechar+ String)* OptionalSpace '}' + // SectionNameStart | '{' OptionalSpace SectionNameStart (Space+ Word)* OptionalSpace '}' public static boolean SectionName(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "SectionName")) return false; boolean result_; @@ -1307,7 +1339,7 @@ public class MarkdownParser implements PsiParser { return result_; } - // '{' OptionalSpace SectionNameStart (Spacechar+ String)* OptionalSpace '}' + // '{' OptionalSpace SectionNameStart (Space+ Word)* OptionalSpace '}' private static boolean SectionName_1(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "SectionName_1")) return false; boolean result_; @@ -1322,7 +1354,7 @@ public class MarkdownParser implements PsiParser { return result_; } - // (Spacechar+ String)* + // (Space+ Word)* private static boolean SectionName_1_3(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "SectionName_1_3")) return false; int pos_ = current_position_(builder_); @@ -1334,26 +1366,26 @@ public class MarkdownParser implements PsiParser { return true; } - // Spacechar+ String + // Space+ Word private static boolean SectionName_1_3_0(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "SectionName_1_3_0")) return false; boolean result_; Marker marker_ = enter_section_(builder_); result_ = SectionName_1_3_0_0(builder_, level_ + 1); - result_ = result_ && consumeToken(builder_, STRING); + result_ = result_ && consumeToken(builder_, WORD); exit_section_(builder_, marker_, null, result_); return result_; } - // Spacechar+ + // Space+ private static boolean SectionName_1_3_0_0(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "SectionName_1_3_0_0")) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, SPACECHAR); + result_ = consumeToken(builder_, SPACE); int pos_ = current_position_(builder_); while (result_) { - if (!consumeToken(builder_, SPACECHAR)) break; + if (!consumeToken(builder_, SPACE)) break; if (!empty_element_parsed_guard_(builder_, "SectionName_1_3_0_0", pos_)) break; pos_ = current_position_(builder_); } @@ -1362,13 +1394,13 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // '$'? String + // '$'? Word static boolean SectionNameStart(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "SectionNameStart")) return false; boolean result_; Marker marker_ = enter_section_(builder_); result_ = SectionNameStart_0(builder_, level_ + 1); - result_ = result_ && consumeToken(builder_, STRING); + result_ = result_ && consumeToken(builder_, WORD); exit_section_(builder_, marker_, null, result_); return result_; } @@ -1515,13 +1547,19 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // String + // Word+ public static boolean Target(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Target")) return false; - if (!nextTokenIs(builder_, STRING)) return false; + if (!nextTokenIs(builder_, WORD)) return false; boolean result_; Marker marker_ = enter_section_(builder_); - result_ = consumeToken(builder_, STRING); + result_ = consumeToken(builder_, WORD); + int pos_ = current_position_(builder_); + while (result_) { + if (!consumeToken(builder_, WORD)) break; + if (!empty_element_parsed_guard_(builder_, "Target", pos_)) break; + pos_ = current_position_(builder_); + } exit_section_(builder_, marker_, TARGET, result_); return result_; } @@ -1539,14 +1577,26 @@ public class MarkdownParser implements PsiParser { } /* ********************************************************** */ - // Spacechar | Newline + // Special + public static boolean Unused(PsiBuilder builder_, int level_) { + if (!recursion_guard_(builder_, level_, "Unused")) return false; + if (!nextTokenIs(builder_, SPECIAL)) return false; + boolean result_; + Marker marker_ = enter_section_(builder_); + result_ = consumeToken(builder_, SPECIAL); + exit_section_(builder_, marker_, UNUSED, result_); + return result_; + } + + /* ********************************************************** */ + // Space | EOL | EOP public static boolean Whitespace(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "Whitespace")) return false; - if (!nextTokenIs(builder_, "<whitespace>", NEWLINE, SPACECHAR)) return false; boolean result_; Marker marker_ = enter_section_(builder_, level_, _NONE_, "<whitespace>"); - result_ = consumeToken(builder_, SPACECHAR); - if (!result_) result_ = consumeToken(builder_, NEWLINE); + result_ = consumeToken(builder_, SPACE); + if (!result_) result_ = consumeToken(builder_, EOL); + if (!result_) result_ = consumeToken(builder_, EOP); exit_section_(builder_, level_, marker_, WHITESPACE, result_, false, null); return result_; } diff --git a/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex b/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex index f5aab899..b4c5c9a7 100644 --- a/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex +++ b/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex @@ -19,24 +19,26 @@ import static org.jetbrains.markdown.MarkdownElementTypes.*; %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} +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> { - {Spacechar} { return SPACECHAR; } - {Newline} { return NEWLINE; } + {Space} { return SPACE; } + {EOP} { return EOP; } + {EOL} { return EOL; } "\\357\\273\\277" { return BOM; } - {Number} { return NUMBER; } - {String} { return STRING; } - {AnyChar} { return ANYCHAR; } + {Special} { return SPECIAL; } + {Word} { return WORD; } [^] { return com.intellij.psi.TokenType.BAD_CHARACTER; } } diff --git a/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.java b/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.java index c84a83d8..086512a1 100644 --- a/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.java +++ b/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.java @@ -1,4 +1,4 @@ -/* The following code was generated by JFlex 1.4.3 on 9/29/14 3:24 PM */ +/* The following code was generated by JFlex 1.4.3 on 9/29/14 10:13 PM */ package org.jetbrains.markdown.lexer; @@ -10,7 +10,7 @@ import static org.jetbrains.markdown.MarkdownElementTypes.*; /** * This class is a scanner generated by * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 - * on 9/29/14 3:24 PM from the specification file + * on 9/29/14 10:13 PM from the specification file * <tt>/Users/orangy/Projects/dokka/gen/org/jetbrains/markdown/lexer/_MarkdownLexer.flex</tt> */ public class _MarkdownLexer implements FlexLexer { @@ -34,10 +34,14 @@ public class _MarkdownLexer implements FlexLexer { * Translates characters to character classes */ private static final String ZZ_CMAP_PACKED = - "\11\0\1\7\1\2\1\0\1\3\1\1\22\0\1\7\1\6\1\0"+ - "\2\6\1\0\1\6\1\0\3\6\3\0\1\5\1\0\2\4\1\14"+ - "\1\11\1\4\1\12\1\4\1\13\2\4\1\6\1\0\1\6\36\0"+ - "\1\6\1\10\1\6\1\0\2\6\32\0\1\6\1\0\2\6\uff81\0"; + "\11\0\1\6\1\2\1\0\1\4\1\1\22\0\1\6\1\5\1\0"+ + "\2\5\1\0\1\5\1\0\3\5\5\0\2\3\1\13\1\10\1\3"+ + "\1\11\1\3\1\12\2\3\1\5\1\0\1\5\36\0\1\5\1\7"+ + "\1\5\1\0\2\5\32\0\1\5\1\0\2\5\u05e1\0\12\3\206\0"+ + "\12\3\u026c\0\12\3\166\0\12\3\166\0\12\3\166\0\12\3\166\0"+ + "\12\3\167\0\11\3\166\0\12\3\166\0\12\3\166\0\12\3\340\0"+ + "\12\3\166\0\12\3\106\0\12\3\u0116\0\12\3\u031f\0\11\3\u046e\0"+ + "\12\3\46\0\12\3\u012c\0\12\3\ue5c0\0\12\3\346\0"; /** * Translates characters to character classes @@ -50,11 +54,11 @@ public class _MarkdownLexer implements FlexLexer { private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = - "\1\0\1\1\2\2\1\3\1\4\1\5\1\3\1\5"+ - "\1\4\12\0\1\6"; + "\1\0\1\1\2\2\1\3\1\4\1\5\1\4\1\5"+ + "\2\6\1\0\1\6\1\1\13\0\1\7"; private static int [] zzUnpackAction() { - int [] result = new int[21]; + int [] result = new int[26]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -79,12 +83,13 @@ public class _MarkdownLexer implements FlexLexer { private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); private static final String ZZ_ROWMAP_PACKED_0 = - "\0\0\0\15\0\32\0\47\0\15\0\64\0\47\0\47"+ - "\0\101\0\116\0\133\0\150\0\165\0\202\0\217\0\234"+ - "\0\251\0\266\0\303\0\320\0\47"; + "\0\0\0\14\0\30\0\44\0\60\0\74\0\110\0\124"+ + "\0\140\0\154\0\44\0\44\0\110\0\74\0\124\0\170"+ + "\0\204\0\220\0\234\0\250\0\264\0\300\0\314\0\330"+ + "\0\344\0\110"; private static int [] zzUnpackRowMap() { - int [] result = new int[21]; + int [] result = new int[26]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -107,16 +112,19 @@ public class _MarkdownLexer implements FlexLexer { private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\1\2\1\3\1\4\1\5\1\6\1\2\1\7\1\10"+ - "\1\11\4\6\1\2\2\0\3\2\3\0\4\2\2\0"+ - "\1\4\27\0\1\2\2\0\1\2\1\6\1\12\3\0"+ - "\4\6\11\0\1\13\3\0\1\2\2\0\1\2\1\12"+ - "\1\2\3\0\4\12\12\0\1\14\15\0\1\15\11\0"+ - "\1\16\20\0\1\17\13\0\1\20\12\0\1\21\13\0"+ - "\1\22\20\0\1\23\13\0\1\24\14\0\1\25\1\0"; + "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11"+ + "\4\5\1\2\2\0\2\2\3\0\4\2\1\0\1\12"+ + "\1\13\1\0\1\14\1\0\1\14\6\0\1\12\1\15"+ + "\1\0\1\14\1\0\1\14\5\0\1\2\2\0\1\5"+ + "\1\2\3\0\4\5\1\2\1\3\1\4\1\2\1\16"+ + "\1\0\1\17\1\0\4\2\15\0\1\3\1\4\1\0"+ + "\1\17\1\0\1\17\15\0\1\20\5\0\1\15\22\0"+ + "\1\21\14\0\1\22\10\0\1\23\17\0\1\24\12\0"+ + "\1\25\11\0\1\26\12\0\1\27\17\0\1\30\12\0"+ + "\1\31\13\0\1\32\1\0"; private static int [] zzUnpackTrans() { - int [] result = new int[221]; + int [] result = new int[240]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -157,10 +165,11 @@ public class _MarkdownLexer implements FlexLexer { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\1\0\2\1\1\11\2\1\2\11\2\1\12\0\1\11"; + "\1\0\5\1\1\11\4\1\1\0\1\11\1\1\13\0"+ + "\1\11"; private static int [] zzUnpackAttribute() { - int [] result = new int[21]; + int [] result = new int[26]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -245,7 +254,7 @@ public class _MarkdownLexer implements FlexLexer { char [] map = new char[0x10000]; int i = 0; /* index in packed string */ int j = 0; /* index in unpacked array */ - while (i < 80) { + while (i < 156) { int count = packed.charAt(i++); char value = packed.charAt(i++); do map[j++] = value; while (--count > 0); @@ -455,30 +464,34 @@ public class _MarkdownLexer implements FlexLexer { zzMarkedPos = zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { - case 4: + case 3: { return NUMBER; } - case 7: break; - case 5: - { return ANYCHAR; - } case 8: break; - case 2: - { return NEWLINE; + case 1: + { return WORD; } case 9: break; case 6: - { return BOM; + { return EOP; } case 10: break; - case 3: - { return SPACECHAR; + case 7: + { return BOM; } case 11: break; - case 1: - { return STRING; + case 2: + { return EOL; } case 12: break; + case 5: + { return SPECIAL; + } + case 13: break; + case 4: + { return SPACE; + } + case 14: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true; 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 |