diff options
| author | Philipp A | 2018-11-15 22:18:44 +0100 |
|---|---|---|
| committer | Philipp A | 2018-11-15 22:18:44 +0100 |
| commit | 2c04f8adcbe467e06fb5559dbcd125246f8ab49e (patch) | |
| tree | 583e5eaae9c55710292d6a1d5561cdd5aa968da2 /src | |
| parent | 48264e771d093d10e09bfc4b42783efc03ffb26c (diff) | |
| download | rust-rst-2c04f8adcbe467e06fb5559dbcd125246f8ab49e.tar.bz2 | |
we don’t use manual tokens
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser/token.rs | 56 |
1 files changed, 5 insertions, 51 deletions
diff --git a/src/parser/token.rs b/src/parser/token.rs index d3b727b..b3b7bac 100644 --- a/src/parser/token.rs +++ b/src/parser/token.rs @@ -1,62 +1,16 @@ -// rST does indentation for lists by using the column after the list item -// i’ll represent it as BulletList → Indent. e.g.: -// -//1. * foo -// * bar -// -// becomes: -// -//EnumList(Arabic, Period) → Indent(3) -// → BulletList(Asterisk) → Indent(2) -// → Line("foo") -// → Dedent(2) -// → BulletList(Asterisk) → Indent(2) -// → Line("bar") -//→ Dedent(5) - //http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#bullet-lists +// *, +, -, •, ‣, ⁃ pub enum BulletListType { Ast, Plus, Minus, Bullet, TriBullet, HyphenBullet } +// 1, A, a, I, i pub enum EnumListChar { Arabic, AlphaUpper, AlphaLower, RomanUpper, RomanLower, Auto } +// 1., (1), 1) pub enum EnumListType { Period, ParenEnclosed, Paren } +// ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ pub enum AdornmentChar { Bang, DQuote, Hash, Dollar, Percent, Amp, SQuote, LParen, RParen, Ast, Plus, Comma, Minus, Period, Slash, Colon, Semicolon, Less, Eq, More, Question, At, LBrack, Backslash, RBrack, Caret, Underscore, Backtick, LBrace, Pipe, RBrace, Tilde, } +// [1], [#], [*], [#foo] pub enum FootnoteType { Numbered(usize), AutoNumber, AutoSymbol, AutoNamed(String) } - -pub enum TokenBlockLevel { - EmptyLine, - Indent(u8), // plain indents mean blockquotes - Dedent(u8), - Line(String), - - Adornment(AdornmentChar, u32), // ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ - // for a transition, this must be surrounded by blank lines, and be of length ≥ 4 - - ListBulletItem(BulletListType), // *, +, -, •, ‣, ⁃ - ListEnumItem(EnumListChar, EnumListType), // 1, A, a, I, i; 1., (1), 1) - ListDefinitionTerm(String, Option<String>), //term and classifiers - ListFieldName(String), - ListOption(String), - ListOptionArg(String), - - BlockLiteral, - BlockQuotedLiteral(AdornmentChar), - // line blocks use pipes (|) - BlockDoctest(String), - - GridTableLine(String), - GridTableRow(String), - SimpleTableLine(String), - - Footnote(FootnoteType), // [1], [#], [*], [#foo] - Citation(String), - Directive(String, String), // name and args - SubstitutionDef(String, String), // symbol and substitited line TODO: maybe only the former? - Comment, - CommentEmpty, // if not followed by anything, “..” is special - Target(String, String), - TargetAnonymous(String), -} |
