Types
- Lexer[U; M] = object lineInfo*: LineInfo 
- U means whether supporting escape about unicode; M is a proc(LineInfo, TranslateEscapeErr, string), leaving as a generic to allow custom pragma like {.raises: [].} Source Edit
- LexMessage = proc (info: LineInfo; kind: TranslateEscapeErr; nimStyleErrMsg: string) 
- Source Edit
- TranslateEscapeErr = enum teeExtBad_uCurly = (-1, "bad hex digit in \\u{...}"), ## Nim's EXT teeBadEscape = "invalid escape sequence", teeBadOct = "invalid octal escape sequence", ## SyntaxWarning in Python teeUniOverflow = "illegal Unicode character", teeTrunc_x2 = "truncated \\xXX escape", teeTrunc_u4 = "truncated \\uXXXX escape", teeTrunc_U8 = "truncated \\UXXXXXXXX escape" 
- Source Edit
Consts
- allowNimEscape {.booldefine: "nimpylibTranslateEscapeAllowNimExt".} = false 
- 
    
    - if false(default), use extract Python's format; - if true, allow Nim's escape format like \u{...}, \p, \N
 
Procs
- proc newStaticLexer[U: static[bool]](s: string): Lexer[U, LexMessage] {. compileTime.} 
- use Nim-Like error message Source Edit
- proc translateEscape(L: var Lexer): string 
- Source Edit
- proc translateEscape(pattern: static[string]; allow_unicode: static[bool] = true): string {. compileTime.} 
- like translateEscapeWithErr but without lineInfo error msg Source Edit