Merge pull request #3831 from ephja/nimrod-to-nim

nimrod -> nim
This commit is contained in:
Andreas Rumpf 2016-02-06 15:24:09 +01:00
commit 981974ab11
15 changed files with 26 additions and 26 deletions

View file

@ -137,7 +137,7 @@ proc sameValue*(a, b: PNode): bool =
of nkStrLit..nkTripleStrLit: of nkStrLit..nkTripleStrLit:
if b.kind in {nkStrLit..nkTripleStrLit}: result = a.strVal == b.strVal if b.kind in {nkStrLit..nkTripleStrLit}: result = a.strVal == b.strVal
else: else:
# don't raise an internal error for 'nimrod check': # don't raise an internal error for 'nim check':
#InternalError(a.info, "SameValue") #InternalError(a.info, "SameValue")
discard discard
@ -152,7 +152,7 @@ proc leValue*(a, b: PNode): bool =
of nkStrLit..nkTripleStrLit: of nkStrLit..nkTripleStrLit:
if b.kind in {nkStrLit..nkTripleStrLit}: result = a.strVal <= b.strVal if b.kind in {nkStrLit..nkTripleStrLit}: result = a.strVal <= b.strVal
else: else:
# don't raise an internal error for 'nimrod check': # don't raise an internal error for 'nim check':
#InternalError(a.info, "leValue") #InternalError(a.info, "leValue")
discard discard

View file

@ -24,7 +24,7 @@ proc accessThreadLocalVar(p: BProc, s: PSym) =
ropecg(p.module, "\tNimTV = (NimThreadVars*) #GetThreadLocalVars();$n")) ropecg(p.module, "\tNimTV = (NimThreadVars*) #GetThreadLocalVars();$n"))
var var
nimtv: Rope # nimrod thread vars; the struct body nimtv: Rope # Nim thread vars; the struct body
nimtvDeps: seq[PType] = @[] # type deps: every module needs whole struct nimtvDeps: seq[PType] = @[] # type deps: every module needs whole struct
nimtvDeclared = initIntSet() # so that every var/field exists only once nimtvDeclared = initIntSet() # so that every var/field exists only once
# in the struct # in the struct

View file

@ -47,7 +47,7 @@ proc mangleName(s: PSym): Rope =
# I need to study where these come from. # I need to study where these come from.
# #
# about sfShadowed: # about sfShadowed:
# consider the following nimrod code: # consider the following Nim code:
# var x = 10 # var x = 10
# block: # block:
# var x = something(x) # var x = something(x)
@ -64,7 +64,7 @@ proc mangleName(s: PSym): Rope =
# use that in the inner scope. # use that in the inner scope.
# #
# about isCKeyword: # about isCKeyword:
# nimrod variable names can be C keywords. # Nim variable names can be C keywords.
# We need to avoid such names in the generated code. # We need to avoid such names in the generated code.
# XXX: Study whether mangleName is called just once per variable. # XXX: Study whether mangleName is called just once per variable.
# Otherwise, there might be better place to do this. # Otherwise, there might be better place to do this.

View file

@ -44,7 +44,7 @@ proc toGid(f: string): string =
# we used to use ``f.addFileExt("gid")`` (aka ``$project.gid``), but this # we used to use ``f.addFileExt("gid")`` (aka ``$project.gid``), but this
# will cause strange bugs if multiple projects are in the same folder, so # will cause strange bugs if multiple projects are in the same folder, so
# we simply use a project independent name: # we simply use a project independent name:
result = options.completeGeneratedFilePath("nimrod.gid") result = options.completeGeneratedFilePath("nim.gid")
proc saveMaxIds*(project: string) = proc saveMaxIds*(project: string) =
var f = open(project.toGid, fmWrite) var f = open(project.toGid, fmWrite)

View file

@ -147,8 +147,8 @@ var
gDllOverrides = newStringTable(modeCaseInsensitive) gDllOverrides = newStringTable(modeCaseInsensitive)
gPrefixDir* = "" # Overrides the default prefix dir in getPrefixDir proc. gPrefixDir* = "" # Overrides the default prefix dir in getPrefixDir proc.
libpath* = "" libpath* = ""
gProjectName* = "" # holds a name like 'nimrod' gProjectName* = "" # holds a name like 'nim'
gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/ gProjectPath* = "" # holds a path like /home/alice/projects/nim/compiler/
gProjectFull* = "" # projectPath/projectName gProjectFull* = "" # projectPath/projectName
gProjectIsStdin* = false # whether we're compiling from stdin gProjectIsStdin* = false # whether we're compiling from stdin
gProjectMainIdx*: int32 # the canonical path id of the main module gProjectMainIdx*: int32 # the canonical path id of the main module

View file

