==================== Nim Standard Library ==================== :Author: Andreas Rumpf :Version: |nimversion| .. default-role:: code .. include:: rstcommon.rst .. contents:: Nim's library is divided into *pure libraries*, *impure libraries*, and *wrappers*. Pure libraries do not depend on any external ``*.dll`` or ``lib*.so`` binary while impure libraries do. A wrapper is an impure library that is a very low-level interface to a C library. Read this `document `_ for a quick overview of the API design. Nimble ====== Nim's standard library only covers the basics, check out ``_ for a list of 3rd party packages. Pure libraries ============== Automatic imports ----------------- * `system `_ Basic procs and operators that every program needs. It also provides IO facilities for reading and writing text and binary files. It is imported implicitly by the compiler. Do not import it directly. It relies on compiler magic to work. * `threads `_ Basic Nim thread support. **Note:** This is part of the system module. Do not import it explicitly. Enabled with `--threads:on`:option:. * `channels_builtin `_ Nim message passing support for threads. **Note:** This is part of the system module. Do not import it explicitly. Enabled with `--threads:on`:option:. Core ---- * `atomics `_ Types and operations for atomic operations and lockless algorithms. * `bitops `_ Provides a series of low-level methods for bit manipulation. * `cpuinfo `_ This module implements procs to determine the number of CPUs / cores. * `endians `_ This module contains helpers that deal with different byte orders. * `lenientops `_ Provides binary operators for mixed integer/float expressions for convenience. * `locks `_ Locks and condition variables for Nim. * `macrocache `_ Provides an API for macros to collect compile-time information across modules. * `macros `_ Contains the AST API and documentation of Nim for writing macros. * `rlocks `_ Reentrant locks for Nim. * `typeinfo `_ Provides (unsafe) access to Nim's run-time type information. * `typetraits `_ This module defines compile-time reflection procs for working with types. * `volatile `_ This module contains code for generating volatile loads and stores, which are useful in embedded and systems programming. Algorithms ---------- * `algorithm `_ This module implements some common generic algorithms like sort or binary search. * `enumutils `_ This module adds functionality for the built-in `enum` type. * `sequtils `_ This module implements operations for the built-in `seq` type which were inspired by functional programming languages. * `setutils `_ This module adds functionality for the built-in `set` type. Collections ----------- * `critbits `_ This module implements a *crit bit tree* which is an efficient container for a sorted set of strings, or a sorted mapping of strings. * `deques `_ Implementation of a double-ended queue. The underlying implementation uses a `seq`. * `heapqueue `_ Implementation of a binary heap data structure that can be used as a priority queue. * `intsets `_ Efficient implementation of a set of ints as a sparse bit set. * `lists `_ Nim linked list support. Contains singly and doubly linked lists and circular lists ("rings"). * `options `_ The option type encapsulates an optional value. * `packe
discard """
  output: "a\"\"long string\"\"\"\"\"abc\"def_'2'●𝌆𝌆A"
"""
# Test the new different string literals

const
  tripleEmpty = """"long string"""""""" # "long string """""

  rawQuote = r"a"""

  raw = r"abc""def"

  escaped = "\x5f'\50'\u25cf\u{1D306}\u{1d306}\u{41}"


