diff options
author | 2015-09-07 14:15:06 +0000 | |
---|---|---|
committer | 2015-09-08 09:04:23 +0000 | |
commit | 1540c7b1e06bc1d2b2b0fb5d65059204cc24d86f (patch) | |
tree | 612d3d8e8fd7a6b7fc4cc6b390902f6258bea7c9 /src | |
parent | 05e2c5b4e0da2f88e12d95adbc63cc3d46a6fca6 (diff) |
Minor changes to the label parsing to match the specification more closely.
--
MOS_MIGRATED_REVID=102496746
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java | 14 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java b/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java index 7d56f52ece..0bd7bfb779 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/LabelValidator.java @@ -36,7 +36,7 @@ public final class LabelValidator { * Note that . is also allowed in target names, and doesn't require quoting, but has restrictions * on its surrounding characters; see {@link #validateTargetName(String)}. */ - private static final CharMatcher PUNCTUATION_NOT_REQUIRING_QUOTING = CharMatcher.anyOf("_-@"); + private static final CharMatcher PUNCTUATION_NOT_REQUIRING_QUOTING = CharMatcher.anyOf("_@-"); /** * Matches characters allowed in target names regardless of context. @@ -77,7 +77,7 @@ public final class LabelValidator { return PACKAGE_NAME_ERROR; } - // Check for any character outside of [/0-9A-Z_a-z-]. Try to evaluate the + // Check for any character outside of [/0-9A-Za-z_-]. Try to evaluate the // conditional quickly (by looking in decreasing order of character class // likelihood). for (int i = len - 1; i >= 0; --i) { @@ -160,10 +160,12 @@ public final class LabelValidator { return "target names may not contain '" + c + "'"; } // Forbidden end chars: - if (c == '.' && targetName.endsWith("/..")) { - return "target names may not contain up-level references '..'"; - } else if (c == '.' && targetName.endsWith("/.")) { - return null; // See comment above; ideally should be an error. + if (c == '.') { + if (targetName.endsWith("/..")) { + return "target names may not contain up-level references '..'"; + } else if (targetName.endsWith("/.")) { + return null; // See comment above; ideally should be an error. + } } if (c == '/') { return "target names may not end with '/'"; diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java index 92991c21ae..8867c98d2c 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java @@ -102,7 +102,7 @@ public final class PackageIdentifier implements Comparable<PackageIdentifier>, S return "empty workspace name"; } - // Check for any character outside of [/0-9A-Z_a-z-._]. Try to evaluate the + // Check for any character outside of [/0-9A-Za-z_.-]. Try to evaluate the // conditional quickly (by looking in decreasing order of character class // likelihood). if (name.startsWith("@/") || name.endsWith("/")) { |