Tests for enhancements
This commit is contained in:
parent
34cb1715b8
commit
1684e773ad
4 changed files with 21 additions and 4 deletions
|
|
@ -12,9 +12,9 @@ proc sanitizePath*(path: string): string =
|
|||
proc getIdentifier*(str: string): string =
|
||||
result = str.strip(chars={'_'})
|
||||
|
||||
proc getUniqueIdentifier*(exists: seq[string]): string =
|
||||
proc getUniqueIdentifier*(exists: seq[string], prefix = ""): string =
|
||||
var
|
||||
name = gStateRT.sourceFile.extractFilename().multiReplace([(".", ""), ("-", "")])
|
||||
name = prefix & "_" & gStateRT.sourceFile.extractFilename().multiReplace([(".", ""), ("-", "")])
|
||||
count = 1
|
||||
|
||||
while (name & $count) in exists:
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ proc initGrammar() =
|
|||
nname = name.getIdentifier()
|
||||
|
||||
if nname.len == 0:
|
||||
nname = getUniqueIdentifier(gStateRT.types)
|
||||
nname = getUniqueIdentifier(gStateRT.types, "Enum")
|
||||
|
||||
if nname notin gStateRT.types:
|
||||
gStateRT.types.add(nname)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue