summary refs log tree commit diff stats
path: root/lib/deprecated/pure
ModeNameSize
-rw-r--r--actors.nim7297log stats plain blame
-rw-r--r--actors.nim.cfg39log stats plain blame
-rw-r--r--asyncio.nim24742log stats plain blame
-rw-r--r--ftpclient.nim21934log stats plain blame
-rw-r--r--parseurl.nim2723log stats plain blame
-rw-r--r--rawsockets.nim593log stats plain blame
-rw-r--r--sockets.nim62188log stats plain blame
ght: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#
#
#           The Nim Compiler
#        (c) Copyright 2015 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

# This module contains a word recognizer, i.e. a simple
# procedure which maps special words to an enumeration.
# It is primarily needed because Pascal's case statement
# does not support strings. Without this the code would
# be slow and unreadable.

type
  TSpecialWord* = enum
    wInvalid = "",
    wAddr = "addr", wAnd = "and", wAs = "as", wAsm = "asm",
    wBind = "bind", wBlock = "block", wBreak = "break", wCase = "case", wCast = "cast",
    wConcept = "concept", wConst = "const", wContinue = "continue", wConverter = "converter",
    wDefer = "defer", wDiscard = "discard", wDistinct = "distinct", wDiv = "div", wDo = "do",
    wElif = "elif", wElse = "else", wEnd = "end", wEnum = "enum", wExcept = "except",
    wExport = "export", wFinally = "finally", wFor = "for", wFrom = "from", wFunc = "func",
    wIf = "if", wImport = "import", wIn = "in", wInclude = "include", wInterface = "interface",
    wIs = "is", wIsnot = "isnot",  wIterator = "iterator", wLet = "let", wMacro = "macro",
    wMethod = "method", wMixin = "mixin", wMod = "mod", wNil = "nil", wNot = "not", wNotin = "notin",
    wObject = "object", wOf = "of", wOr = "or", wOut = "out", wProc = "proc", wPtr = "ptr",
    wRaise = "raise", wRef = "ref", wReturn = "return", wShl = "shl", wShr = "shr", wStatic = "static",
    wTemplate = "template", wTry = "try", wTuple = "tuple", wType = "type", wUsing = "using",
    wVar = "var", wWhen = "when", wWhile = "while", wXor = "xor", wYield = "yield",

    wColon = ":", wColonColon = "::", wEquals = "=", wDot = ".", wDotDot = "..",
    wStar = "*", wMinus = "-",
    wUnderscore = "_",
    wMagic = "magic", wThread = "thread", wFinal = "final", wProfiler = "profiler",
    wMemTracker = "memtracker", wObjChecks = "objchecks",
    wIntDefine = "intdefine", wStrDefine = "strdefine", wBoolDefine = "booldefine",
    wCursor = "cursor", wNoalias = "noalias", wEffectsOf = "effectsOf",
    wUncheckedAssign = "uncheckedAssign", wRunnableExamples = "runnableExamples",

    wImmediate = "immediate", wConstructor = "constructor", wDestructor = "destructor",
    wDelegator = "delegator", wOverride = "override", wImportCpp = "importcpp",
    wCppNonPod = "cppNonPod",
    wImportObjC = "importobjc", wImportCompilerProc = "importCompilerProc",
    wImportc = "importc", wImportJs = "importjs", wExportc = "exportc", wExportCpp = "exportcpp",
    wExportNims = "exportnims",
    wIncompleteStruct = "incompleteStruct", # deprecated
    wCompleteStruct = "completeStruct", wRequiresInit = "requiresInit", wAlign = "align",
    wNodecl = "nodecl", wPure = "pure", wSideEffect = "sideEffect", wHeader = "header",
    wNoSideEffect = "noSideEffect", wGcSafe = "gcsafe", wNoreturn = "noreturn",
    wNosinks = "nosinks", wLib = "lib", wDynlib = "dynlib",
    wCompilerProc = "compilerproc", wCore = "core", wProcVar = "procvar",
    wBase = "base", wUsed = "used", wFatal = "fatal", wError = "error", wWarning = "warning",
    wHint = "hint",
    wWarningAsError = "warningAsError",
    wHintAsError = "hintAsError",
    wLine = "line", wPush = "push",
    wPop = "pop", wDefine = "define", wUndef = "undef", wLineDir = "lineDir",
    wStackTrace = "stackTrace", wLineTrace = "lineTrace", wLink = "link", wCompile = "compile",
    wLinksys = "linksys", wDeprecated = "deprecated", wVarargs = "varargs", wCallconv = "callconv",
    wDebugger = "debugger", wNimcall = "nimcall", wStdcall = "stdcall", wCdecl = "cdecl",
    wSafecall = "safecall", wSyscall = "syscall", wInline = "inline", wNoInline = "noinline",
    wFastcall = "fastcall", wThiscall = "thiscall", wClosure = "closure", wNoconv = "noconv",
    wOn = "on", wOff = "off", wChecks = "checks", wRangeChecks = "rangeChecks",
    wBoundChecks = "boundChecks", wOverflowChecks = "overflowChecks", wNilChecks = "nilChecks",
    wFloatChecks = "floatChecks", wNanChecks = "nanChecks", wInfChecks = "infChecks",
    wStyleChecks = "styleChecks", wStaticBoundchecks = "staticBoundChecks",
    wNonReloadable = "nonReloadable", wExecuteOnReload = "executeOnReload",

    wAssertions = "assertions", wPatterns = "patterns", wTrMacros = "trmacros",
    wSinkInference = "sinkInference", wWarnings = "warnings",
    wHints = "hints", wOptimization = "optimization", wRaises = "raises",
    wWrites = "writes", wReads = "reads", wSize = "size", wEffects = "effects", wTags = "tags",
    wForbids = "forbids", wRequires = "requires", wEnsures = "ensures", wInvariant = "invariant",
    wAssume = "assume", wAssert = "assert",
    wDeadCodeElimUnused = "deadCodeElim",  # deprecated, dead code elim always happens
    wSafecode = "safecode", wPackage = "package", wNoForward = "noforward", wReorder = "reorder",
    wNoRewrite = "norewrite", wNoDestroy = "nodestroy", wPragma = "pragma",
    wCompileTime = "compileTime", wNoInit = "noinit", wPassc = "passc", wPassl = "passl",
    wLocalPassc = "localPassC", wBorrow = "borrow", wDiscardable = "discardable",
    wFieldChecks = "fieldChecks", wSubsChar = "subschar", wAcyclic = "acyclic",
    wShallow = "shallow", wUnroll = "unroll", wLinearScanEnd = "linearScanEnd",
    wComputedGoto = "computedGoto", wExperimental = "experimental", wDoctype = "doctype",
    wWrite = "write", wGensym = "gensym", wInject = "inject", wDirty = "dirty",
    wInheritable = "inheritable", wThreadVar = "threadvar", wEmit = "emit",
    wAsmNoStackFrame = "asmNoStackFrame", wAsmSyntax = "asmSyntax", wImplicitStatic = "implicitStatic",
    wGlobal = "global", wCodegenDecl = "codegenDecl", wUnchecked = "unchecked",
    wGuard = "guard", wLocks = "locks", wPartial = "partial", wExplain = "explain",
    wLiftLocals = "liftlocals", wEnforceNoRaises = "enforceNoRaises", wSystemRaisesDefect = "systemRaisesDefect",
    wRedefine = "redefine", wCallsite = "callsite",
    wQuirky = "quirky",

    # codegen keywords, but first the ones that are also pragmas:
    wExtern = "extern", wGoto = "goto", wRegister = "register",
    wUnion = "union", wPacked = "packed", wVirtual = "virtual",
    wVolatile = "volatile", wMember = "member",
    wByCopy = "bycopy", wByRef = "byref",

    # codegen keywords but not pragmas:
    wAuto = "auto", wBool = "bool", wCatch = "catch", wChar = "char",
    wClass = "class", wCompl = "compl", wConstCast = "const_cast", wDefault = "default",
    wDelete = "delete", wDouble = "double", wDynamicCast = "dynamic_cast",
    wExplicit = "explicit", wFalse = "false", wFloat = "float",
    wFriend = "friend", wInt = "int", wLong = "long", wMutable = "mutable",
    wNamespace = "namespace", wNew = "new", wOperator = "operator", wPrivate = "private",
    wProtected = "protected", wPublic = "public",
    wReinterpretCast = "reinterpret_cast", wRestrict = "restrict", wShort = "short",
    wSigned = "signed", wSizeof = "sizeof", wStaticCast = "static_cast", wStruct = "struct",
    wSwitch = "switch", wThis = "this", wThrow = "throw", wTrue = "true", wTypedef = "typedef",
    wTypeid = "typeid", wTypeof = "typeof",  wTypename = "typename",
    wUnsigned = "unsigned", wVoid = "void", 

    wAlignas = "alignas", wAlignof = "alignof", wConstexpr = "constexpr", wDecltype = "decltype",
    wNullptr = "nullptr", wNoexcept = "noexcept",
    wThreadLocal = "thread_local", wStaticAssert = "static_assert",
    wChar16 = "char16_t", wChar32 = "char32_t", wWchar = "wchar_t",

    wStdIn = "stdin", wStdOut = "stdout", wStdErr = "stderr",

    wInOut = "inout", wOneWay = "oneway",
    # end of codegen keywords

    wBitsize = "bitsize", wImportHidden = "all",
    wSendable = "sendable"

  TSpecialWords* = set[TSpecialWord]

const
  oprLow* = ord(wColon)
  oprHigh* = ord(wDotDot)

  nimKeywordsLow* = ord(wAsm)
  nimKeywordsHigh* = ord(wYield)

  ccgKeywordsLow* = ord(wExtern)
  ccgKeywordsHigh* = ord(wOneWay)

  cppNimSharedKeywords* = {
    wAsm, wBreak, wCase, wConst, wContinue, wDo, wElse, wEnum, wExport,
    wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing}
  
  nonPragmaWordsLow* = wAuto
  nonPragmaWordsHigh* = wOneWay


from std/enumutils import genEnumCaseStmt
from std/strutils import normalize
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
  genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize)