diff options
Diffstat (limited to 'src/java/org/anarres/cpp/Source.java')
-rw-r--r-- | src/java/org/anarres/cpp/Source.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/java/org/anarres/cpp/Source.java b/src/java/org/anarres/cpp/Source.java index 0bc1476..e7a6d2d 100644 --- a/src/java/org/anarres/cpp/Source.java +++ b/src/java/org/anarres/cpp/Source.java @@ -98,11 +98,14 @@ public abstract class Source implements Iterable<Token> { return parent; } - public void setListener(PreprocessorListener listener) { - this.listener = listener; + // @OverrideMustInvoke + /* pp */ void init(Preprocessor pp) { + setListener(pp.getListener()); } - public void setFeatures(Set<Feature> features) { + /* Actually just used for testing. */ + public void setListener(PreprocessorListener pl) { + this.listener = pl; } /** @@ -141,6 +144,13 @@ public abstract class Source implements Iterable<Token> { return parent.getLine(); } + public int getColumn() { + Source parent = getParent(); + if (parent == null) + return 0; + return parent.getColumn(); + } + /* pp */ boolean isExpanding(Macro m) { Source parent = getParent(); if (parent != null) |