Update type and method references to use qualified names
This commit is contained in:
18
cmd/main.go
18
cmd/main.go
@@ -78,7 +78,7 @@ func main() {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
out := bufio.NewWriter(os.Stdout)
|
||||
|
||||
regComp, err := Compile(re, flagsToCompile...)
|
||||
regComp, err := greg.Compile(re, flagsToCompile...)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
@@ -119,14 +119,14 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
matchIndices := make([]Match, 0)
|
||||
matchIndices := make([]greg.Match, 0)
|
||||
if matchNumFlagEnabled {
|
||||
tmp, err := FindNthMatch(regComp, test_str, *matchNum)
|
||||
tmp, err := greg.FindNthMatch(regComp, test_str, *matchNum)
|
||||
if err == nil {
|
||||
matchIndices = append(matchIndices, tmp)
|
||||
}
|
||||
} else {
|
||||
matchIndices = FindAllMatches(regComp, test_str)
|
||||
matchIndices = greg.FindAllMatches(regComp, test_str)
|
||||
}
|
||||
|
||||
if *printMatchesFlag {
|
||||
@@ -137,7 +137,7 @@ func main() {
|
||||
fmt.Fprintf(out, "Line %d:\n", lineNum)
|
||||
}
|
||||
for _, m := range matchIndices {
|
||||
fmt.Fprintf(out, "%s\n", m.toString())
|
||||
fmt.Fprintf(out, "%s\n", m.ToString())
|
||||
}
|
||||
err := out.Flush()
|
||||
if err != nil {
|
||||
@@ -150,7 +150,7 @@ func main() {
|
||||
// This should make checking O(1) instead of O(n)
|
||||
indicesToPrint := new_uniq_arr[int]()
|
||||
for _, idx := range matchIndices {
|
||||
indicesToPrint.add(genRange(idx[0].startIdx, idx[0].endIdx)...)
|
||||
indicesToPrint.add(genRange(idx[0].StartIdx, idx[0].EndIdx)...)
|
||||
}
|
||||
// If we are inverting, then we should print the indices which _didn't_ match
|
||||
// in color.
|
||||
@@ -185,9 +185,9 @@ func main() {
|
||||
for i := range test_str {
|
||||
inMatchIndex := false
|
||||
for _, m := range matchIndices {
|
||||
if i == m[0].startIdx {
|
||||
if i == m[0].StartIdx {
|
||||
fmt.Fprintf(out, "%s", *substituteText)
|
||||
i = m[0].endIdx
|
||||
i = m[0].EndIdx
|
||||
inMatchIndex = true
|
||||
break
|
||||
}
|
||||
@@ -203,7 +203,7 @@ func main() {
|
||||
// Newline after every match - only if -o is enabled and -v is disabled.
|
||||
if *onlyFlag && !(*invertFlag) {
|
||||
for _, idx := range matchIndices {
|
||||
if i+1 == idx[0].endIdx { // End index is one more than last index of match
|
||||
if i+1 == idx[0].EndIdx { // End index is one more than last index of match
|
||||
fmt.Fprintf(out, "\n")
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user