stdout.write(rawQuote)
stdout.write(tripleEmpty)
stdout.write(raw)
stdout.writeLine(escaped)
s a simple high-performance CSV parser. * `parsejson `_ This module implements a JSON parser. It is used and exported by the `json `_ module, but can also be used in its own right. * `parseopt `_ The `parseopt` module implements a command line option parser. * `parsesql `_ The `parsesql` module implements a simple high-performance SQL parser. * `parsexml `_ The `parsexml` module implements a simple high performance XML/HTML parser. The only encoding that is supported is UTF-8. The parser has been designed to be somewhat error-correcting, so that even some "wild HTML" found on the web can be parsed with it. Docutils -------- * `packages/docutils/highlite `_ Source highlighter for programming or markup languages. Currently, only a few languages are supported, other languages may be added. The interface supports one language nested in another. * `packages/docutils/rst `_ This module implements a reStructuredText parser. A large subset is implemented. Some features of the markdown wiki syntax are also supported. * `packages/docutils/rstast `_ This module implements an AST for the reStructuredText parser. * `packages/docutils/rstgen `_ This module implements a generator of HTML/Latex from reStructuredText. XML Processing -------------- * `xmltree `_ A simple XML tree. More efficient and simpler than the DOM. It also contains a macro for XML/HTML code generation. * `xmlparser `_ This module parses an XML document and creates its XML tree representation. Generators ---------- * `htmlgen `_ This module implements a simple XML and HTML code generator. Each commonly used HTML tag has a corresponding macro that generates a string with its HTML representation. Hashing ------- * `base64 `_ This module implements a Base64 encoder and decoder. * `hashes `_ This module implements efficient computations of hash values for diverse Nim types. * `md5 `_ This module implements the MD5 checksum algorithm. * `oids `_ An OID is a global ID that consists of a timestamp, a unique counter, and a random value. This combination should suffice to produce a globally distributed unique ID. This implementation was extracted from the MongoDB interface and it thus binary compatible with a MongoDB OID. * `sha1 `_ This module implements the SHA-1 checksum algorithm. Miscellaneous ------------- * `browsers `_ This module implements procs for opening URLs with the user's default browser. * `colors `_ This module implements color handling for Nim. * `coro `_ This module implements experimental coroutines in Nim. * `enumerate `_ This module implements `enumerate` syntactic sugar based on Nim's macro system. * `logging `_ This module implements a simple logger. * `segfaults `_ Turns access violations or segfaults into a `NilAccessDefect` exception. * `sugar `_ This module implements nice syntactic sugar based on Nim's macro system. * `unittest `_ Implements a Unit testing DSL. * `varints `_ Decode variable-length integers that are compatible with SQLite. * `with `_ This module implements the `with` macro for easy function chaining. Modules for the JS backend -------------------------- * `asyncjs `_ Types and macros for writing asynchronous procedures in JavaScript. * `dom `_ Declaration of the Document Object Model for the JS backend. * `jsbigints `_ Arbitrary precision integers. * `jsconsole `_ Wrapper for the `console` object. * `jscore `_ The wrapper of core JavaScript functions. For most purposes, you should be using the `math`, `json`, and `times` stdlib modules instead of this module. * `jsffi `_ Types and macros for easier interaction with JavaScript. Impure libraries ================ Regular expressions ------------------- * `re `_ This module contains procedures and operators for handling regular expressions. The current implementation uses PCRE. Database support ---------------- * `db_postgres `_ A higher level PostgreSQL database wrapper. The same interface is implemented for other databases too. * `db_mysql `_ A higher level MySQL database wrapper. The same interface is implemented for other databases too. * `db_sqlite `_ A higher level SQLite database wrapper. The same interface is implemented for other databases too. Generic Operating System Services --------------------------------- * `rdstdin `_ This module contains code for reading from stdin. Wrappers ======== The generated HTML for some of these wrappers is so huge that it is not contained in the distribution. You can then find them on the website. Windows-specific ---------------- * `winlean `_ Contains a wrapper for a small subset of the Win32 API. * `registry `_ Windows registry support. UNIX specific ------------- * `posix `_ Contains a wrapper for the POSIX standard. * `posix_utils `_ Contains helpers for the POSIX standard or specialized for Linux and BSDs. Regular expressions ------------------- * `pcre `_ Wrapper for the PCRE library. Database support ---------------- * `postgres `_ Contains a wrapper for the PostgreSQL API. * `mysql `_ Contains a wrapper for the mySQL API. * `sqlite3 `_ Contains a wrapper for the SQLite 3 API. * `odbcsql `_ interface to the ODBC driver. Network Programming and Internet Protocols ------------------------------------------ * `openssl `_ Wrapper for OpenSSL.