mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
further adaptations
This commit is contained in:
@@ -25,7 +25,7 @@ proc launchSwarm(port: TPort) {.async.} =
|
||||
await sendMessages(sock)
|
||||
closeSocket(sock)
|
||||
else:
|
||||
# Issue #932: https://github.com/Araq/Nimrod/issues/932
|
||||
# Issue #932: https://github.com/Araq/Nim/issues/932
|
||||
var msgFut = sendMessages(sock)
|
||||
msgFut.callback =
|
||||
proc () =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
file: "tasynciossl.nim"
|
||||
cmd: "nimrod $target --hints:on --define:ssl $options $file"
|
||||
cmd: "nim $target --hints:on --define:ssl $options $file"
|
||||
output: "20000"
|
||||
"""
|
||||
import sockets, asyncio, strutils, times
|
||||
|
||||
@@ -51,7 +51,7 @@ proc `$`*(status: TStatusEnum): string =
|
||||
return "unknown"
|
||||
|
||||
proc makeCommitPath*(platform, hash: string): string =
|
||||
return platform / "nimrod_" & hash.substr(0, 11) # 11 Chars.
|
||||
return platform / "nim_" & hash.substr(0, 11) # 11 Chars.
|
||||
|
||||
type
|
||||
TFlag = enum
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
outputsub: "101"
|
||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import os, locks
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
output: "Done"
|
||||
cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl $options $file"
|
||||
cmd: "nim $target --debuginfo --hints:on --define:useNimRtl $options $file"
|
||||
"""
|
||||
|
||||
type
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file"
|
||||
cmd: "nim $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file"
|
||||
"""
|
||||
|
||||
type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
file: "tfloat3.nim"
|
||||
output: "Nimrod 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
|
||||
output: "Nim 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
|
||||
"""
|
||||
|
||||
import math, strutils
|
||||
@@ -17,7 +17,7 @@ proc c_printf(frmt: CString) {.importc: "printf", header: "<stdio.h>", varargs.}
|
||||
proc printFloats {.importc, nodecl.}
|
||||
|
||||
var x: float = 1.234567890123456789
|
||||
c_printf("Nimrod %.10f, %.10f ", exp(x), cos(x))
|
||||
c_printf("Nim %.10f, %.10f ", exp(x), cos(x))
|
||||
printFloats()
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- nimrod -*-
|
||||
# -*- nim -*-
|
||||
|
||||
import os, strutils
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##
|
||||
## can_alias_generic Nimrod Module
|
||||
## can_alias_generic Nim Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
@@ -3,7 +3,7 @@ discard """
|
||||
"""
|
||||
|
||||
##
|
||||
## can_alias_specialised_generic Nimrod Module
|
||||
## can_alias_specialised_generic Nim Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##
|
||||
## can_inherit_generic Nimrod Module
|
||||
## can_inherit_generic Nim Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##
|
||||
## can_specialise_generic Nimrod Module
|
||||
## can_specialise_generic Nim Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
@@ -5,7 +5,7 @@ discard """
|
||||
3'''
|
||||
"""
|
||||
|
||||
# https://github.com/Araq/Nimrod/issues/797
|
||||
# https://github.com/Araq/Nim/issues/797
|
||||
proc foo[T](s:T):string = $s
|
||||
|
||||
type IntStringProc = proc(x: int): string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "nimrod check $options $file"
|
||||
cmd: "nim check $options $file"
|
||||
errormsg: "'proc' is not a concrete type"
|
||||
errormsg: "'Foo' is not a concrete type."
|
||||
errormsg: "invalid type: 'TBaseMed'"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##
|
||||
## specialised_is_equivalent Nimrod Module
|
||||
## specialised_is_equivalent Nim Module
|
||||
##
|
||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||
## Copyright (c) 2011 FWA. All rights reserved.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||
"""
|
||||
|
||||
type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
output: '''true'''
|
||||
cmd: "nimrod $target --gc:none --hints:on --warnings:off $options $file"
|
||||
cmd: "nim $target --gc:none --hints:on --warnings:off $options $file"
|
||||
"""
|
||||
|
||||
import hashes
|
||||
|
||||
@@ -7,7 +7,7 @@ x: some string'''
|
||||
import macros
|
||||
|
||||
macro debug(n: varargs[expr]): stmt =
|
||||
# `n` is a Nimrod AST that contains the whole macro invocation
|
||||
# `n` is a Nim AST that contains the whole macro invocation
|
||||
# this macro returns a list of statements:
|
||||
result = newNimNode(nnkStmtList, n)
|
||||
# iterate over any argument that is passed to this macro:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Command line parsing module for Nimrod.
|
||||
##
|
||||
## `Nimrod <http://nimrod-code.org>`_ provides the `parseopt module
|
||||
## <http://nimrod-code.org/parseopt.html>`_ to parse options from the
|
||||
## `Nim <http://nim-code.org>`_ provides the `parseopt module
|
||||
## <http://nim-code.org/parseopt.html>`_ to parse options from the
|
||||
## commandline. This module tries to provide functionality to prevent you from
|
||||
## writing commandline parsing and let you concentrate on providing the best
|
||||
## possible experience for your users.
|
||||
@@ -169,7 +169,7 @@ template new_parsed_parameter*(tkind: Tparam_kind, expr): Tparsed_parameter =
|
||||
## assign the variable to, and thus you reduce code clutter and may use this
|
||||
## to initialise single assignments variables in `let` blocks. Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## let
|
||||
## parsed_param1 = new_parsed_parameter(PK_FLOAT, 3.41)
|
||||
## parsed_param2 = new_parsed_parameter(PK_BIGGEST_INT, 2358123 * 23123)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
const Lib = "libchipmunk.so.6.1.1"
|
||||
|
||||
when defined(MoreNimrod):
|
||||
{.hint: "MoreNimrod defined; some Chipmunk functions replaced in Nimrod".}
|
||||
when defined(MoreNim):
|
||||
{.hint: "MoreNim defined; some Chipmunk functions replaced in Nim".}
|
||||
{.deadCodeElim: on.}
|
||||
from math import sqrt, sin, cos, arctan2
|
||||
when defined(CpUseFloat):
|
||||
@@ -729,7 +729,7 @@ proc isRogue*(body: PBody): Bool {.inline.} =
|
||||
|
||||
defGetter(PBody, CpFloat, m, Mass)
|
||||
#/ Set the mass of a body.
|
||||
when defined(MoreNimrod):
|
||||
when defined(MoreNim):
|
||||
defSetter(PBody, CpFloat, m, Mass)
|
||||
else:
|
||||
proc setMass*(body: PBody; m: CpFloat){.
|
||||
@@ -738,7 +738,7 @@ else:
|
||||
#/ Get the moment of a body.
|
||||
defGetter(PBody, CpFloat, i, Moment)
|
||||
#/ Set the moment of a body.
|
||||
when defined(MoreNimrod):
|
||||
when defined(MoreNim):
|
||||
defSetter(PBody, CpFloat, i, Moment)
|
||||
else:
|
||||
proc SetMoment*(body: PBody; i: CpFloat) {.
|
||||
@@ -747,7 +747,7 @@ else:
|
||||
#/ Get the position of a body.
|
||||
defGetter(PBody, TVector, p, Pos)
|
||||
#/ Set the position of a body.
|
||||
when defined(MoreNimrod):
|
||||
when defined(MoreNim):
|
||||
defSetter(PBody, TVector, p, Pos)
|
||||
else:
|
||||
proc setPos*(body: PBody; pos: TVector) {.
|
||||
@@ -1088,7 +1088,7 @@ proc getSegmentRadius*(shape: PShape): CpFloat {.
|
||||
#var VersionString*{.importc: "cpVersionString", dynlib: Lib.}: cstring
|
||||
#/ Calculate the moment of inertia for a circle.
|
||||
#/ @c r1 and @c r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.
|
||||
when defined(MoreNimrod):
|
||||
when defined(MoreNim):
|
||||
proc momentForCircle*(m, r1, r2: CpFloat; offset: TVector): CpFloat {.cdecl.} =
|
||||
result = m * (0.5 * (r1 * r1 + r2 * r2) + lenSq(offset))
|
||||
else:
|
||||
|
||||
@@ -58,7 +58,7 @@ when isMainModule:
|
||||
for i in 1..paramCount():
|
||||
args.add paramStr(i)
|
||||
args.add " "
|
||||
quit(shell("nimrod", "c", "-r", "nakefile.nim", args))
|
||||
quit(shell("nim", "c", "-r", "nakefile.nim", args))
|
||||
else:
|
||||
addQuitProc(proc() {.noconv.} =
|
||||
var
|
||||
|
||||
@@ -2,7 +2,7 @@ import nake
|
||||
nakeImports
|
||||
|
||||
task "install", "compile and install nake binary":
|
||||
if shell("nimrod", "c", "nake") == 0:
|
||||
if shell("nim", "c", "nake") == 0:
|
||||
let path = getEnv("PATH").split(PathSep)
|
||||
for index, dir in pairs(path):
|
||||
echo " ", index, ". ", dir
|
||||
|
||||
@@ -5,9 +5,9 @@ const
|
||||
ServerDefines = "-d:NoSFML --forceBuild"
|
||||
|
||||
task "server", "build the server":
|
||||
if shell("nimrod", ServerDefines, "-r", "compile", "enet_server") != 0:
|
||||
if shell("nim", ServerDefines, "-r", "compile", "enet_server") != 0:
|
||||
quit "Failed to build"
|
||||
task "gui", "build the server GUI mode":
|
||||
if shell("nimrod", "--app:gui", ServerDefines, "-r", "compile", "enet_server") != 0:
|
||||
if shell("nim", "--app:gui", ServerDefines, "-r", "compile", "enet_server") != 0:
|
||||
quit "Failed to build"
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ when isMainModule:
|
||||
for i in 1..paramCount():
|
||||
args.add paramStr(i)
|
||||
args.add " "
|
||||
quit(shell("nimrod", "c", "-r", "nakefile.nim", args))
|
||||
quit(shell("nim", "c", "-r", "nakefile.nim", args))
|
||||
else:
|
||||
addQuitProc(proc() {.noconv.} =
|
||||
var
|
||||
|
||||
@@ -9,16 +9,16 @@ const
|
||||
BinLibs = "http://dl.dropbox.com/u/37533467/libs-2012-09-12.zip"
|
||||
ExeName = "keineschweine"
|
||||
ServerDefines = "-d:NoSFML -d:NoChipmunk"
|
||||
TestBuildDefines = "-d:escapeMenuTest -d:debugWeps -d:showFPS -d:moreNimrod -d:debugKeys -d:foo -d:recordMode --forceBuild"
|
||||
TestBuildDefines = "-d:escapeMenuTest -d:debugWeps -d:showFPS -d:moreNim -d:debugKeys -d:foo -d:recordMode --forceBuild"
|
||||
ReleaseDefines = "-d:release --deadCodeElim:on"
|
||||
ReleaseTestDefines = "-d:debugWeps -d:debugKeys --forceBuild"
|
||||
|
||||
task "testprofile", "..":
|
||||
if shell("nimrod", TestBuildDefines, "--profiler:on", "--stacktrace:on", "compile", ExeName) == 0:
|
||||
if shell("nim", TestBuildDefines, "--profiler:on", "--stacktrace:on", "compile", ExeName) == 0:
|
||||
shell "."/ExeName, "offline"
|
||||
|
||||
task "test", "Build with test defines":
|
||||
if shell("nimrod", TestBuildDefines, "compile", ExeName) != 0:
|
||||
if shell("nim", TestBuildDefines, "compile", ExeName) != 0:
|
||||
quit "The build failed."
|
||||
|
||||
task "testrun", "Build with test defines and run":
|
||||
@@ -26,22 +26,22 @@ task "testrun", "Build with test defines and run":
|
||||
shell "."/ExeName
|
||||
|
||||
task "test2", "Build release test build test release build":
|
||||
if shell("nimrod", ReleaseDefines, ReleaseTestDefines, "compile", ExeName) == 0:
|
||||
if shell("nim", ReleaseDefines, ReleaseTestDefines, "compile", ExeName) == 0:
|
||||
shell "."/ExeName
|
||||
|
||||
discard """task "dirserver", "build the directory server":
|
||||
withDir "server":
|
||||
if shell("nimrod", ServerDefines, "compile", "dirserver") != 0:
|
||||
if shell("nim", ServerDefines, "compile", "dirserver") != 0:
|
||||
echo "Failed to build the dirserver"
|
||||
quit 1"""
|
||||
|
||||
task "zoneserver", "build the zone server":
|
||||
withDir "enet_server":
|
||||
if shell("nimrod", ServerDefines, "compile", "enet_server") != 0:
|
||||
if shell("nim", ServerDefines, "compile", "enet_server") != 0:
|
||||
quit "Failed to build the zoneserver"
|
||||
task "zoneserver-gui", "build the zone server, with gui!":
|
||||
withDir "enet_server":
|
||||
if shell("nimrod", ServerDefines, "--app:gui", "compile", "enet_server") != 0:
|
||||
if shell("nim", ServerDefines, "--app:gui", "compile", "enet_server") != 0:
|
||||
quit "Failed to build the zoneserver"
|
||||
|
||||
task "servers", "build the server and directory server":
|
||||
@@ -54,7 +54,7 @@ task "all", "run SERVERS and TEST tasks":
|
||||
runTask "test"
|
||||
|
||||
task "release", "release build":
|
||||
let res = shell("nimrod", ReleaseDefines, "compile", ExeName)
|
||||
let res = shell("nim", ReleaseDefines, "compile", ExeName)
|
||||
if res != 0:
|
||||
echo "The build failed."
|
||||
quit 1
|
||||
|
||||
@@ -33,7 +33,7 @@ accept baz(vbaz)
|
||||
reject baz(vnotbaz)
|
||||
reject bar(vfoo)
|
||||
|
||||
# https://github.com/Araq/Nimrod/issues/517
|
||||
# https://github.com/Araq/Nim/issues/517
|
||||
type
|
||||
TVecT*[T] = array[0..1, T]|array[0..2, T]|array[0..3, T]
|
||||
TVec2* = array[0..1, float32]
|
||||
@@ -43,7 +43,7 @@ proc f[T](a: TVecT[T], b: TVecT[T]): T = discard
|
||||
var x: float = f([0.0'f32, 0.0'f32], [0.0'f32, 0.0'f32])
|
||||
var y = f(TVec2([0.0'f32, 0.0'f32]), TVec2([0.0'f32, 0.0'f32]))
|
||||
|
||||
# https://github.com/Araq/Nimrod/issues/602
|
||||
# https://github.com/Araq/Nim/issues/602
|
||||
type
|
||||
TTest = object
|
||||
TTest2* = object
|
||||
|
||||
@@ -6,7 +6,7 @@ discard """
|
||||
"""
|
||||
## 99 Bottles of Beer
|
||||
## http://www.99-bottles-of-beer.net/
|
||||
## Nimrod version
|
||||
## Nim version
|
||||
|
||||
## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
|
||||
# 2012-11-25
|
||||
|
||||
@@ -10,8 +10,8 @@ static int cvariable = 420;
|
||||
""".}
|
||||
|
||||
proc embedsC() =
|
||||
var nimrodVar = 89
|
||||
{.emit: """printf("%d\n", cvariable + (int)`nimrodVar`);""".}
|
||||
var nimVar = 89
|
||||
{.emit: """printf("%d\n", cvariable + (int)`nimVar`);""".}
|
||||
|
||||
embedsC()
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ macrotest(stdout)
|
||||
|
||||
#GC_disable()
|
||||
|
||||
echo("This was compiled by Nimrod version " & system.nimrodVersion)
|
||||
echo("This was compiled by Nim version " & system.nimVersion)
|
||||
writeln(stdout, "Hello", " World", "!")
|
||||
|
||||
echo(["a", "b", "c", "d"].len)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
discard """
|
||||
cmd: "nimrod $target --hints:on -d:release $options $file"
|
||||
cmd: "nim $target --hints:on -d:release $options $file"
|
||||
"""
|
||||
|
||||
# -*- nimrod -*-
|
||||
# -*- nim -*-
|
||||
|
||||
import math
|
||||
import os
|
||||
|
||||
@@ -9,7 +9,7 @@ type
|
||||
proc ap(x: var TA) = x.a = -1
|
||||
proc bp(x: var TB) = x.b[high(x.b)] = -1
|
||||
|
||||
# in Nimrod proc (x: TB) is compatible to proc (x: TA),
|
||||
# in Nim proc (x: TB) is compatible to proc (x: TA),
|
||||
# but this is not type safe:
|
||||
var f = cast[proc (x: var TA) {.nimcall.}](bp)
|
||||
var a: TA
|
||||
|
||||
@@ -2,7 +2,7 @@ discard """
|
||||
file: "toverflw.nim"
|
||||
output: "the computation overflowed"
|
||||
"""
|
||||
# Tests nimrod's ability to detect overflows
|
||||
# Tests nim's ability to detect overflows
|
||||
|
||||
{.push overflowChecks: on.}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ discard """
|
||||
output: '''foobarfoobar
|
||||
bazbearbazbear
|
||||
1'''
|
||||
cmd: "nimrod $target --threads:on $options $file"
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import threadpool
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
output: '''4
|
||||
8'''
|
||||
cmd: "nimrod $target --threads:on $options $file"
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import threadpool
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
line: 9
|
||||
errormsg: "'spawn' takes a call expression"
|
||||
cmd: "nimrod $target --threads:on $options $file"
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import threadpool
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
output: "<html><head><title>now look at this</title></head><body><ul><li>Nimrod is quite capable</li></ul></body></html>"
|
||||
output: "<html><head><title>now look at this</title></head><body><ul><li>Nim is quite capable</li></ul></body></html>"
|
||||
"""
|
||||
|
||||
import strutils
|
||||
@@ -32,6 +32,6 @@ html mainPage:
|
||||
title "now look at this"
|
||||
body:
|
||||
ul:
|
||||
li "Nimrod is quite capable"
|
||||
li "Nim is quite capable"
|
||||
|
||||
echo mainPage()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Simplest Nimrod program
|
||||
# Simplest Nim program
|
||||
|
||||
echo "Hello, World!"
|
||||
|
||||
@@ -191,7 +191,7 @@ type
|
||||
|
||||
const
|
||||
ircServer = "irc.freenode.net"
|
||||
joinChans = @["#nimrod"]
|
||||
joinChans = @["#nim"]
|
||||
botNickname = "NimBot"
|
||||
|
||||
proc setSeen(d: TDb, s: TSeen) =
|
||||
@@ -271,7 +271,7 @@ proc handleWebMessage(state: PState, line: string) =
|
||||
message.add("-" & $commit["removed"].len & "]: ")
|
||||
message.add(limitCommitMsg(commit["message"].str))
|
||||
|
||||
# Send message to #nimrod.
|
||||
# Send message to #nim.
|
||||
state.ircClient.privmsg(joinChans[0], message)
|
||||
elif json.hasKey("redisinfo"):
|
||||
assert json["redisinfo"].hasKey("port")
|
||||
@@ -420,7 +420,7 @@ proc handleIrc(irc: PAsyncIRC, event: TIRCEvent, state: PState) =
|
||||
seenNick.msg = msg
|
||||
state.database.setSeen(seenNick)
|
||||
of MNick:
|
||||
createSeen(PSeenNick, event.nick, "#nimrod")
|
||||
createSeen(PSeenNick, event.nick, "#nim")
|
||||
seenNick.newNick = event.params[0]
|
||||
state.database.setSeen(seenNick)
|
||||
else:
|
||||
|
||||
@@ -851,7 +851,7 @@ template `=~`*(s: string, pattern: TPeg): expr =
|
||||
## This calls ``match`` with an implicit declared ``matches`` array that
|
||||
## can be used in the scope of the ``=~`` call:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## if line =~ peg"\s* {\w+} \s* '=' \s* {\w+}":
|
||||
## # matches a key=value pair:
|
||||
@@ -897,12 +897,12 @@ proc replacef*(s: string, sub: TPeg, by: string): string {.
|
||||
## Replaces `sub` in `s` by the string `by`. Captures can be accessed in `by`
|
||||
## with the notation ``$i`` and ``$#`` (see strutils.`%`). Examples:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## "var1=key; var2=key2".replace(peg"{\ident}'='{\ident}", "$1<-$2$2")
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## "var1<-keykey; val2<-key2key2"
|
||||
result = ""
|
||||
@@ -979,13 +979,13 @@ iterator split*(s: string, sep: TPeg): string =
|
||||
## Substrings are separated by the PEG `sep`.
|
||||
## Examples:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## for word in split("00232this02939is39an22example111", peg"\d+"):
|
||||
## writeln(stdout, word)
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## "this"
|
||||
## "is"
|
||||
## "an"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "nimrod $target --hints:on -d:embedUnidecodeTable $options $file"
|
||||
cmd: "nim $target --hints:on -d:embedUnidecodeTable $options $file"
|
||||
output: "Ausserst"
|
||||
"""
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
discard """
|
||||
file: "txmlgen.nim"
|
||||
output: "<h1><a href=\"http://force7.de/nimrod\">Nimrod</a></h1>"
|
||||
output: "<h1><a href=\"http://force7.de/nim\">Nim</a></h1>"
|
||||
"""
|
||||
import htmlgen
|
||||
|
||||
var nim = "Nimrod"
|
||||
echo h1(a(href="http://force7.de/nimrod", nim))
|
||||
var nim = "Nim"
|
||||
echo h1(a(href="http://force7.de/nim", nim))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ discard """
|
||||
|
||||
import xmltree, strtabs
|
||||
|
||||
var x = <>a(href="nimrod.de", newText("www.nimrod-test.de"))
|
||||
var x = <>a(href="nim.de", newText("www.nim-test.de"))
|
||||
|
||||
echo($x == "<a href=\"nimrod.de\">www.nimrod-test.de</a>")
|
||||
echo($x == "<a href=\"nim.de\">www.nim-test.de</a>")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ discard """
|
||||
"""
|
||||
|
||||
# Ref:
|
||||
# http://nimrod-lang.org/macros.html
|
||||
# http://nimrod-lang.org/parseutils.html
|
||||
# http://nim-lang.org/macros.html
|
||||
# http://nim-lang.org/parseutils.html
|
||||
|
||||
|
||||
# Imports
|
||||
@@ -313,7 +313,7 @@ proc parse_until_symbol(node: PNimrodNode, value: string, index: var int): bool
|
||||
|
||||
proc parse_template(node: PNimrodNode, value: string) =
|
||||
## Parses through entire template, outputing valid
|
||||
## Nimrod code into the input `node` AST.
|
||||
## Nim code into the input `node` AST.
|
||||
var index = 0
|
||||
while index < value.len and
|
||||
parse_until_symbol(node, value, index): nil
|
||||
|
||||
@@ -33,7 +33,7 @@ proc replaceVars(session: var NimSession, text: string): string =
|
||||
result = result.replace(moduleReplaceVar, session.modname)
|
||||
result = result.replace(silentReplaceVar, silentReplaceText)
|
||||
|
||||
proc startNimrodSession(project, script: string, mode: TRunMode):
|
||||
proc startNimSession(project, script: string, mode: TRunMode):
|
||||
NimSession =
|
||||
let (dir, name, ext) = project.splitFile
|
||||
result.mode = mode
|
||||
@@ -114,7 +114,7 @@ proc doScenario(script: string, output: PStream, mode: TRunMode, verbose: bool):
|
||||
|
||||
if f.readLine(project):
|
||||
var
|
||||
s = startNimrodSession(script.parentDir / project.string, script, mode)
|
||||
s = startNimSession(script.parentDir / project.string, script, mode)
|
||||
tline = TaintedString("")
|
||||
ln = 1
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Nimrod Tester
|
||||
# Nim Tester
|
||||
# (c) Copyright 2014 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
|
||||
@@ -18,7 +18,7 @@ type
|
||||
actionRun = "run"
|
||||
actionReject = "reject"
|
||||
TResultEnum* = enum
|
||||
reNimrodcCrash, # nim compiler seems to have crashed
|
||||
reNimcCrash, # nim compiler seems to have crashed
|
||||
reMsgsDiffer, # error messages differ
|
||||
reFilesDiffer, # expected and given filenames differ
|
||||
reLinesDiffer, # expected and given line numbers differ
|
||||
|
||||
@@ -2,7 +2,7 @@ discard """
|
||||
outputsub: "101"
|
||||
errormsg: "'threadFunc' is not GC-safe"
|
||||
line: 39
|
||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@@ -2,7 +2,7 @@ discard """
|
||||
file: "tthreadanalysis2.nim"
|
||||
line: 37
|
||||
errormsg: "'threadFunc' is not GC-safe"
|
||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
line: 11
|
||||
errormsg: "'horrible' is not GC-safe"
|
||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||
"""
|
||||
|
||||
var
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "nimrod $target --threads:on $options $file"
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
errormsg: "illegal recursion in type 'TIRC'"
|
||||
line: 16
|
||||
"""
|
||||
@@ -62,5 +62,5 @@ proc Connect*(irc: var TIRC, nick: string, host: string, port: int = 6667) =
|
||||
when isMainModule:
|
||||
var irc = initIRC()
|
||||
irc.Connect("AmryBot[Nim]","irc.freenode.net",6667)
|
||||
irc.sendRaw("JOIN #nimrod")
|
||||
irc.sendRaw("JOIN #nim")
|
||||
os.Sleep(4000)
|
||||
|
||||
@@ -9,7 +9,7 @@ import
|
||||
# This macro mimics the using statement from C#
|
||||
#
|
||||
# It's kept only as a test for the macro system
|
||||
# Nimrod's destructors offer a mechanism for automatic
|
||||
# Nim's destructors offer a mechanism for automatic
|
||||
# disposal of resources.
|
||||
#
|
||||
macro autoClose(e: expr): stmt {.immediate.} =
|
||||
|
||||
@@ -6,7 +6,7 @@ import strutils
|
||||
const
|
||||
HelpText = """
|
||||
+-----------------------------------------------------------------+
|
||||
| Maintenance program for Nimrod |
|
||||
| Maintenance program for Nim |
|
||||
| Version $1|
|
||||
| (c) 2012 Andreas Rumpf |
|
||||
+-----------------------------------------------------------------+
|
||||
@@ -19,12 +19,12 @@ Options:
|
||||
--help, -h shows this help and quits
|
||||
Possible Commands:
|
||||
boot [options] bootstraps with given command line options
|
||||
clean cleans Nimrod project; removes generated files
|
||||
clean cleans Nim project; removes generated files
|
||||
web generates the website
|
||||
csource [options] builds the C sources for installation
|
||||
zip builds the installation ZIP package
|
||||
inno builds the Inno Setup installer
|
||||
""" % [NimrodVersion & repeatChar(44-len(NimrodVersion)),
|
||||
""" % [NimVersion & repeatChar(44-len(NimVersion)),
|
||||
CompileDate, CompileTime]
|
||||
|
||||
echo helpText
|
||||
|
||||
Reference in New Issue
Block a user