Fix lint errors
This commit is contained in:
parent
c2adfa3b46
commit
da5d171479
@ -53,9 +53,7 @@ var (
|
|||||||
Rune('-'),
|
Rune('-'),
|
||||||
positiveNumber,
|
positiveNumber,
|
||||||
func(neg Located[rune], posNum Located[string]) Located[string] {
|
func(neg Located[rune], posNum Located[string]) Located[string] {
|
||||||
return Located[string]{
|
return Locate(neg.Location, string(neg.Value)+posNum.Value)
|
||||||
neg.Location, string(neg.Value) + posNum.Value,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -68,7 +66,7 @@ var (
|
|||||||
panic(fmt.Errorf("parsing %q as int: %w", str, err))
|
panic(fmt.Errorf("parsing %q as int: %w", str, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
return Located[Value]{str.Location, Number(i)}
|
return Locate(str.Location, Number(i))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -93,7 +91,7 @@ var (
|
|||||||
for _, r := range tail {
|
for _, r := range tail {
|
||||||
name = append(name, r.Value)
|
name = append(name, r.Value)
|
||||||
}
|
}
|
||||||
return Located[Value]{head.Location, Name(string(name))}
|
return Locate(head.Location, Name(string(name)))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -228,7 +226,7 @@ var graphSym, value = func() (
|
|||||||
gs.g = new(Graph)
|
gs.g = new(Graph)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Located[Value]{r.Location, Value{Graph: gs.g}}
|
return Locate(r.Location, Value{Graph: gs.g})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,6 +18,11 @@ type Located[T any] struct {
|
|||||||
Value T
|
Value T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Locate returns a Located instance combining the given values.
|
||||||
|
func Locate[T any](l Location, v T) Located[T] {
|
||||||
|
return Located[T]{l, v}
|
||||||
|
}
|
||||||
|
|
||||||
// LocatedError is an error related to a specific point within a stream of
|
// LocatedError is an error related to a specific point within a stream of
|
||||||
// runes.
|
// runes.
|
||||||
type LocatedError Located[error]
|
type LocatedError Located[error]
|
||||||
|
Loading…
Reference in New Issue
Block a user