diff options
| author | Philipp A | 2016-06-19 18:06:55 +0200 | 
|---|---|---|
| committer | Philipp A | 2016-06-19 18:06:55 +0200 | 
| commit | a53ddfe2c6c6736348b78565a8334c1b217e128f (patch) | |
| tree | f0c31ad2c595623f691f63464e5a579f8a63abcb /src/parser | |
| parent | 087afdbd9b439a5fd37965b71df99038b28b7872 (diff) | |
| download | rust-rst-a53ddfe2c6c6736348b78565a8334c1b217e128f.tar.bz2 | |
some cleanups, parser module files (empty)
Diffstat (limited to 'src/parser')
| -rw-r--r-- | src/parser/mod.rs | 1 | ||||
| -rw-r--r-- | src/parser/token.rs | 62 | 
2 files changed, 63 insertions, 0 deletions
diff --git a/src/parser/mod.rs b/src/parser/mod.rs new file mode 100644 index 0000000..79c66ba --- /dev/null +++ b/src/parser/mod.rs @@ -0,0 +1 @@ +pub mod token; diff --git a/src/parser/token.rs b/src/parser/token.rs new file mode 100644 index 0000000..8c3a445 --- /dev/null +++ b/src/parser/token.rs @@ -0,0 +1,62 @@ +// 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 + +enum BulletListType { Ast, Plus, Minus, Bullet, TriBullet, HyphenBullet } +enum EnumListChar { Arabic, AlphaUpper, AlphaLower, RomanUpper, RomanLower, Auto } +enum EnumListType { Period, ParenEnclosed, Paren } +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, +} +enum FootnoteType { Numbered(usize), AutoNumber, AutoSymbol, AutoNamed(String) } + +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), +}  | 
