update to Gradle 4.6
This commit is contained in:
parent
6856d2116b
commit
65daa8cce0
44 changed files with 337 additions and 424 deletions
11
.travis.yml
11
.travis.yml
|
@ -1,12 +1,3 @@
|
|||
language: java
|
||||
sudo: required
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
after_success:
|
||||
- ./gradlew sonarqube -Dsonar.host.url=https://sonarqube.com -Dsonar.login=$SONAR_TOKEN
|
||||
env:
|
||||
global:
|
||||
secure: n1Ai4q/yMLn/Pg5pA4lTavoJoe7mQYB1PSKnZAqwbgyla94ySzK6iyBCBiNs/foMPisB/x+DHvmUXTsjvquw9Ay48ZITCV3xhcWzD0eZM2TMoG19CpRAEe8L8LNuYiti9k89ijDdUGZ5ifsvQNTGNHksouayAuApC3PrTUejJfR6SYrp1ZsQTbsMlr+4XU3p7QknK5rGgOwATIMP28F+bVnB05WJtlJA3b0SeucCurn3wJ4FGBQXRYmdlT7bQhNE4QgZM1VzcUFD/K0TBxzzq/otb/lNRSifyoekktDmJwQnaT9uQ4R8R6KdQ2Kb38Rvgjur+TKm5i1G8qS2+6LnIxQJG1aw3JvKK6W0wWCgnAVVRrXaCLday9NuY59tuh1mfjQ10UcsMNKcTdcKEMrLow506wSETcXc7L/LEnneWQyJJeV4vhPqR7KJfsBbeqgz3yIfsCn1GZVWFlfegzYCN52YTl0Y0uRD2Z+TnzQu+Bf4DzaWXLge1rz31xkhyeNNspub4h024+XqBjcMm6M9mlMzmmK8t2DIwPy/BlQbFBUyhrxziuR/5/2NEDPyHltvWkRb4AUIa25WJqkV0gTBegbMadZ9DyOo6Ea7aoVFBae2WGR08F1kzABsWrd1S7UJmWxW35iyMEtoAIayXphIK98qO5aCutwZ+3iOQazxbAs=
|
||||
- openjdk11
|
||||
|
|
35
build.gradle
35
build.gradle
|
@ -1,6 +1,3 @@
|
|||
plugins {
|
||||
id "org.sonarqube" version '2.2'
|
||||
}
|
||||
|
||||
ext {
|
||||
user = 'xbib'
|
||||
|
@ -11,45 +8,19 @@ ext {
|
|||
scmDeveloperConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'
|
||||
}
|
||||
|
||||
group = 'org.xbib'
|
||||
version = '2.1.0'
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
apply plugin: 'findbugs'
|
||||
apply plugin: 'pmd'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
apply plugin: 'java-library'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations {
|
||||
wagon
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile 'junit:junit:4.12'
|
||||
wagon 'org.apache.maven.wagon:wagon-ssh-external:2.10'
|
||||
}
|
||||
|
||||
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << "-Xlint:all" << "-profile" << "compact1"
|
||||
testImplementation "junit:junit:${project.property('junit.version')}"
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging {
|
||||
showStandardStreams = false
|
||||
showStandardStreams = true
|
||||
exceptionFormat = 'full'
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'gradle/publish.gradle'
|
||||
apply from: 'gradle/sonarqube.gradle'
|
||||
|
|
5
gradle.properties
Normal file
5
gradle.properties
Normal file
|
@ -0,0 +1,5 @@
|
|||
group = org.xbib
|
||||
name = jacc
|
||||
version = 2.2.0
|
||||
|
||||
junit.version = 4.13
|
|
@ -1,19 +1,4 @@
|
|||
|
||||
task xbibUpload(type: Upload) {
|
||||
configuration = configurations.archives
|
||||
uploadDescriptor = true
|
||||
repositories {
|
||||
if (project.hasProperty("xbibUsername")) {
|
||||
mavenDeployer {
|
||||
configuration = configurations.wagon
|
||||
repository(url: 'scpexe://xbib.org/repository') {
|
||||
authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sonaTypeUpload(type: Upload) {
|
||||
configuration = configurations.archives
|
||||
uploadDescriptor = true
|
||||
|
@ -28,10 +13,13 @@ task sonaTypeUpload(type: Upload) {
|
|||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
pom.project {
|
||||
name name
|
||||
groupId project.group
|
||||
artifactId project.name
|
||||
version project.version
|
||||
name project.name
|
||||
description description
|
||||
packaging 'jar'
|
||||
inceptionYear '2012'
|
||||
inceptionYear '2016'
|
||||
url scmUrl
|
||||
organization {
|
||||
name 'xbib'
|
||||
|
@ -61,52 +49,3 @@ task sonaTypeUpload(type: Upload) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task hbzUpload(type: Upload) {
|
||||
configuration = configurations.archives
|
||||
uploadDescriptor = true
|
||||
repositories {
|
||||
if (project.hasProperty('hbzUserName')) {
|
||||
mavenDeployer {
|
||||
configuration = configurations.wagon
|
||||
beforeDeployment { MavenDeployment deployment ->
|
||||
signing.signPom(deployment)
|
||||
}
|
||||
repository(url: uri(hbzUrl)) {
|
||||
authentication(userName: hbzUserName, privateKey: hbzPrivateKey)
|
||||
}
|
||||
pom.project {
|
||||
name name
|
||||
description description
|
||||
packaging 'jar'
|
||||
inceptionYear '2012'
|
||||
url scmUrl
|
||||
organization {
|
||||
name 'xbib'
|
||||
url 'http://xbib.org'
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'jprante'
|
||||
name 'Jörg Prante'
|
||||
email 'joergprante@gmail.com'
|
||||
url 'https://github.com/jprante'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url scmUrl
|
||||
connection scmConnection
|
||||
developerConnection scmDeveloperConnection
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name 'BSD 3-Clause License'
|
||||
url 'https://opensource.org/licenses/BSD-3-Clause'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
tasks.withType(Checkstyle) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.enabled = true
|
||||
html.enabled = true
|
||||
}
|
||||
}
|
||||
tasks.withType(Pmd) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.enabled = true
|
||||
html.enabled = true
|
||||
}
|
||||
}
|
||||
tasks.withType(FindBugs) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.enabled = true
|
||||
html.enabled = false
|
||||
}
|
||||
}
|
||||
jacocoTestReport {
|
||||
reports {
|
||||
xml.enabled true
|
||||
csv.enabled false
|
||||
xml.destination "${buildDir}/reports/jacoco-xml"
|
||||
html.destination "${buildDir}/reports/jacoco-html"
|
||||
}
|
||||
}
|
||||
|
||||
sonarqube {
|
||||
properties {
|
||||
property "sonar.projectName", "${project.group} ${project.name}"
|
||||
property "sonar.sourceEncoding", "UTF-8"
|
||||
property "sonar.language", "java"
|
||||
property "sonar.sources", "src/main/java"
|
||||
property "sonar.tests", "src/test/java"
|
||||
property "sonar.scm.provider", "git"
|
||||
property "sonar.java.coveragePlugin", "jacoco"
|
||||
property "sonar.junit.reportsPath", "build/test-results/test/"
|
||||
}
|
||||
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,5 @@
|
|||
#Sat Oct 22 21:01:39 CEST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
|
||||
|
|
45
gradlew
vendored
45
gradlew
vendored
|
@ -1,4 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
|
@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
|||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
|
@ -109,8 +125,8 @@ if $darwin; then
|
|||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
@ -154,16 +170,19 @@ if $cygwin ; then
|
|||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
|
@ -1,3 +1,19 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
|
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
|||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
|
|
@ -5,8 +5,10 @@ import org.xbib.jacc.compiler.ConsoleHandler;
|
|||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
|
@ -14,25 +16,34 @@ import java.nio.file.Paths;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Jacc {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Jacc.class.getName());
|
||||
|
||||
private final String suffix;
|
||||
|
||||
private final JaccSettings jaccSettings;
|
||||
|
||||
private String className;
|
||||
|
||||
private InputStream inputStream;
|
||||
private InputStream errorDiagnostics;
|
||||
private InputStream parserInputs;
|
||||
|
||||
private Reader errorDiagnostics;
|
||||
|
||||
private Reader parserInputs;
|
||||
|
||||
private OutputStream outputStream;
|
||||
private String suffix;
|
||||
private JaccSettings jaccSettings;
|
||||
|
||||
private boolean enableParserOutput;
|
||||
|
||||
private boolean enableTokenOutput;
|
||||
|
||||
private boolean enableVerboseMachineDescription;
|
||||
|
||||
private boolean includeCalculations;
|
||||
|
||||
private boolean includeStateNumbers;
|
||||
|
||||
private String dir;
|
||||
|
||||
public Jacc() {
|
||||
|
@ -87,19 +98,19 @@ public class Jacc {
|
|||
return inputStream;
|
||||
}
|
||||
|
||||
public void setErrorDiagnostics(InputStream errorDiagnostics) {
|
||||
public void setErrorDiagnostics(Reader errorDiagnostics) {
|
||||
this.errorDiagnostics = errorDiagnostics;
|
||||
}
|
||||
|
||||
public InputStream getErrorDiagnostics() {
|
||||
public Reader getErrorDiagnostics() {
|
||||
return errorDiagnostics;
|
||||
}
|
||||
|
||||
public void setParserInputs(InputStream parserInputs) {
|
||||
public void setParserInputs(Reader parserInputs) {
|
||||
this.parserInputs = parserInputs;
|
||||
}
|
||||
|
||||
public InputStream getParserInputs() {
|
||||
public Reader getParserInputs() {
|
||||
return parserInputs;
|
||||
}
|
||||
|
||||
|
@ -154,13 +165,13 @@ public class Jacc {
|
|||
if (i + 1 >= args.length) {
|
||||
usage("Missing filename for -e option");
|
||||
}
|
||||
jacc.setErrorDiagnostics(Files.newInputStream(Paths.get(args[++i])));
|
||||
jacc.setErrorDiagnostics(Files.newBufferedReader(Paths.get(args[++i])));
|
||||
break;
|
||||
case 'r':
|
||||
if (i + 1 >= args.length) {
|
||||
usage("Missing filename for -r option");
|
||||
}
|
||||
jacc.setParserInputs(Files.newInputStream(Paths.get(args[++i])));
|
||||
jacc.setParserInputs(Files.newBufferedReader(Paths.get(args[++i])));
|
||||
break;
|
||||
case 'd':
|
||||
if (i + 1 >= args.length) {
|
||||
|
@ -180,9 +191,8 @@ public class Jacc {
|
|||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if (!arg.endsWith(jacc.getSuffix())) {
|
||||
usage("Input file must have \"" + jacc.getSuffix() + "\" suffix");
|
||||
} else if (!arg.endsWith(jacc.getSuffix())) {
|
||||
usage("Input file must have \"" + jacc.getSuffix() + "\" suffix: " + arg);
|
||||
} else {
|
||||
jacc.setInputStream(Files.newInputStream(Paths.get(arg)));
|
||||
}
|
||||
|
@ -195,38 +205,41 @@ public class Jacc {
|
|||
}
|
||||
|
||||
public void execute() throws IOException {
|
||||
Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
|
||||
ConsoleHandler consoleHandler = new ConsoleHandler();
|
||||
if (dir == null) {
|
||||
dir = ".";
|
||||
}
|
||||
if (!dir.endsWith("/")) {
|
||||
dir = dir + "/";
|
||||
}
|
||||
final JaccJob job = new JaccJob(consoleHandler, writer, jaccSettings);
|
||||
job.parseGrammarStream(inputStream);
|
||||
job.buildTables();
|
||||
jaccSettings.fillBlanks(className);
|
||||
if (errorDiagnostics != null) {
|
||||
job.readErrorExamples(errorDiagnostics);
|
||||
}
|
||||
if (consoleHandler.getNumFailures() == 0) {
|
||||
if (enableParserOutput) {
|
||||
(new ParserOutput(consoleHandler, job)).write(dir + jaccSettings.getClassName() + ".java");
|
||||
try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8))) {
|
||||
ConsoleHandler consoleHandler = new ConsoleHandler();
|
||||
if (dir == null) {
|
||||
dir = ".";
|
||||
}
|
||||
if (enableTokenOutput) {
|
||||
(new TokensOutput(consoleHandler, job)).write(dir + jaccSettings.getInterfaceName() + ".java");
|
||||
if (!dir.endsWith("/")) {
|
||||
dir = dir + "/";
|
||||
}
|
||||
if (enableVerboseMachineDescription) {
|
||||
(new TextOutput(consoleHandler, job, includeCalculations)).write(dir + jaccSettings.getClassName() + ".output");
|
||||
final JaccJob job = new JaccJob(consoleHandler, writer, jaccSettings);
|
||||
job.parseGrammarStream(reader);
|
||||
job.buildTables();
|
||||
jaccSettings.fillBlanks(className);
|
||||
if (errorDiagnostics != null) {
|
||||
job.readErrorExamples(errorDiagnostics);
|
||||
errorDiagnostics.close();
|
||||
}
|
||||
if (parserInputs != null) {
|
||||
job.readRunExample(parserInputs, includeStateNumbers);
|
||||
if (consoleHandler.getNumFailures() == 0) {
|
||||
if (enableParserOutput) {
|
||||
(new ParserOutput(consoleHandler, job)).write(dir + jaccSettings.getClassName() + ".java");
|
||||
}
|
||||
if (enableTokenOutput) {
|
||||
(new TokensOutput(consoleHandler, job)).write(dir + jaccSettings.getInterfaceName() + ".java");
|
||||
}
|
||||
if (enableVerboseMachineDescription) {
|
||||
(new TextOutput(consoleHandler, job, includeCalculations)).write(dir + jaccSettings.getClassName() + ".output");
|
||||
}
|
||||
if (parserInputs != null) {
|
||||
job.readRunExample(parserInputs, includeStateNumbers);
|
||||
parserInputs.close();
|
||||
}
|
||||
} else {
|
||||
writer.write("There were failures.\n");
|
||||
}
|
||||
} else {
|
||||
writer.write("There were failures.\n");
|
||||
}
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private static void usage(String s) {
|
||||
|
|
|
@ -11,32 +11,28 @@ import org.xbib.jacc.grammar.Grammar;
|
|||
import org.xbib.jacc.grammar.LookaheadMachine;
|
||||
import org.xbib.jacc.grammar.Parser;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JaccJob extends Phase {
|
||||
|
||||
private JaccSettings jaccSettings;
|
||||
private final JaccSettings jaccSettings;
|
||||
|
||||
private JaccParser parser;
|
||||
private final JaccParser parser;
|
||||
|
||||
private final Writer writer;
|
||||
|
||||
private JaccTables tables;
|
||||
|
||||
private JaccResolver resolver;
|
||||
|
||||
private Writer out;
|
||||
|
||||
JaccJob(Handler handler, Writer out, JaccSettings jaccSettings) {
|
||||
JaccJob(Handler handler, Writer writer, JaccSettings jaccSettings) {
|
||||
super(handler);
|
||||
this.out = out;
|
||||
this.writer = writer;
|
||||
this.jaccSettings = jaccSettings;
|
||||
this.parser = new JaccParser(handler, jaccSettings);
|
||||
}
|
||||
|
@ -53,62 +49,24 @@ class JaccJob extends Phase {
|
|||
return resolver;
|
||||
}
|
||||
|
||||
void parseGrammarStream(InputStream inputStream) throws IOException {
|
||||
JaccLexer jacclexer = lexerFromInputStream(inputStream);
|
||||
if (jacclexer != null) {
|
||||
void parseGrammarStream(Reader reader) throws IOException {
|
||||
try (Reader reader1 = reader; JaccLexer jacclexer = new JaccLexer(getHandler(), new JavaSource(getHandler(), reader1))) {
|
||||
jacclexer.nextToken();
|
||||
parser.parse(jacclexer);
|
||||
jacclexer.close();
|
||||
}
|
||||
}
|
||||
|
||||
private JaccLexer lexerFromFile(String s) throws IOException {
|
||||
JaccLexer jacclexer;
|
||||
Reader filereader = new InputStreamReader(new FileInputStream(s), StandardCharsets.UTF_8);
|
||||
jacclexer = new JaccLexer(getHandler(), new JavaSource(getHandler(), filereader));
|
||||
jacclexer.nextToken();
|
||||
return jacclexer;
|
||||
}
|
||||
|
||||
private JaccLexer lexerFromInputStream(InputStream inputStream) throws IOException {
|
||||
JaccLexer jacclexer;
|
||||
Reader filereader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
jacclexer = new JaccLexer(getHandler(), new JavaSource(getHandler(), filereader));
|
||||
jacclexer.nextToken();
|
||||
return jacclexer;
|
||||
}
|
||||
|
||||
void readErrorExamples(String s) throws IOException {
|
||||
out.write("Reading error examples from \"" + s + "\"");
|
||||
JaccLexer jacclexer = lexerFromFile(s);
|
||||
if (jacclexer != null) {
|
||||
void readErrorExamples(Reader reader) throws IOException {
|
||||
try (Reader reader1 = reader; JaccLexer jacclexer = new JaccLexer(getHandler(), new JavaSource(getHandler(), reader1))) {
|
||||
jacclexer.nextToken();
|
||||
parser.parseErrorExamples(jacclexer, this);
|
||||
jacclexer.close();
|
||||
}
|
||||
}
|
||||
|
||||
void readErrorExamples(InputStream inputStream) throws IOException {
|
||||
JaccLexer jacclexer = lexerFromInputStream(inputStream);
|
||||
if (jacclexer != null) {
|
||||
parser.parseErrorExamples(jacclexer, this);
|
||||
jacclexer.close();
|
||||
}
|
||||
}
|
||||
|
||||
void readRunExample(String s, boolean flag) throws IOException {
|
||||
out.write("Running example from \"" + s + "\"]\n");
|
||||
JaccLexer jacclexer = lexerFromFile(s);
|
||||
if (jacclexer != null) {
|
||||
void readRunExample(Reader reader, boolean flag) throws IOException {
|
||||
try (Reader reader1 = reader; JaccLexer jacclexer = new JaccLexer(getHandler(), new JavaSource(getHandler(), reader1))) {
|
||||
jacclexer.nextToken();
|
||||
runExample(parser.parseSymbols(jacclexer), flag);
|
||||
jacclexer.close();
|
||||
}
|
||||
}
|
||||
|
||||
void readRunExample(InputStream inputStream, boolean flag) throws IOException {
|
||||
out.write("Running example from input stream\n");
|
||||
JaccLexer jacclexer = lexerFromInputStream(inputStream);
|
||||
if (jacclexer != null) {
|
||||
runExample(parser.parseSymbols(jacclexer), flag);
|
||||
jacclexer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,28 +106,28 @@ class JaccJob extends Phase {
|
|||
private void runExample(int[] ai, boolean flag) throws IOException {
|
||||
Grammar grammar = parser.getGrammar();
|
||||
Parser parser1 = new Parser(tables, ai);
|
||||
out.write("start ");
|
||||
writer.write("start ");
|
||||
do {
|
||||
out.write(" : ");
|
||||
parser1.display(out, flag);
|
||||
writer.write(" : ");
|
||||
parser1.display(writer, flag);
|
||||
switch (parser1.step()) {
|
||||
case 0:
|
||||
out.write("Accept!\n");
|
||||
writer.write("Accept!\n");
|
||||
return;
|
||||
case 1:
|
||||
out.write("error in state ");
|
||||
out.write(parser1.getState());
|
||||
out.write(", next symbol ");
|
||||
out.write(grammar.getSymbol(parser1.getNextSymbol()).toString());
|
||||
writer.write("error in state ");
|
||||
writer.write(parser1.getState());
|
||||
writer.write(", next symbol ");
|
||||
writer.write(grammar.getSymbol(parser1.getNextSymbol()).toString());
|
||||
return;
|
||||
case 3:
|
||||
out.write("goto ");
|
||||
writer.write("goto ");
|
||||
break;
|
||||
case 2:
|
||||
out.write("shift ");
|
||||
writer.write("shift ");
|
||||
break;
|
||||
case 4:
|
||||
out.write("reduce");
|
||||
writer.write("reduce");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -8,9 +8,6 @@ import org.xbib.jacc.compiler.Warning;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JaccLexer extends SourceLexer implements JaccTokens {
|
||||
|
||||
private int lastLiteral;
|
||||
|
@ -285,7 +282,7 @@ class JaccLexer extends SourceLexer implements JaccTokens {
|
|||
}
|
||||
sb.append('\n');
|
||||
if (line != null) {
|
||||
sb.append(line.substring(0, j));
|
||||
sb.append(line, 0, j);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -3,15 +3,15 @@ package org.xbib.jacc;
|
|||
import org.xbib.jacc.compiler.Position;
|
||||
import org.xbib.jacc.grammar.Grammar;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JaccProd extends Grammar.Prod {
|
||||
|
||||
private Fixity fixity;
|
||||
private JaccSymbol[] prodSyms;
|
||||
private Position actPos;
|
||||
private String action;
|
||||
private final Fixity fixity;
|
||||
|
||||
private final JaccSymbol[] prodSyms;
|
||||
|
||||
private final Position actPos;
|
||||
|
||||
private final String action;
|
||||
|
||||
JaccProd(Fixity fixity, JaccSymbol[] jaccsymbol, Position position, String s, int i) {
|
||||
super(new int[jaccsymbol.length], i);
|
||||
|
|
|
@ -7,15 +7,15 @@ import org.xbib.jacc.grammar.Resolver;
|
|||
import org.xbib.jacc.grammar.Tables;
|
||||
import org.xbib.jacc.util.IntSet;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JaccResolver implements Resolver {
|
||||
|
||||
private LookaheadMachine machine;
|
||||
private final LookaheadMachine machine;
|
||||
|
||||
private int numSRConflicts;
|
||||
|
||||
private int numRRConflicts;
|
||||
private Conflicts[] conflicts;
|
||||
|
||||
private final Conflicts[] conflicts;
|
||||
|
||||
JaccResolver(LookaheadMachine lookaheadmachine) {
|
||||
numSRConflicts = 0;
|
||||
|
|
|
@ -6,23 +6,31 @@ import org.xbib.jacc.grammar.LR0Machine;
|
|||
import org.xbib.jacc.grammar.LookaheadMachine;
|
||||
import org.xbib.jacc.grammar.SLRMachine;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JaccSettings {
|
||||
|
||||
private MachineType machineType;
|
||||
|
||||
private String packageName;
|
||||
|
||||
private String className;
|
||||
|
||||
private String interfaceName;
|
||||
|
||||
private String extendsName;
|
||||
|
||||
private String implementsNames;
|
||||
|
||||
private String typeName;
|
||||
|
||||
private String getToken;
|
||||
|
||||
private String nextToken;
|
||||
|
||||
private String getSemantic;
|
||||
private StringBuilder preTextBuffer;
|
||||
private StringBuilder postTextBuffer;
|
||||
|
||||
private final StringBuilder preTextBuffer;
|
||||
|
||||
private final StringBuilder postTextBuffer;
|
||||
|
||||
JaccSettings() {
|
||||
this.machineType = MachineType.LALR1;
|
||||
|
|
|
@ -2,16 +2,18 @@ package org.xbib.jacc;
|
|||
|
||||
import org.xbib.jacc.grammar.Grammar;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JaccSymbol extends Grammar.Symbol {
|
||||
|
||||
private int num;
|
||||
|
||||
private int tokenNo;
|
||||
|
||||
private JaccProd[] jaccProds;
|
||||
|
||||
private int pused;
|
||||
|
||||
private Fixity fixity;
|
||||
|
||||
private String type;
|
||||
|
||||
JaccSymbol(String s, int i) {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.xbib.jacc;
|
||||
|
||||
abstract class JaccSymbols {
|
||||
|
||||
Node root;
|
||||
|
||||
int size;
|
||||
|
||||
JaccSymbols() {
|
||||
|
@ -33,7 +35,9 @@ abstract class JaccSymbols {
|
|||
static class Node {
|
||||
|
||||
Node left;
|
||||
|
||||
JaccSymbol data;
|
||||
|
||||
Node right;
|
||||
|
||||
Node(JaccSymbol data) {
|
||||
|
|
|
@ -13,8 +13,11 @@ import java.io.Writer;
|
|||
class JaccTables extends Tables {
|
||||
|
||||
private String[] errors;
|
||||
|
||||
private int numErrors;
|
||||
|
||||
private int[][] index;
|
||||
|
||||
private int[] defaultRow;
|
||||
|
||||
JaccTables(LookaheadMachine lookaheadmachine, Resolver resolver) {
|
||||
|
|
|
@ -1,36 +1,68 @@
|
|||
package org.xbib.jacc;
|
||||
|
||||
interface JaccTokens {
|
||||
|
||||
int ERROR = -1;
|
||||
|
||||
int ENDINPUT = 0;
|
||||
|
||||
int MARK = 1;
|
||||
|
||||
int CODE = 2;
|
||||
|
||||
int IDENT = 3;
|
||||
|
||||
int CHARLIT = 4;
|
||||
|
||||
int STRLIT = 5;
|
||||
|
||||
int INTLIT = 6;
|
||||
|
||||
int ACTION = 7;
|
||||
|
||||
int TOKEN = 8;
|
||||
|
||||
int TYPE = 9;
|
||||
|
||||
int PREC = 10;
|
||||
|
||||
int LEFT = 11;
|
||||
|
||||
int RIGHT = 12;
|
||||
|
||||
int NONASSOC = 13;
|
||||
|
||||
int START = 14;
|
||||
|
||||
int PACKAGE = 15;
|
||||
|
||||
int CLASS = 16;
|
||||
|
||||
int INTERFACE = 17;
|
||||
|
||||
int EXTENDS = 18;
|
||||
|
||||
int IMPLEMENTS = 19;
|
||||
|
||||
int SEMANTIC = 20;
|
||||
|
||||
int GETTOKEN = 21;
|
||||
|
||||
int NEXTTOKEN = 22;
|
||||
|
||||
int COLON = 58;
|
||||
|
||||
int SEMI = 59;
|
||||
|
||||
int BAR = 124;
|
||||
|
||||
int TOPEN = 60;
|
||||
|
||||
int TCLOSE = 62;
|
||||
|
||||
int BOPEN = 91;
|
||||
|
||||
int BCLOSE = 93;
|
||||
|
||||
int DOT = 46;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.xbib.jacc;
|
||||
|
||||
/**
|
||||
*/
|
||||
public enum MachineType {
|
||||
|
||||
LR0, SLR1, LALR1
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.xbib.jacc;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class NamedJaccSymbols extends JaccSymbols {
|
||||
|
||||
JaccSymbol find(String s) {
|
||||
|
|
|
@ -7,23 +7,32 @@ import org.xbib.jacc.grammar.Grammar;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ParserOutput extends AbstractOutput {
|
||||
|
||||
private int yyaccept;
|
||||
|
||||
private int yyabort;
|
||||
|
||||
private int stackOverflow;
|
||||
|
||||
private int errorHandler;
|
||||
|
||||
private int userErrorHandler;
|
||||
|
||||
private int[] stNumSwitches;
|
||||
|
||||
private int[][] ntGoto;
|
||||
|
||||
private int[][] ntGotoSrc;
|
||||
|
||||
private int[] ntDefault;
|
||||
|
||||
private int[] ntDistinct;
|
||||
|
||||
private int errTok;
|
||||
|
||||
private boolean errMsgs;
|
||||
|
||||
private boolean errUsed;
|
||||
|
||||
ParserOutput(Handler handler, JaccJob jaccjob) {
|
||||
|
|
|
@ -6,9 +6,6 @@ import org.xbib.jacc.util.IntSet;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class TextOutput extends AbstractOutput {
|
||||
|
||||
private boolean wantFirst;
|
||||
|
|
|
@ -6,9 +6,6 @@ import org.xbib.jacc.grammar.Grammar;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class TokensOutput extends AbstractOutput {
|
||||
|
||||
TokensOutput(Handler handler, JaccJob jaccjob) {
|
||||
|
|
|
@ -2,9 +2,6 @@ package org.xbib.jacc.compiler;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class Lexer extends Phase {
|
||||
|
||||
protected int token;
|
||||
|
@ -35,6 +32,4 @@ public abstract class Lexer extends Phase {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void close() throws IOException;
|
||||
}
|
||||
|
|
|
@ -2,16 +2,17 @@ package org.xbib.jacc.compiler;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class SourceLexer extends Lexer {
|
||||
public abstract class SourceLexer extends Lexer implements AutoCloseable {
|
||||
|
||||
protected String line;
|
||||
|
||||
protected int col;
|
||||
|
||||
protected int c;
|
||||
|
||||
private Source source;
|
||||
private SourcePosition pos;
|
||||
|
||||
private final SourcePosition pos;
|
||||
|
||||
public SourceLexer(Handler handler, Source source) throws IOException {
|
||||
super(handler);
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
package org.xbib.jacc;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xbib.jacc.helper.StreamMatcher;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class JaccTest {
|
||||
|
||||
@Test
|
||||
public void calc() throws IOException {
|
||||
Jacc jacc = new Jacc();
|
||||
jacc.setName("Calc");
|
||||
jacc.setInputStream(getResource("Calc.jacc"));
|
||||
jacc.setErrorDiagnostics(getResource("Calc.errs"));
|
||||
jacc.setDir("build/");
|
||||
jacc.setEnableVerboseMachineDescription(true);
|
||||
jacc.execute();
|
||||
StreamMatcher.assertStream("CalcParser.java",
|
||||
getResource("CalcParser.java"),
|
||||
Files.newInputStream(Paths.get("build/CalcParser.java")));
|
||||
StreamMatcher.assertStream("CalcTokens.java",
|
||||
getResource("CalcTokens.java"),
|
||||
Files.newInputStream(Paths.get("build/CalcTokens.java")));
|
||||
StreamMatcher.assertStream("CalcParser.output",
|
||||
getResource("CalcParser.output"),
|
||||
Files.newInputStream(Paths.get("build/CalcParser.output")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void traceCalc() throws IOException {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
Jacc jacc = new Jacc();
|
||||
jacc.setName("Calc");
|
||||
jacc.setInputStream(getResource("Calc.jacc"));
|
||||
jacc.setParserInputs(getResource("example1"));
|
||||
jacc.setEnableParserOutput(false);
|
||||
jacc.setEnableTokenOutput(false);
|
||||
jacc.setOutputStream(byteArrayOutputStream);
|
||||
jacc.setDir("build/");
|
||||
jacc.execute();
|
||||
StreamMatcher.assertStream("example1.out",
|
||||
getResource("example1.out"),
|
||||
new ByteArrayInputStream(byteArrayOutputStream.toByteArray())
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleCalc() throws IOException {
|
||||
Jacc jacc = new Jacc();
|
||||
jacc.setName("simpleCalc");
|
||||
jacc.setInputStream(getResource("simpleCalc.jacc"));
|
||||
jacc.setMachineType(MachineType.SLR1);
|
||||
jacc.setDir("build/");
|
||||
jacc.execute();
|
||||
StreamMatcher.assertStream("Calc.java",
|
||||
getResource("Calc.java"),
|
||||
Files.newInputStream(Paths.get("build/Calc.java")));
|
||||
}
|
||||
|
||||
private InputStream getResource(String resource) throws IOException {
|
||||
return getClass().getClassLoader().getResource("org/xbib/jacc/" + resource).openStream();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Helper classes for testing.
|
||||
*/
|
||||
package org.xbib.jacc.helper;
|
12
src/test/java/org/xbib/jacc/test/JaccMainTest.java
Normal file
12
src/test/java/org/xbib/jacc/test/JaccMainTest.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package org.xbib.jacc.test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xbib.jacc.Jacc;
|
||||
|
||||
public class JaccMainTest {
|
||||
|
||||
@Test
|
||||
public void jaccMain() throws Exception {
|
||||
Jacc.main(new String[] {"-d", "build/", "src/test/resources/org/xbib/jacc/Calc.jacc"});
|
||||
}
|
||||
}
|
87
src/test/java/org/xbib/jacc/test/JaccTest.java
Normal file
87
src/test/java/org/xbib/jacc/test/JaccTest.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package org.xbib.jacc.test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xbib.jacc.Jacc;
|
||||
import org.xbib.jacc.MachineType;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class JaccTest {
|
||||
|
||||
@Test
|
||||
public void calc() throws IOException {
|
||||
try (InputStream inputStream1 = getInputStream("Calc.jacc");
|
||||
InputStream inputStream2 = getInputStream("Calc.errs");
|
||||
InputStream inputStream3 = getInputStream("CalcParser.java");
|
||||
InputStream inputStream5 = getInputStream("CalcTokens.java");
|
||||
InputStream inputStream7 = getInputStream("CalcParser.output")) {
|
||||
Jacc jacc = new Jacc();
|
||||
jacc.setName("Calc");
|
||||
jacc.setInputStream(inputStream1);
|
||||
jacc.setErrorDiagnostics(new InputStreamReader(inputStream2, StandardCharsets.UTF_8));
|
||||
jacc.setDir("build/");
|
||||
jacc.setEnableVerboseMachineDescription(true);
|
||||
jacc.execute();
|
||||
try (InputStream inputStream4 = Files.newInputStream(Paths.get("build/CalcParser.java"));
|
||||
InputStream inputStream6 = Files.newInputStream(Paths.get("build/CalcTokens.java"));
|
||||
InputStream inputStream8 = Files.newInputStream(Paths.get("build/CalcParser.output"))) {
|
||||
StreamMatcher.assertStream("CalcParser.java",
|
||||
inputStream3, inputStream4);
|
||||
StreamMatcher.assertStream("CalcTokens.java",
|
||||
inputStream5, inputStream6);
|
||||
StreamMatcher.assertStream("CalcParser.output",
|
||||
inputStream7, inputStream8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void traceCalc() throws IOException {
|
||||
try (InputStream inputStream1 = getInputStream("Calc.jacc");
|
||||
InputStream inputStream2 = getInputStream("example1");
|
||||
InputStream inputStream3 = getInputStream("example1.out")) {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
Jacc jacc = new Jacc();
|
||||
jacc.setName("Calc");
|
||||
jacc.setInputStream(inputStream1);
|
||||
jacc.setParserInputs(new InputStreamReader(inputStream2, StandardCharsets.UTF_8));
|
||||
jacc.setEnableParserOutput(false);
|
||||
jacc.setEnableTokenOutput(false);
|
||||
jacc.setOutputStream(byteArrayOutputStream);
|
||||
jacc.setDir("build/");
|
||||
jacc.execute();
|
||||
StreamMatcher.assertStream("example1.out",
|
||||
inputStream3,
|
||||
new ByteArrayInputStream(byteArrayOutputStream.toByteArray())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleCalc() throws IOException {
|
||||
try (InputStream inputStream1 = getInputStream("simpleCalc.jacc");
|
||||
InputStream inputStream2 = getInputStream("Calc.java")) {
|
||||
Jacc jacc = new Jacc();
|
||||
jacc.setName("simpleCalc");
|
||||
jacc.setInputStream(inputStream1);
|
||||
jacc.setMachineType(MachineType.SLR1);
|
||||
jacc.setDir("build/");
|
||||
jacc.execute();
|
||||
StreamMatcher.assertStream("Calc.java",
|
||||
inputStream2,
|
||||
Files.newInputStream(Paths.get("build/Calc.java")));
|
||||
}
|
||||
}
|
||||
|
||||
private static InputStream getInputStream(String resource) throws IOException {
|
||||
return JaccTest.class.getClassLoader().getResource("org/xbib/jacc/" + resource).openStream();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,20 +1,4 @@
|
|||
/*
|
||||
Copyright 2016 Jörg Prante
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
package org.xbib.jacc.helper;
|
||||
package org.xbib.jacc.test;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
|
@ -26,9 +10,6 @@ import java.nio.channels.Channels;
|
|||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class StreamMatcher extends Assert {
|
||||
|
||||
public static void assertStream(String name, InputStream expected, String actual) throws IOException {
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
* Classes for testing jacc.
|
||||
*/
|
||||
package org.xbib.jacc;
|
||||
package org.xbib.jacc.test;
|
|
@ -1,4 +1,3 @@
|
|||
Running example from input stream
|
||||
start : _ INTEGER ...
|
||||
shift : INTEGER _ '+' ...
|
||||
reduce : _ expr '+' ...
|
||||
|
|
Loading…
Reference in a new issue