summary refs log tree commit diff stats
path: root/doc/keywords.txt
Commit message (Expand)AuthorAgeFilesLines
* breaking change: 'concept' is now a keyword and used instead of 'generic'Araq2015-03-231-1/+1
* destuctors are experimental; 'func' is now a keywordAraq2014-12-101-1/+1
* implements 'defer'Araq2014-12-041-1/+1
* 'lambda' is no keyword anymoreAraq2014-08-081-1/+1
* new concurrency model: first steps; shared is not a keyword anymoreAraq2014-04-141-1/+1
* bugfix: keywords are sortedAraq2013-12-051-1/+2
* implemented the using statementZahary Karadjov2013-08-311-1/+1
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* made 'shared' a keywordAraq2012-11-221-1/+1
* 'mixin' and 'interface' are now keywordsAraq2012-09-221-2/+2
* first steps for cleaner static/const distinctionAraq2012-03-131-1/+1
* `do' keyword in the grammar for lambda blocksZahary Karadjov2012-02-101-2/+3
* 'export' is now a keywordAraq2011-11-241-1/+1
* support for C++ code generation; importcpp and importobjc pragmasAraq2011-08-071-1/+1
* tiny C support; cosmetic improvements for the docsAraq2010-08-281-0/+19
.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 2017 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## This module implements the generation of ``.ndi`` files for better debugging
## support of Nim code. "ndi" stands for "Nim debug info".

import ast, msgs, ropes, options, pathutils

when defined(nimPreviewSlimSystem):
  import std/[syncio, assertions]

type
  NdiFile* = object
    enabled: bool
    f: File
    buf: string
    filename: AbsoluteFile
    syms: seq[PSym]

proc doWrite(f: var NdiFile; s: PSym; conf: ConfigRef) =
  f.buf.setLen 0
  f.buf.addInt s.info.line.int
  f.buf.add "\t"
  f.buf.addInt s.info.col.int
  f.f.write(s.name.s, "\t")
  f.f.writeRope(s.loc.r)
  f.f.writeLine("\t", toFullPath(conf, s.info), "\t", f.buf)

template writeMangledName*(f: NdiFile; s: PSym; conf: ConfigRef) =
  if f.enabled: f.syms.add s

proc open*(f: var NdiFile; filename: AbsoluteFile; conf: ConfigRef) =
  f.enabled = not filename.isEmpty
  if f.enabled:
    f.filename = filename
    f.buf = newStringOfCap(20)

proc close*(f: var NdiFile, conf: ConfigRef) =
  if f.enabled:
    f.f = open(f.filename.string, fmWrite, 8000)
    doAssert f.f != nil, f.filename.string
    for s in f.syms:
      doWrite(f, s, conf)
    close(f.f)
    f.syms.reset
    f.filename.reset