@ -10,7 +10,7 @@
# This module contains data about the different processors # This module contains data about the different processors
# and operating systems. # and operating systems.
# Note: Unfortunately if an OS or CPU is listed here this does not mean that # Note: Unfortunately if an OS or CPU is listed here this does not mean that
# Nimrod has been tested on this platform or that the RTL has been ported. # Nim has been tested on this platform or that the RTL has been ported.
# Feel free to test for your excentric platform! # Feel free to test for your excentric platform!
import import

View file

@ -3,7 +3,7 @@
import backend, parseopt, strutils import backend, parseopt, strutils
const const
USAGE = """nimcalculator - Nimrod cross platform calculator USAGE = """nimcalculator - Nim cross platform calculator
(beta version, only integer addition is supported!) (beta version, only integer addition is supported!)
Usage: Usage:

View file

@ -3,7 +3,7 @@
import backend, db_sqlite, os, parseopt, parseutils, strutils, times import backend, db_sqlite, os, parseopt, parseutils, strutils, times
const const
USAGE = """nimtodo - Nimrod cross platform todo manager USAGE = """nimtodo - Nim cross platform todo manager
Usage: Usage:
nimtodo [command] [list options] nimtodo [command] [list options]
@ -195,7 +195,7 @@ proc generateDatabaseRows(conn: DbConn) =
## Adds some rows to the database ignoring errors. ## Adds some rows to the database ignoring errors.
discard conn.addTodo(1, "Watch another random youtube video") discard conn.addTodo(1, "Watch another random youtube video")
discard conn.addTodo(2, "Train some starcraft moves for the league") discard conn.addTodo(2, "Train some starcraft moves for the league")
discard conn.addTodo(3, "Spread the word about Nimrod") discard conn.addTodo(3, "Spread the word about Nim")
discard conn.addTodo(4, "Give fruit superavit to neighbours") discard conn.addTodo(4, "Give fruit superavit to neighbours")
var todo = conn.addTodo(4, "Send tax form through snail mail") var todo = conn.addTodo(4, "Send tax form through snail mail")
todo.isDone = true todo.isDone = true

View file

@ -28,6 +28,6 @@ html mainPage:
title "now look at this" title "now look at this"
body: body:
ul: ul:
li "Nimrod is quite capable" li "Nim is quite capable"
echo mainPage() echo mainPage()

View file

@ -1518,7 +1518,7 @@ proc dirInclude(p: var RstParser): PRstNode =
# InternalError("Too many binary zeros in include file") # InternalError("Too many binary zeros in include file")
result = parseDoc(q) result = parseDoc(q)
proc dirCodeBlock(p: var RstParser, nimrodExtension = false): PRstNode = proc dirCodeBlock(p: var RstParser, nimExtension = false): PRstNode =
## Parses a code block. ## Parses a code block.
## ##
## Code blocks are rnDirective trees with a `kind` of rnCodeBlock. See the ## Code blocks are rnDirective trees with a `kind` of rnCodeBlock. See the
@ -1526,8 +1526,8 @@ proc dirCodeBlock(p: var RstParser, nimrodExtension = false): PRstNode =
## ##
## Code blocks can come in two forms, the standard `code directive ## Code blocks can come in two forms, the standard `code directive
## <http://docutils.sourceforge.net/docs/ref/rst/directives.html#code>`_ and ## <http://docutils.sourceforge.net/docs/ref/rst/directives.html#code>`_ and
## the nimrod extension ``.. code-block::``. If the block is an extension, we ## the nim extension ``.. code-block::``. If the block is an extension, we
## want the default language syntax highlighting to be Nimrod, so we create a ## want the default language syntax highlighting to be Nim, so we create a
## fake internal field to comminicate with the generator. The field is named ## fake internal field to comminicate with the generator. The field is named
## ``default-language``, which is unlikely to collide with a field specified ## ``default-language``, which is unlikely to collide with a field specified
## by any random rst input file. ## by any random rst input file.
@ -1545,16 +1545,16 @@ proc dirCodeBlock(p: var RstParser, nimrodExtension = false): PRstNode =
result.sons[2] = n result.sons[2] = n
# Extend the field block if we are using our custom extension. # Extend the field block if we are using our custom extension.
if nimrodExtension: if nimExtension:
# Create a field block if the input block didn't have any. # Create a field block if the input block didn't have any.
if result.sons[1].isNil: result.sons[1] = newRstNode(rnFieldList) if result.sons[1].isNil: result.sons[1] = newRstNode(rnFieldList)
assert result.sons[1].kind == rnFieldList assert result.sons[1].kind == rnFieldList
# Hook the extra field and specify the Nimrod language as value. # Hook the extra field and specify the Nim language as value.
var extraNode = newRstNode(rnField) var extraNode = newRstNode(rnField)
extraNode.add(newRstNode(rnFieldName)) extraNode.add(newRstNode(rnFieldName))
extraNode.add(newRstNode(rnFieldBody)) extraNode.add(newRstNode(rnFieldBody))
extraNode.sons[0].add(newRstNode(rnLeaf, "default-language")) extraNode.sons[0].add(newRstNode(rnLeaf, "default-language"))
extraNode.sons[1].add(newRstNode(rnLeaf, "Nimrod")) extraNode.sons[1].add(newRstNode(rnLeaf, "Nim"))
result.sons[1].add(extraNode) result.sons[1].add(extraNode)
result.kind = rnCodeBlock result.kind = rnCodeBlock
@ -1641,7 +1641,7 @@ proc parseDotDot(p: var RstParser): PRstNode =
else: else:
rstMessage(p, meInvalidDirective, d) rstMessage(p, meInvalidDirective, d)
of dkCode: result = dirCodeBlock(p) of dkCode: result = dirCodeBlock(p)
of dkCodeBlock: result = dirCodeBlock(p, nimrodExtension = true) of dkCodeBlock: result = dirCodeBlock(p, nimExtension = true)
of dkIndex: result = dirIndex(p) of dkIndex: result = dirIndex(p)
else: rstMessage(p, meInvalidDirective, d) else: rstMessage(p, meInvalidDirective, d)
popInd(p) popInd(p)

