Can anyone suggest nimrod's syntax features to assist in attaching metadata (for writing a macro) ?
Can't find any way to attach declarative metadata to fields, dumpTree() fails for both of those 1) the comments are not part of the tree
# comments are ignored, so this way doesn't work
dumpTree:
type
TMyDs = object
## used for inserting new entries and querrying.
## FIELD ORDER IS IMPORTANT!
id: TEntityId # SQL=id
name: string # SQL=name
originalPath: string # SQL=original_path
scanTime: TTime # SQL=scan_time
rootId: TEntityId # SQL=root_id
# here the compiler
dumpTree:
type
TMyDs = object
## used for inserting new entries and querrying.
## FIELD ORDER IS IMPORTANT!
id {.id.}: TEntityId # SQL=id
name: string # SQL=name
originalPath: string # SQL=original_path
scanTime: TTime # SQL=scan_time
rootId: TEntityId # SQL=root_id
# only necessary for 'dumpTree' to work:
{.pragma: id.}
dumpTree:
type
TMyDs = object
id {.id.}: TEntityId
...
I get
testdsmacro.nim(50, 22) Error: invalid visibility: '*'
for the following piece of code:
dumpTree:
type
TDirEntryDesc* = tuple
## used for inserting new entries and querrying.
## FIELD ORDER IS IMPORTANT!
id: TEntityId
parentId: TEntityId
So how can i declare a public type with a macro?