aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShevek <[email protected]>2014-12-30 23:42:32 -0800
committerShevek <[email protected]>2014-12-30 23:42:32 -0800
commit927ecc0ad4fb8959e1c57e6177545ce694c58ce1 (patch)
tree996264425a7bbb7dd99ed6c349c5d76f8a2fffef /src
parent3d7eba8b626226b48e56137d601131b8586cd5ba (diff)
jsr305 annotations.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/anarres/cpp/MacroTokenSource.java18
-rw-r--r--src/main/java/org/anarres/cpp/Preprocessor.java2
-rw-r--r--src/main/java/org/anarres/cpp/Source.java2
3 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/org/anarres/cpp/MacroTokenSource.java b/src/main/java/org/anarres/cpp/MacroTokenSource.java
index 5874584..b512c3d 100644
--- a/src/main/java/org/anarres/cpp/MacroTokenSource.java
+++ b/src/main/java/org/anarres/cpp/MacroTokenSource.java
@@ -33,7 +33,7 @@ import static org.anarres.cpp.Token.*;
private Iterator<Token> arg; /* "current expansion" */
- /* pp */ MacroTokenSource(Macro m, List<Argument> args) {
+ /* pp */ MacroTokenSource(@Nonnull Macro m, @Nonnull List<Argument> args) {
this.macro = m;
this.tokens = m.getTokens().iterator();
this.args = args;
@@ -41,7 +41,7 @@ import static org.anarres.cpp.Token.*;
}
@Override
- /* pp */ boolean isExpanding(Macro m) {
+ /* pp */ boolean isExpanding(@Nonnull Macro m) {
/* When we are expanding an arg, 'this' macro is not
* being expanded, and thus we may re-expand it. */
if (/* XXX this.arg == null && */this.macro == m)
@@ -76,15 +76,14 @@ import static org.anarres.cpp.Token.*;
}
}
- private void concat(StringBuilder buf, Argument arg) {
- Iterator<Token> it = arg.iterator();
- while (it.hasNext()) {
- Token tok = it.next();
+ private void concat(@Nonnull StringBuilder buf, @Nonnull Argument arg) {
+ for (Token tok : arg) {
buf.append(tok.getText());
}
}
- private Token stringify(Token pos, Argument arg) {
+ @Nonnull
+ private Token stringify(@Nonnull Token pos, @Nonnull Argument arg) {
StringBuilder buf = new StringBuilder();
concat(buf, arg);
// System.out.println("Concat: " + arg + " -> " + buf);
@@ -100,11 +99,11 @@ import static org.anarres.cpp.Token.*;
/* At this point, we have consumed the first M_PASTE.
* @see Macro#addPaste(Token) */
- private void paste(Token ptok)
+ private void paste(@Nonnull Token ptok)
throws IOException,
LexerException {
StringBuilder buf = new StringBuilder();
- Token err = null;
+ // Token err = null;
/* We know here that arg is null or expired,
* since we cannot paste an expanded arg. */
@@ -152,6 +151,7 @@ import static org.anarres.cpp.Token.*;
arg = new SourceIterator(sl);
}
+ @Override
public Token token()
throws IOException,
LexerException {
diff --git a/src/main/java/org/anarres/cpp/Preprocessor.java b/src/main/java/org/anarres/cpp/Preprocessor.java
index 155117e..8b1ddcc 100644
--- a/src/main/java/org/anarres/cpp/Preprocessor.java
+++ b/src/main/java/org/anarres/cpp/Preprocessor.java
@@ -1455,7 +1455,7 @@ public class Preprocessor implements Closeable {
la = source_token_nonwhite();
if (la.getType() != ')') {
expr_untoken(la);
- error(la, "Missing ) in defined()");
+ error(la, "Missing ) in defined(). Got " + la.getText());
}
}
}
diff --git a/src/main/java/org/anarres/cpp/Source.java b/src/main/java/org/anarres/cpp/Source.java
index 3fba3ab..d25e553 100644
--- a/src/main/java/org/anarres/cpp/Source.java
+++ b/src/main/java/org/anarres/cpp/Source.java
@@ -178,7 +178,7 @@ public abstract class Source implements Iterable<Token>, Closeable {
*
* This is used to prevent macro recursion.
*/
- /* pp */ boolean isExpanding(Macro m) {
+ /* pp */ boolean isExpanding(@Nonnull Macro m) {
Source parent = getParent();
if (parent != null)
return parent.isExpanding(m);