@@ -9,6 +9,9 @@ proc toNifPath(p: AbsoluteDir|AbsoluteFile): string =
99 if p.string .len <= result .len:
1010 result = p.string
1111
12+ proc expectTag (n: Cursor ; tag: string ) =
13+ assert pool.tags[n.tagId] == tag, " expected tag: " & tag & " but got: " & pool.tags[n.tagId]
14+
1215proc fromNif [T: enum ](result: var T; n: var Cursor ) =
1316 result = parseEnum [T](pool.strings[n.litId])
1417 inc n
@@ -134,18 +137,18 @@ proc sourcesChanged(conf: ConfigRef; n: var Cursor; modTime: Time): HashSet[stri
134137 inc n
135138
136139proc loadConfigsFromNif (conf: ConfigRef ; n: var Cursor ) =
137- assert pool.tags[n.tagId] == " options"
140+ expectTag n, " options"
138141 inc n
139142 fromNif (conf.options, n)
140143 # echo conf.options
141144
142- assert pool.tags[n.tagId] == " globalOptions"
145+ expectTag n, " globalOptions"
143146 inc n
144147 fromNif (conf.globalOptions, n)
145148 # echo conf.globalOptions
146149
147150 conf.macrosToExpand.clear
148- assert pool.tags[n.tagId] == " macrosToExpand"
151+ expectTag n, " macrosToExpand"
149152 inc n
150153 while n.kind != ParRi :
151154 assert n.kind == StringLit
@@ -155,7 +158,7 @@ proc loadConfigsFromNif(conf: ConfigRef; n: var Cursor) =
155158 inc n
156159
157160 conf.arcToExpand.clear
158- assert pool.tags[n.tagId] == " arcToExpand"
161+ expectTag n, " arcToExpand"
159162 inc n
160163 while n.kind != ParRi :
161164 assert n.kind == StringLit
@@ -188,7 +191,7 @@ proc loadConfigsFromNif(conf: ConfigRef; n: var Cursor) =
188191 # echo conf.nimbasePattern
189192
190193 conf.symbols.clear
191- assert pool.tags[n.tagId] == " defines"
194+ expectTag n, " defines"
192195 inc n
193196 while n.kind != ParRi :
194197 assert n.kind == StringLit
@@ -198,7 +201,7 @@ proc loadConfigsFromNif(conf: ConfigRef; n: var Cursor) =
198201 inc n
199202
200203 conf.nimblePaths.setLen (0 )
201- assert pool.tags[n.tagId] == " nimblepaths"
204+ expectTag n, " nimblepaths"
202205 inc n
203206 while n.kind != ParRi :
204207 assert n.kind == StringLit
@@ -210,7 +213,7 @@ proc loadConfigsFromNif(conf: ConfigRef; n: var Cursor) =
210213 # echo conf.nimblePaths
211214
212215 conf.searchPaths.setLen (0 )
213- assert pool.tags[n.tagId] == " paths"
216+ expectTag n, " paths"
214217 inc n
215218 while n.kind != ParRi :
216219 assert n.kind == StringLit
0 commit comments