jlp/resources/main/test.groovy
Jonathan Bernard 557feaeb83 Worked on documentation, parser.
* Added planning documentation regrding the process.
* Updated grammer.
* Refactored the test code a bit.
* Added sample input file from vbs-suite
* Refactored the AST node structure created by the parser.
2011-08-29 09:44:05 -05:00

40 lines
1.1 KiB
Groovy

import com.jdblabs.jlp.EchoEmitter
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())
simpleTest = {
"Parsing the simple test into 'result'.\n" +
"--------------------------------------\n"
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
"""
parseRunner.run(testLine)
}
vbsTest = {
"Parsing vbs_db_records.hrl into 'vbsResult'."
"--------------------------------------------\n"
vbsTestFile = new File('vbs_db_records.hrl')
println "vbsTestFile is ${vbsTestFile.exists() ? 'present' : 'absent'}."
vbsTestInput = vbsTestFile.text
parseRunner.run(vbsTestInput)
}