Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Bash(python3 -m json.tool)",
"Bash(timeout 300 ./gradlew:*)",
"Bash(wc:*)",
"Bash(xargs cat:*)",
Comment thread
mernst marked this conversation as resolved.
"Edit(./**)",
"Read(//home/mernst/research/types/checker-framework-fork*/**)",
"Read(//scratch/**)",
Expand All @@ -28,5 +29,5 @@
"deny": [],
"ask": []
},
"skipDangerousModePermissionPrompt": false
"skipDangerousModePermissionPrompt": true
Comment thread
mernst marked this conversation as resolved.
}
2 changes: 2 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ jobs:
cache: 'gradle'
- name: java -version
run: java -version
- name: Warm up Gradle cache
run: ./gradlew spotlessCheck > /dev/null 2>&1 || (sleep 60 && true)
Comment thread
mernst marked this conversation as resolved.
- name: ./gradlew build
run: ./gradlew build
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.com.gradleup.shadow)

// Code formatting; defines targets "spotlessApply" and "spotlessCheck"
// which are run by "check" (which is itself run by "build").
alias(libs.plugins.com.diffplug.spotless)

// Error Prone linter
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/org/plumelib/lookup/Lookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* <b>--regular-expressions=</b><i>boolean</i>. Specifies that keywords are regular
* expressions. If false, keywords are text matches. [default: false]
* <li id="option:case-sensitive"><b>-c</b> <b>--case-sensitive=</b><i>boolean</i>. If true,
* keywords matching is case sensistive. By default, both regular expressions and text
* keywords matching is case sensitive. By default, both regular expressions and text
* keywords are case-insensitive. [default: false]
* <li id="option:word-match"><b>-w</b> <b>--word-match=</b><i>boolean</i>. If true, match a
* text keyword only as a separate word, not as a substring of a word. This option may
Expand Down Expand Up @@ -160,10 +160,10 @@ private Lookup() {
public static boolean regular_expressions = false;

/**
* If true, keywords matching is case sensistive. By default, both regular expressions and text
* If true, keywords matching is case sensitive. By default, both regular expressions and text
* keywords are case-insensitive.
*/
@Option("-c Keywords are case sensistive")
@Option("-c Keywords are case sensitive")
public static boolean case_sensitive = false;

/**
Expand Down Expand Up @@ -270,9 +270,7 @@ public static void main(String[] args) throws IOException {
System.err.println("Error: --comment-re is not a regex: " + comment_re);
System.exit(254);
}
if (multiline_comment_start_re == null && multiline_comment_end_re == null) {
// Nothing to validate
} else if (multiline_comment_start_re != null && multiline_comment_end_re != null) {
if (multiline_comment_start_re != null && multiline_comment_end_re != null) {
if (!RegexUtil.isRegex(multiline_comment_start_re)) {
System.err.println(
"Error: --multiline-comment-start-re is not a regex: " + multiline_comment_start_re);
Expand All @@ -283,7 +281,7 @@ public static void main(String[] args) throws IOException {
"Error: --multiline-comment-end-re is not a regex: " + multiline_comment_end_re);
System.exit(254);
}
} else {
} else if (multiline_comment_start_re != null || multiline_comment_end_re != null) {
System.err.println(
"Error: supply both or neither of --multiline-comment-start-re and"
+ " --multiline-comment-end-re, not just one.");
Expand Down Expand Up @@ -365,6 +363,7 @@ public static void main(String[] args) throws IOException {
try {
// Process each entry looking for matches
int entryCnt = 0;
boolean usePatterns = !patterns.isEmpty();

EntryReader.Entry entry = reader.getEntry();
while (entry != null) {
Expand All @@ -375,7 +374,7 @@ public static void main(String[] args) throws IOException {
String toSearch =
(search_body || entry.shortEntry) ? entry.body : entry.getDescription(description_re);
boolean found = true;
if (!patterns.isEmpty()) {
if (usePatterns) {
for (Pattern pattern : patterns) {
if (!pattern.matcher(toSearch).find()) {
found = false;
Expand Down Expand Up @@ -432,7 +431,6 @@ public static void main(String[] args) throws IOException {
}
System.out.print(e.body);
} else {
int i = 0;
if (print_all) {
System.out.printf("%d matches found (separated by dashes below)%n", numMatchingEntries);
} else {
Expand All @@ -441,8 +439,8 @@ public static void main(String[] args) throws IOException {
numMatchingEntries);
}

for (EntryReader.Entry e : matchingEntries) {
i++;
for (int i = 0; i < numMatchingEntries; i++) {
EntryReader.Entry e = matchingEntries.get(i);
if (print_all) {
if (show_location) {
System.out.printf(
Expand All @@ -453,9 +451,10 @@ public static void main(String[] args) throws IOException {
System.out.print(e.body);
} else {
if (show_location) {
System.out.printf(" -i=%d %s:%d: %s%n", i, e.filename, e.lineNumber, e.firstLine);
System.out.printf(
" -i=%d %s:%d: %s%n", i + 1, e.filename, e.lineNumber, e.firstLine);
} else {
System.out.printf(" -i=%d %s%n", i, e.getDescription(description_re));
System.out.printf(" -i=%d %s%n", i + 1, e.getDescription(description_re));
}
}
}
Expand Down