2011-08-31 14:46:25 +00:00
|
|
|
import com.jdblabs.jlp.*
|
2011-08-25 22:08:55 +00:00
|
|
|
import org.parboiled.Parboiled
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
import org.parboiled.parserunners.*
|
2011-08-25 22:08:55 +00:00
|
|
|
|
2011-09-06 21:26:36 +00:00
|
|
|
"Making the standard parser."
|
|
|
|
"---------------------------"
|
2011-08-25 22:08:55 +00:00
|
|
|
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
jp = Parboiled.createParser(JLPPegParser.class)
|
|
|
|
ep = Parboiled.createParser(JLPPegParser, '%%')
|
|
|
|
jrpr = new ReportingParseRunner(jp.SourceFile())
|
|
|
|
jtpr = new TracingParseRunner(jp.SourceFile())
|
|
|
|
erpr = new ReportingParseRunner(ep.SourceFile())
|
|
|
|
etpr = new TracingParseRunner(ep.SourceFile())
|
2011-08-29 14:44:05 +00:00
|
|
|
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
vbsFile = new File('vbs_db_records.hrl')
|
|
|
|
javaFile = new File('Test.java')
|
|
|
|
docsDir = new File('jlp-docs')
|
|
|
|
docsDir.mkdirs()
|
|
|
|
|
|
|
|
simpleTest = { parseRunner ->
|
2011-09-06 21:26:36 +00:00
|
|
|
|
2011-09-02 21:47:46 +00:00
|
|
|
println "Parsing the simple test into 'result'."
|
|
|
|
println "--------------------------------------"
|
2011-08-29 14:44:05 +00:00
|
|
|
|
|
|
|
testLine = """%% This the first test line.
|
|
|
|
%% Second Line
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
Actual third line that screws stuff up.
|
2011-09-02 21:47:46 +00:00
|
|
|
%% Third Line \n\n Fifth line \n\n %% Seventh line \n\n
|
|
|
|
%% @author Eigth Line
|
|
|
|
%% @Example Ninth Line
|
|
|
|
%% Markdown lines (tenth line)
|
|
|
|
%% Still markdown (eleventh line)
|
|
|
|
Twelfth line is a code line"""
|
|
|
|
|
|
|
|
simpleResult = parseRunner.run(testLine)
|
2011-08-29 14:44:05 +00:00
|
|
|
}
|
|
|
|
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
vbsTest = { parseRunner ->
|
2011-08-31 14:46:25 +00:00
|
|
|
println "Parsing vbs_db_records.hrl into 'vbsResult'."
|
|
|
|
println "--------------------------------------------"
|
2011-08-29 14:44:05 +00:00
|
|
|
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
println "vbsFile is ${vbsFile.exists() ? 'present' : 'absent'}."
|
|
|
|
vbsTestInput = vbsFile.text
|
2011-08-29 14:44:05 +00:00
|
|
|
|
2011-08-31 14:46:25 +00:00
|
|
|
vbsParsed = parseRunner.run(vbsTestInput)
|
|
|
|
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
/*vbsResult = LiterateMarkdownGenerator.generateDocuments(["vbs_db_records.hrl": vbsParsed.resultValue])."vbs_db_records.hrl"
|
2011-09-06 21:13:21 +00:00
|
|
|
|
2011-09-06 21:26:36 +00:00
|
|
|
println "Writing to file 'vbs_db_records.html'."
|
|
|
|
println "--------------------------------------"
|
2011-09-06 21:13:21 +00:00
|
|
|
|
2011-09-06 21:26:36 +00:00
|
|
|
(new File('vbs_db_records.html')).withWriter { out -> out.println vbsResult }
|
2011-09-06 21:13:21 +00:00
|
|
|
|
Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
file.
* Added basic logic to the Processor class to detect source file types and build
a parser and a generator for that source type. Support currently exists for
the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
(.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-26 04:07:48 +00:00
|
|
|
return [vbsParsed, vbsResult]*/
|
|
|
|
return vbsParsed
|
|
|
|
}
|
|
|
|
|
|
|
|
javaTest = { parseRunner ->
|
|
|
|
println "Parsing Test.java into 'javaResult'."
|
|
|
|
println "------------------------------------"
|
|
|
|
|
|
|
|
println "javaFile is ${javaFile.exists() ? 'present' : 'absent'}."
|
|
|
|
javaTestInput = javaFile.text
|
|
|
|
|
|
|
|
javaParsed = parseRunner.run(javaTestInput)
|
|
|
|
javaSF = javaParsed.valueStack.peek()
|
|
|
|
|
|
|
|
return [javaParsed: javaParsed, javaSF: javaSF]
|
2011-09-06 21:13:21 +00:00
|
|
|
}
|