View file

@ -812,7 +812,7 @@ proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
if parseInt(n.getFieldValue, number) > 0: if parseInt(n.getFieldValue, number) > 0:
params.startLine = number params.startLine = number
of "file": of "file":
# The ``file`` option is a Nimrod extension to the official spec, it acts # The ``file`` option is a Nim extension to the official spec, it acts
# like it would for other directives like ``raw`` or ``cvs-table``. This # like it would for other directives like ``raw`` or ``cvs-table``. This
# field is dealt with in ``rst.nim`` which replaces the existing block with # field is dealt with in ``rst.nim`` which replaces the existing block with
# the referenced file, so we only need to ignore it here to avoid incorrect # the referenced file, so we only need to ignore it here to avoid incorrect
@ -881,7 +881,7 @@ proc renderCodeBlock(d: PDoc, n: PRstNode, result: var string) =
## second the code block itself. The code block can use syntax highlighting, ## second the code block itself. The code block can use syntax highlighting,
## which depends on the directive argument specified by the rst input, and ## which depends on the directive argument specified by the rst input, and
## may also come from the parser through the internal ``default-language`` ## may also come from the parser through the internal ``default-language``
## option to differentiate between a plain code block and nimrod's code block ## option to differentiate between a plain code block and Nim's code block
## extension. ## extension.
assert n.kind == rnCodeBlock assert n.kind == rnCodeBlock
if n.sons[2] == nil: return if n.sons[2] == nil: return

View file

@ -951,7 +951,7 @@ when isMainModule and not defined(release):
var b = initOrderedSet[int]() var b = initOrderedSet[int]()
for x in [2, 4, 5]: b.incl(x) for x in [2, 4, 5]: b.incl(x)
assert($a == $b) assert($a == $b)
assert(a == b) # https://github.com/Araq/Nimrod/issues/1413 assert(a == b) # https://github.com/Araq/Nim/issues/1413
block initBlocks: block initBlocks:
var a: OrderedSet[int] var a: OrderedSet[int]

View file

@ -6,7 +6,7 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
## This module implements color handling for Nimrod. It is used by ## This module implements color handling for Nim. It is used by
## the ``graphics`` module. ## the ``graphics`` module.
import strutils import strutils

View file

@ -134,7 +134,7 @@ macro `[]`*(lc: ListComprehension, comp, typ: expr): expr =
## comprehension, for example ``x | (x <- 1..10, x mod 2 == 0)``. `typ` is ## comprehension, for example ``x | (x <- 1..10, x mod 2 == 0)``. `typ` is
## the type that will be stored inside the result seq. ## the type that will be stored inside the result seq.
## ##
## .. code-block:: nimrod ## .. code-block:: nim
## ##
## echo lc[x | (x <- 1..10, x mod 2 == 0), int] ## echo lc[x | (x <- 1..10, x mod 2 == 0), int]
## ##

View file

@ -1,4 +1,4 @@
## Command line parsing module for Nimrod. ## Command line parsing module for Nim.
## ##
## `Nim <http://nim-lang.org>`_ provides the `parseopt module ## `Nim <http://nim-lang.org>`_ provides the `parseopt module
## <http://nim-lang.org/parseopt.html>`_ to parse options from the ## <http://nim-lang.org/parseopt.html>`_ to parse options from the