Towards the unified {java command

This commit is contained in:
Bruce Eckel 2016-07-27 17:31:28 -06:00
parent e84910951c
commit 72a37051d3

View File

@ -25,9 +25,12 @@ class Tags {
mainMethod = block.contains('main(String[] args)') mainMethod = block.contains('main(String[] args)')
fileRoot = lines[0].split("/")[-1] - ".java" fileRoot = lines[0].split("/")[-1] - ".java"
mainClass = fileRoot mainClass = fileRoot
javaCmd = extract('main:') javaCmd = extract('java')
if(javaCmd) if(javaCmd) {
mainClass = javaCmd mainClass = javaCmd
println("fileRoot: " + fileRoot)
println("mainClass: " + mainClass)
}
compileTimeError = testFor('CompileTimeError') compileTimeError = testFor('CompileTimeError')
throwsException = testFor('ThrowsException') throwsException = testFor('ThrowsException')
errorOutputExpected = testFor('ErrorOutputExpected') errorOutputExpected = testFor('ErrorOutputExpected')
@ -58,6 +61,7 @@ class Tags {
if(tagline.getCount()) { if(tagline.getCount()) {
def rtrim = tagline[0].reverse().dropWhile{ it != '}'}.reverse()[0..-2] def rtrim = tagline[0].reverse().dropWhile{ it != '}'}.reverse()[0..-2]
def ltrim = rtrim - ("// {" + marker) def ltrim = rtrim - ("// {" + marker)
ltrim = ltrim.replaceAll("//", " ")
return ltrim.trim() return ltrim.trim()
} else { } else {
println "Searching for: " + re println "Searching for: " + re