c275fd0ce1
* Rewrote grammar slightly. * Added parboiled parse section to JLPMain. * Added code to build the AST while parsing. * Created ASTNode classes.
22 lines
572 B
Groovy
22 lines
572 B
Groovy
import com.jdblabs.jlp.JLPPegParser
|
|
import org.parboiled.Parboiled
|
|
import org.parboiled.parserunners.ReportingParseRunner
|
|
import org.parboiled.parserunners.RecoveringParseRunner
|
|
|
|
parser = Parboiled.createParser(JLPPegParser.class)
|
|
parseRunner = new RecoveringParseRunner(parser.SourceFile())
|
|
|
|
testLine = """%% This the first test line.
|
|
%% Second Line
|
|
%% Third Line
|
|
Fourth line
|
|
%% Fifth line
|
|
%% @author Sixth Line
|
|
%% @Example Seventh Line
|
|
%% Markdown lines (eigth line)
|
|
%% Still markdown (ninth line)
|
|
Tenth line is a code line
|
|
"""
|
|
|
|
result = parseRunner.run(testLine)
|