I'm try to parse MarkDown text with Antlr4. to make it easy I get to parse list view first.
And I found a webpage about it.
 http://www.cforcoding.com/2010/01/markdown-and-introduction-to-parsing.html
The grammer in that webpage seems ok to me, I change it to fit Antlr4 format like this:
grammar MarkDown;
listItem    : ORDERED inline NEWLINE
        | UNORDERED inline NEWLINE
        ;
inline      : (~ NEWLINE)+ ;
ORDERED     : DIGIT+ '.' (' ' | '\t')+ ;
UNORDERED   : ('*' | '-' | '+') (' ' | '\t')+ ;
DIGIT       : [0-9]+ ;
NEWLINE     : '\r'? '\n' ;
example file
1. abc
2. kljjkj
3. tree4545
But it not works, error messages below
line 1:3 token recognition error at: 'a'
line 1:4 token recognition error at: 'b'
line 1:5 token recognition error at: 'c'
line 1:6 extraneous input '\r\n' expecting {ORDERED, UNORDERED, DIGIT}
line 2:3 token recognition error at: 'k'
line 2:4 token recognition error at: 'l'
line 2:5 token recognition error at: 'j'
line 2:6 token recognition error at: 'j'
line 2:7 token recognition error at: 'k'
line 2:8 token recognition error at: 'j'
(listItem 1.  (inline \r\n 2. ) \r\n)
Could you help me fix this?
 
     
    