aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-23 20:47:48 +0100
committerSven Gothel <[email protected]>2015-03-23 20:47:48 +0100
commite3b1d17a2f2b4070c1080fa6f78cfc1bcd28c78c (patch)
treed27181d36f73071791b9f1ba08e48bb7dc723dd2
parent6d805e3f526b30144649232246d5ffdc04a31ebf (diff)
Preprocessor.pop_source(..): Fix '#line' number; Preprocessor/Source: Public access (pp.getSource(), s.getParent())
Preprocessor.pop_source(..): Fix '#line' number: See comment: + * FIXME: Removed the '+ 1', since all lines were off by one. + * This solves this case, but I don't know _why_ this was here in the first place.
-rw-r--r--src/main/java/org/anarres/cpp/Preprocessor.java9
-rw-r--r--src/main/java/org/anarres/cpp/Source.java2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/anarres/cpp/Preprocessor.java b/src/main/java/org/anarres/cpp/Preprocessor.java
index f0e5528..c7a106a 100644
--- a/src/main/java/org/anarres/cpp/Preprocessor.java
+++ b/src/main/java/org/anarres/cpp/Preprocessor.java
@@ -522,7 +522,7 @@ public class Preprocessor implements Closeable {
* @see #pop_source()
*/
// @CheckForNull
- protected Source getSource() {
+ public Source getSource() {
return source;
}
@@ -567,8 +567,11 @@ public class Preprocessor implements Closeable {
&& t != null) {
/* We actually want 'did the nested source
* contain a newline token', which isNumbered()
- * approximates. This is not perfect, but works. */
- return line_token(t.getLine() + 1, t.getName(), " 2");
+ * approximates. This is not perfect, but works.
+ * FIXME: Removed the '+ 1', since all lines were off by one.
+ * This solves this case, but I don't know _why_ this was here in the first place.
+ */
+ return line_token(t.getLine() /* SEE ABOVE: + 1 */, t.getName(), " 2");
}
return null;
diff --git a/src/main/java/org/anarres/cpp/Source.java b/src/main/java/org/anarres/cpp/Source.java
index ff7482a..817c162 100644
--- a/src/main/java/org/anarres/cpp/Source.java
+++ b/src/main/java/org/anarres/cpp/Source.java
@@ -104,7 +104,7 @@ public abstract class Source implements Iterable<Token>, Closeable {
*
* Sources form a singly linked list.
*/
- /* pp */ final Source getParent() {
+ public final Source getParent() {
return parent;
}