aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/anarres
diff options
context:
space:
mode:
authorShevek <[email protected]>2014-12-03 00:01:47 -0800
committerShevek <[email protected]>2014-12-03 00:01:47 -0800
commita3306f269ec75a617f7bf4ee6a292a961ba2c1f5 (patch)
tree59b477b295579dfd60d4de301ff475ce999c1744 /src/main/java/org/anarres
parent28c3704abb4f98989d6aa57dc1395df99a77f7d2 (diff)
SourceChangeEvent now uses an enum.
-> gradle 2.2.1
Diffstat (limited to 'src/main/java/org/anarres')
-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
3 files changed, 12 insertions, 6 deletions
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);
}