-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
I'd like to have an equivalent of D's dscanner --declaration
(cf https://github.com/dlang-community/D-Scanner), also present in other languages ; I couldn't find it in nimgrep
my workaround is to use:
nimgrep -w --ignoreStyle lines **/*.nim| grep -E '(iterator|proc|template|macro)'
but that's very brittle (eg doesn't doesn't work with other types of declarations (eg macros, types, variables, constants etc) and gets fooled by comments.
This is needed for integration with other tools (eg go to declaration)
EDIT
- also, finding certain symbols can be tricky, eg:
defer
which seems like it could be a macro but is instead something magic defined here:compiler/transf.nim
; a tool should be able to find the defnition of these as well, eg usinglexer.TokTypeToStr
- for starred symbols, this can be tried:
nimgrep --ignoreStyle --ext:nim --recursive --oneline "newException\*"
-
also, need a way to find declarations of symbols defined in blocks, eg enum, type etc.
-
also, need a way to find definitions of
magic
symbols, eg:
proc instantiationInfo*(index = -1, fullPaths = false): tuple[
filename: string, line: int, column: int] {.magic: "InstantiationInfo", noSideEffect.}
# is actually implemented in compiler/semmagic.nim:
proc semInstantiationInfo(c: PContext, n: PNode)