mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-15 17:25:36 +00:00
Add parseEnum support for triple quoted string and raw string enum values (#25401)
(cherry picked from commit ae8a1739f8)
This commit is contained in:
committed by
narimiran
parent
fda7c2e5bb
commit
0ae9f5e4df
@@ -47,7 +47,7 @@ macro genEnumCaseStmt*(typ: typedesc, argSym: typed, default: typed,
|
||||
of nnkEnumFieldDef:
|
||||
fVal = f[0].strVal
|
||||
case f[1].kind
|
||||
of nnkStrLit:
|
||||
of nnkStrLit .. nnkTripleStrLit:
|
||||
fStr = f[1].strVal
|
||||
of nnkTupleConstr:
|
||||
fStr = f[1][1].strVal
|
||||
@@ -57,7 +57,7 @@ macro genEnumCaseStmt*(typ: typedesc, argSym: typed, default: typed,
|
||||
fNum = f[1].intVal
|
||||
else:
|
||||
let fAst = f[0].getImpl
|
||||
if fAst.kind == nnkStrLit:
|
||||
if fAst.kind in {nnkStrLit .. nnkTripleStrLit}:
|
||||
fStr = fAst.strVal
|
||||
else:
|
||||
error("Invalid tuple syntax!", f[1])
|
||||
|
||||
Reference in New Issue
Block a user