aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build.gradle47
-rw-r--r--gradle/buildscript.gradle25
-rw-r--r--gradle/check.gradle48
-rw-r--r--gradle/convention.gradle142
-rw-r--r--gradle/github.gradle30
-rw-r--r--gradle/license.gradle15
-rw-r--r--gradle/maven.gradle69
-rw-r--r--gradle/netflix-oss.gradle1
-rw-r--r--gradle/nexus.gradle45
-rw-r--r--gradle/release.gradle60
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin50557 -> 51018 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties4
-rw-r--r--src/main/java/org/anarres/cpp/DefaultPreprocessorListener.java2
-rw-r--r--src/main/java/org/anarres/cpp/Preprocessor.java9
-rw-r--r--src/main/java/org/anarres/cpp/PreprocessorListener.java7
-rw-r--r--src/test/java/org/anarres/cpp/LexerSourceTest.java6
-rw-r--r--src/test/java/org/anarres/cpp/PreprocessorTest.java8
17 files changed, 203 insertions, 315 deletions
diff --git a/build.gradle b/build.gradle
index 3460d83..cbef726 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,45 +3,26 @@ ext.githubProjectName = rootProject.name // Change if github project name is not
group = "org.anarres"
buildscript {
- repositories {
- // mavenLocal()
- mavenCentral() // maven { url 'http://jcenter.bintray.com' }
- }
apply from: file('gradle/buildscript.gradle'), to: buildscript
}
-allprojects {
- repositories {
- // mavenLocal()
- mavenCentral() // maven { url: 'http://jcenter.bintray.com' }
- }
-}
-
-apply plugin: 'idea'
-
apply from: file('gradle/convention.gradle')
-apply from: file('gradle/maven.gradle')
+apply from: file('gradle/github.gradle')
+apply from: file('gradle/nexus.gradle')
apply from: file('gradle/check.gradle')
apply from: file('gradle/license.gradle')
-// apply from: file('gradle/release.gradle')
apply plugin: 'application'
apply plugin: 'velocity'
dependencies {
- def slf4jVersion = '1.7.7'
-
- compile 'com.google.code.findbugs:jsr305:2.0.2'
// compile 'gnu.getopt:java-getopt:1.0.13'
- compile "org.slf4j:slf4j-api:$slf4jVersion"
compile 'net.sf.jopt-simple:jopt-simple:4.7'
compile 'org.apache.ant:ant:1.7.0'
- runtime "org.slf4j:slf4j-jcl:$slf4jVersion"
+ runtime 'org.slf4j:slf4j-simple:1.7.7'
- testCompile 'junit:junit:4.11'
// testCompile 'com.google.guava:guava:18.0'
- testCompile 'commons-logging:commons-logging:1.2'
}
velocity {
@@ -53,25 +34,3 @@ velocity {
}
mainClassName = "org.anarres.cpp.Main"
-
-test {
- systemProperty 'org.apache.commons.logging.Log', 'org.apache.commons.logging.impl.SimpleLog'
- systemProperty 'org.apache.commons.logging.simplelog.defaultlog', 'debug'
-
- testLogging {
- if (System.properties['test.single']) {
- // events "passed", "skipped", "failed"
- events "started", "passed", "skipped", "failed"
- showExceptions true
- exceptionFormat "full"
- showStandardStreams true
- } else {
- events "failed"
- }
-
- debug {
- events "started", "passed", "skipped", "failed", "standard_out", "standard_error"
- exceptionFormat "full"
- }
- }
-}
diff --git a/gradle/buildscript.gradle b/gradle/buildscript.gradle
index 72215e4..d460daa 100644
--- a/gradle/buildscript.gradle
+++ b/gradle/buildscript.gradle
@@ -1,14 +1,21 @@
// Executed in context of buildscript
repositories {
- // Repo in addition to maven central
- repositories { maven { url 'http://dl.bintray.com/content/netflixoss/external-gradle-plugins/' } } // For gradle-release
+ // mavenLocal()
+ mavenCentral()
+ // jcenter()
}
+
dependencies {
- classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1'
- // classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
- classpath "net.saliman:gradle-cobertura-plugin:2.2.2"
- // classpath 'gradle-release:gradle-release:1.1.5'
- classpath 'org.ajoberstar:gradle-git:0.5.0'
- classpath 'org.anarres.gradle:gradle-velocity-plugin:1.0.0'
- classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.3'
+ classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
+ // classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
+ classpath "net.saliman:gradle-cobertura-plugin:2.2.5"
+ // classpath 'gradle-release:gradle-release:1.1.5'
+ classpath 'org.ajoberstar:gradle-git:0.11.2'
+ classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.5'
+ classpath('com.netflix.nebula:gradle-info-plugin:1.12.5') {
+ exclude group: 'com.perforce'
+ }
+ classpath 'com.bmuschko:gradle-nexus-plugin:2.1.1'
+
+ classpath 'org.anarres.gradle:gradle-velocity-plugin:1.0.0'
}
diff --git a/gradle/check.gradle b/gradle/check.gradle
index 760629a..ad1f9fc 100644
--- a/gradle/check.gradle
+++ b/gradle/check.gradle
@@ -1,29 +1,29 @@
-// Checkstyle
-// apply plugin: 'checkstyle'
-// checkstyle {
-// ignoreFailures = true
-// configFile = rootProject.file('codequality/checkstyle.xml')
-// }
+ // Checkstyle
+ // apply plugin: 'checkstyle'
+ // checkstyle {
+ // ignoreFailures = true
+ // configFile = rootProject.file('codequality/checkstyle.xml')
+ // }
-// FindBugs
-apply plugin: 'findbugs'
-findbugs {
- ignoreFailures = true
-}
-findbugsTest.enabled = false
+ // FindBugs
+ apply plugin: 'findbugs'
+ findbugs {
+ ignoreFailures = true
+ }
+ findbugsTest.enabled = false
-// PMD
-// apply plugin: 'pmd'
-// tasks.withType(Pmd) { reports.html.enabled true }
+ // PMD
+ // apply plugin: 'pmd'
+ // tasks.withType(Pmd) { reports.html.enabled true }
-apply plugin: 'cobertura'
-cobertura {
- coverageFormats = [ 'html', 'xml' ]
-}
-githubPages {
- pages {
- from(cobertura.coverageReportDir) {
- into "docs/cobertura"
+ apply plugin: 'cobertura'
+ cobertura {
+ coverageFormats = [ 'html', 'xml' ]
+ }
+ githubPages {
+ pages {
+ from(cobertura.coverageReportDir) {
+ into "docs/cobertura"
+ }
}
}
-}
diff --git a/gradle/convention.gradle b/gradle/convention.gradle
index ed20c86..8dd086e 100644
--- a/gradle/convention.gradle
+++ b/gradle/convention.gradle
@@ -1,88 +1,58 @@
-apply plugin: 'java' // Plugin as major conventions, overwrites status
-apply plugin: 'errorprone'
-
-sourceCompatibility = 1.5
-targetCompatibility = 1.5
-
-// GRADLE-2087 workaround, perform after java plugin
-status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release')
-
-// Indenting to align with multi-project branch
- task sourcesJar(type: Jar, dependsOn:classes) {
- from sourceSets.main.allSource
- classifier 'sources'
- extension 'jar'
- }
-
- task javadocJar(type: Jar, dependsOn:javadoc) {
- from javadoc.destinationDir
- classifier 'javadoc'
- extension 'jar'
- }
-
- configurations.add('sources')
- configurations.add('javadoc')
- configurations.archives {
- extendsFrom configurations.sources
- extendsFrom configurations.javadoc
- }
-
- // When outputing to an Ivy repo, we want to use the proper type field
- gradle.taskGraph.whenReady {
- def isNotMaven = !it.hasTask(project.uploadMavenCentral)
- if (isNotMaven) {
- def artifacts = project.configurations.sources.artifacts
- def sourceArtifact = artifacts.iterator().next()
- sourceArtifact.type = 'sources'
- }
- }
-
- artifacts {
- sources(sourcesJar) {
- // Weird Gradle quirk where type will be used for the extension, but only for sources
- type 'jar'
- }
- javadoc(javadocJar) {
- type 'javadoc'
- }
- }
-
- configurations {
- provided {
- description = 'much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive.'
- transitive = true
- visible = true
- }
- }
-
- project.sourceSets {
- main.compileClasspath += project.configurations.provided
- main.runtimeClasspath -= project.configurations.provided
- test.compileClasspath += project.configurations.provided
- test.runtimeClasspath += project.configurations.provided
- }
-
-apply plugin: 'github-pages' // Used to create publishGhPages task
-
-def docTasks = [:]
-[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
- tasks.withType(docClass).each { docTask ->
- docTasks[docTask.name] = docTask
- processGhPages.dependsOn(docTask)
- }
-}
-
-githubPages {
- repoUri = "[email protected]:shevek/${rootProject.githubProjectName}.git"
- pages {
- docTasks.each { shortName, docTask ->
- from(docTask.outputs.files) {
- into "docs/${shortName}"
- }
- }
- }
-}
-
+ apply plugin: 'java' // Plugin as major conventions
+ apply plugin: 'errorprone'
+ apply plugin: 'info'
+
+ sourceCompatibility = 1.5
+
+ // GRADLE-2087 workaround, perform after java plugin
+ status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release')
+
+ repositories {
+ // mavenLocal()
+ mavenCentral()
+ // jcenter()
+ }
+
+ dependencies {
+ compile 'com.google.code.findbugs:jsr305:2.0.2'
+ compile 'org.slf4j:slf4j-api:1.7.7'
+
+ testCompile 'junit:junit:4.11'
+
+ testRuntime 'org.slf4j:slf4j-simple:1.7.7'
+ }
+
+ tasks.withType(JavaCompile) {
+ options.incremental = true
+ }
+
+ test {
+ systemProperty 'org.apache.commons.logging.Log', 'org.apache.commons.logging.impl.SimpleLog'
+ systemProperty 'org.apache.commons.logging.simplelog.defaultlog', 'debug'
+ systemProperty 'org.apache.commons.logging.diagnostics.dest', 'STDERR'
+ systemProperty 'org.slf4j.simpleLogger.logFile', 'System.out'
+ systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'debug'
+ systemProperty 'jna.nosys', 'true'
+
+ testLogging {
+ if (System.properties['test.single']) {
+ // events "passed", "skipped", "failed"
+ events "started", "passed", "skipped", "failed"
+ showExceptions true
+ exceptionFormat "full"
+ showStandardStreams true
+ } else {
+ events "started", "skipped", "failed"
+ }
+
+ debug {
+ events "started", "passed", "skipped", "failed", "standard_out", "standard_error"
+ exceptionFormat "full"
+ }
+ }
+ }
+
+// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
wrapper {
- gradleVersion = '1.10'
+ gradleVersion = '2.2.1'
}
diff --git a/gradle/github.gradle b/gradle/github.gradle
new file mode 100644
index 0000000..5aeaabe
--- /dev/null
+++ b/gradle/github.gradle
@@ -0,0 +1,30 @@
+apply plugin: 'org.ajoberstar.github-pages'
+
+def docTasks = [:]
+[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass ->
+ def allSources = allprojects.tasks*.withType(docClass).flatten()*.source
+ if (allSources) {
+ def shortName = docClass.simpleName.toLowerCase()
+ def docTask = task "aggregate${shortName.capitalize()}"(type: docClass, description: "Aggregate subproject ${shortName}s") {
+ source = allSources
+ destinationDir = file("${project.buildDir}/docs/${shortName}")
+ doFirst {
+ def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath }
+ classpath = files(classpaths)
+ }
+ }
+ docTasks[shortName] = docTask
+ publishGhPages.dependsOn(docTask)
+ }
+}
+
+githubPages {
+ repoUri = "[email protected]:shevek/${rootProject.githubProjectName}.git"
+ pages {
+ docTasks.each { shortName, docTask ->
+ from(docTask.outputs.files) {
+ into "docs/${shortName}"
+ }
+ }
+ }
+}
diff --git a/gradle/license.gradle b/gradle/license.gradle
index 59b75b3..662bde1 100644
--- a/gradle/license.gradle
+++ b/gradle/license.gradle
@@ -1,8 +1,9 @@
-// Dependency for plugin was set in buildscript.gradle
-
-apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin
-license {
- header rootProject.file('codequality/HEADER')
- ext.year = Calendar.getInstance().get(Calendar.YEAR)
- skipExistingHeaders true
+allprojects {
+ apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin
+ license {
+ header rootProject.file('codequality/HEADER')
+ ext.year = Calendar.getInstance().get(Calendar.YEAR)
+ skipExistingHeaders true
+ ignoreFailures true
+ }
}
diff --git a/gradle/maven.gradle b/gradle/maven.gradle
deleted file mode 100644
index 0513719..0000000
--- a/gradle/maven.gradle
+++ /dev/null
@@ -1,69 +0,0 @@
-// Maven side of things
-apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
-apply plugin: 'signing'
-
-signing {
- required { gradle.taskGraph.hasTask(uploadMavenCentral) }
- sign configurations.archives
-}
-
-/**
- * Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
- * artifactory will execute uploadArchives to force generation of ivy.xml, and we don't want that to trigger an upload to maven
- * central, so using custom upload task.
- */
-task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
- configuration = configurations.archives
- onlyIf { ['release', 'snapshot'].contains(project.status) }
- repositories.mavenDeployer {
- beforeDeployment { signing.signPom(it) }
-
- // To test deployment locally, use the following instead of oss.sonatype.org
- //repository(url: "file://localhost/${rootProject.rootDir}/repo")
-
- def sonatypeUsername = rootProject.hasProperty('sonatypeUsername')?rootProject.sonatypeUsername:''
- def sonatypePassword = rootProject.hasProperty('sonatypePassword')?rootProject.sonatypePassword:''
-
- repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
- authentication(userName: sonatypeUsername, password: sonatypePassword)
- }
-
- snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
- authentication(userName: sonatypeUsername, password: sonatypePassword)
- }
-
- // Prevent datastamp from being appending to artifacts during deployment
- uniqueVersion = false
-
- // Closure to configure all the POM with extra info, common to all projects
- pom.project {
- name "${project.name}"
- description "Java C Preprocessor"
- developers {
- developer {
- id 'shevek'
- name 'Shevek'
- }
- }
- licenses {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution 'repo'
- }
- }
- url "https://github.com/shevek/${rootProject.githubProjectName}"
- scm {
- connection "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
- url "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
- developerConnection "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
- }
- issueManagement {
- system 'github'
- url "https://github.com/shevek/${rootProject.githubProjectName}/issues"
- }
- }
- }
-}
-
diff --git a/gradle/netflix-oss.gradle b/gradle/netflix-oss.gradle
deleted file mode 100644
index a87bc54..0000000
--- a/gradle/netflix-oss.gradle
+++ /dev/null
@@ -1 +0,0 @@
-apply from: 'http://artifacts.netflix.com/gradle-netflix-local/artifactory.gradle'
diff --git a/gradle/nexus.gradle b/gradle/nexus.gradle
new file mode 100644
index 0000000..d03f2a3
--- /dev/null
+++ b/gradle/nexus.gradle
@@ -0,0 +1,45 @@
+subprojects {
+ apply plugin: 'com.bmuschko.nexus'
+
+ project.afterEvaluate {
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ uniqueVersion = false
+ }
+ }
+ }
+ }
+
+ modifyPom {
+ // Closure to configure all the POM with extra info, common to all projects
+ project {
+ name "${project.name}"
+ description "Java C Preprocessor"
+ developers {
+ developer {
+ id 'shevek'
+ name 'Shevek'
+ }
+ }
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+ url "https://github.com/shevek/${rootProject.githubProjectName}"
+ scm {
+ connection "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
+ url "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
+ developerConnection "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
+ }
+ issueManagement {
+ system 'github'
+ url "https://github.com/shevek/${rootProject.githubProjectName}/issues"
+ }
+ }
+ }
+}
diff --git a/gradle/release.gradle b/gradle/release.gradle
deleted file mode 100644
index 6e3c20e..0000000
--- a/gradle/release.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-apply plugin: 'release'
-
-[ uploadIvyLocal: 'uploadLocal', uploadArtifactory: 'artifactoryPublish', buildWithArtifactory: 'build' ].each { key, value ->
- // Call out to compile against internal repository
- task "${key}"(type: GradleBuild) {
- startParameter = project.gradle.startParameter.newInstance()
- doFirst {
- startParameter.projectProperties = [status: project.status, preferredStatus: project.status]
- }
- startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
- startParameter.getExcludedTaskNames().add('check')
- tasks = [ 'build', value ]
- }
-}
-
-// Marker task for following code to key in on
-task releaseCandidate(dependsOn: release)
-task forceCandidate {
- onlyIf { gradle.taskGraph.hasTask(releaseCandidate) }
- doFirst { project.status = 'candidate' }
-}
-task forceRelease {
- onlyIf { !gradle.taskGraph.hasTask(releaseCandidate) }
- doFirst { project.status = 'release' }
-}
-release.dependsOn([forceCandidate, forceRelease])
-
-task releaseSnapshot(dependsOn: [uploadArtifactory, uploadMavenCentral])
-
-// Ensure our versions look like the project status before publishing
-task verifyStatus << {
- def hasSnapshot = version.contains('-SNAPSHOT')
- if (project.status == 'snapshot' && !hasSnapshot) {
- throw new GradleException("Version (${version}) needs -SNAPSHOT if publishing snapshot")
- }
-}
-uploadArtifactory.dependsOn(verifyStatus)
-uploadMavenCentral.dependsOn(verifyStatus)
-
-// Ensure upload happens before taggging, hence upload failures will leave repo in a revertable state
-preTagCommit.dependsOn([uploadArtifactory, uploadMavenCentral])
-
-
-gradle.taskGraph.whenReady { taskGraph ->
- def hasRelease = taskGraph.hasTask('commitNewVersion')
- def indexOf = { return taskGraph.allTasks.indexOf(it) }
-
- if (hasRelease) {
- assert indexOf(build) < indexOf(unSnapshotVersion), 'build target has to be after unSnapshotVersion'
- assert indexOf(uploadMavenCentral) < indexOf(preTagCommit), 'preTagCommit has to be after uploadMavenCentral'
- assert indexOf(uploadArtifactory) < indexOf(preTagCommit), 'preTagCommit has to be after uploadArtifactory'
- }
-}
-
-// Prevent plugin from asking for a version number interactively
-ext.'gradle.release.useAutomaticVersion' = "true"
-
-release {
- git.requireBranch = null
-}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 5838598..c97a8bd 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 40aa5f8..58b3586 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Dec 27 05:48:20 PST 2013
+#Tue Dec 02 23:57:35 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip
diff --git a/src/main/java/org/anarres/cpp/DefaultPreprocessorListener.java b/src/main/java/org/anarres/cpp/DefaultPreprocessorListener.java
index 68f6e89..40a8686 100644
--- a/src/main/java/org/anarres/cpp/DefaultPreprocessorListener.java
+++ b/src/main/java/org/anarres/cpp/DefaultPreprocessorListener.java
@@ -91,7 +91,7 @@ public class DefaultPreprocessorListener implements PreprocessorListener {
}
@Override
- public void handleSourceChange(Source source, String event) {
+ public void handleSourceChange(Source source, SourceChangeEvent event) {
}
}
diff --git a/src/main/java/org/anarres/cpp/Preprocessor.java b/src/main/java/org/anarres/cpp/Preprocessor.java
index 18a0605..f4e93cd 100644
--- a/src/main/java/org/anarres/cpp/Preprocessor.java
+++ b/src/main/java/org/anarres/cpp/Preprocessor.java
@@ -36,6 +36,7 @@ import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.anarres.cpp.PreprocessorCommand.*;
+import org.anarres.cpp.PreprocessorListener.SourceChangeEvent;
import static org.anarres.cpp.Token.*;
/**
@@ -526,10 +527,10 @@ public class Preprocessor implements Closeable {
source.setParent(this.source, autopop);
// source.setListener(listener);
if (listener != null)
- listener.handleSourceChange(this.source, "suspend");
+ listener.handleSourceChange(this.source, SourceChangeEvent.SUSPEND);
this.source = source;
if (listener != null)
- listener.handleSourceChange(this.source, "push");
+ listener.handleSourceChange(this.source, SourceChangeEvent.PUSH);
}
/**
@@ -542,13 +543,13 @@ public class Preprocessor implements Closeable {
protected Token pop_source(boolean linemarker)
throws IOException {
if (listener != null)
- listener.handleSourceChange(this.source, "pop");
+ listener.handleSourceChange(this.source, SourceChangeEvent.POP);
Source s = this.source;
this.source = s.getParent();
/* Always a noop unless called externally. */
s.close();
if (listener != null && this.source != null)
- listener.handleSourceChange(this.source, "resume");
+ listener.handleSourceChange(this.source, SourceChangeEvent.RESUME);
Source t = getSource();
if (getFeature(Feature.LINEMARKERS)
diff --git a/src/main/java/org/anarres/cpp/PreprocessorListener.java b/src/main/java/org/anarres/cpp/PreprocessorListener.java
index 3443714..0d3f7fc 100644
--- a/src/main/java/org/anarres/cpp/PreprocessorListener.java
+++ b/src/main/java/org/anarres/cpp/PreprocessorListener.java
@@ -49,6 +49,11 @@ public interface PreprocessorListener {
@Nonnull String msg)
throws LexerException;
- public void handleSourceChange(@Nonnull Source source, @Nonnull String event);
+ public enum SourceChangeEvent {
+
+ SUSPEND, PUSH, POP, RESUME;
+ }
+
+ public void handleSourceChange(@Nonnull Source source, @Nonnull SourceChangeEvent event);
}
diff --git a/src/test/java/org/anarres/cpp/LexerSourceTest.java b/src/test/java/org/anarres/cpp/LexerSourceTest.java
index e21aa01..96ec4a3 100644
--- a/src/test/java/org/anarres/cpp/LexerSourceTest.java
+++ b/src/test/java/org/anarres/cpp/LexerSourceTest.java
@@ -1,16 +1,16 @@
package org.anarres.cpp;
import java.util.Arrays;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.anarres.cpp.PreprocessorTest.assertType;
import static org.anarres.cpp.Token.*;
import static org.junit.Assert.*;
public class LexerSourceTest {
- private static final Log LOG = LogFactory.getLog(LexerSourceTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(LexerSourceTest.class);
public static void testLexerSource(String in, boolean textmatch, int... out)
throws Exception {
diff --git a/src/test/java/org/anarres/cpp/PreprocessorTest.java b/src/test/java/org/anarres/cpp/PreprocessorTest.java
index 84e7e31..e55b568 100644
--- a/src/test/java/org/anarres/cpp/PreprocessorTest.java
+++ b/src/test/java/org/anarres/cpp/PreprocessorTest.java
@@ -4,16 +4,16 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.anarres.cpp.Token.*;
import static org.junit.Assert.*;
public class PreprocessorTest {
- private static final Log LOG = LogFactory.getLog(PreprocessorTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(PreprocessorTest.class);
private OutputStreamWriter writer;
private Preprocessor p;
@@ -193,7 +193,7 @@ public class PreprocessorTest {
writer.flush();
for (Object v : out) {
Token t = p.token();
- LOG.info(t);
+ LOG.info(String.valueOf(t));
if (v instanceof String) {
if (t.getType() != STRING)
fail("Expected STRING, but got " + t);