Skip to content

Commit

Permalink
Merge pull request #1 from nim-lang/devel
Browse files Browse the repository at this point in the history
Getting the latest from nim-lang
  • Loading branch information
deansher committed Jan 21, 2019
2 parents 5b39c7a + ee89ba6 commit a6de027
Show file tree
Hide file tree
Showing 285 changed files with 10,604 additions and 6,731 deletions.
24 changes: 12 additions & 12 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
---
name: Bug report
about: You found an unexpected behaviour? Use this template.

about: Have you found an unexpected behavior? Use this template.
---

<!-- Think about the title, twice. -->

<!-- Summarize the Problem here, keep it simple. -->
<!-- e.g. `echo` outputs the wrong string. -->
<!-- Summarize the problem here, keep it short and simple. -->
Function `echo` outputs the wrong string.


### Example
<!-- This should be a source code block.
<!-- Paste your example in the code-block below. -->
```nim
echo "Hello World!"
```
-->


### Current Output
<!--
```
Hola mundo!
```
-->


### Expected Output
<!--
<!-- What should be the correct output? -->
```
Hello World!
```
-->


### Possible Solution
Expand All @@ -40,6 +35,11 @@ Hello World!

### Additional Information
<!--- For Example:
A link to a project where the issue is relevant.
A link to a related issue or discussion.
* Your Nim version (output of `nim -v`).
* Was it working in the previous Nim releases?
* A link to a related issue or discussion.
-->
```
$ nim -v
Nim Compiler Version 0.1.2
```
17 changes: 13 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
---
name: Feature request
about: You want to suggest a new feature? Use this template.
about: Do you want to suggest a new feature? Use this template.

---

<!---
Notice there is now a separate repository for the detailed RFCs and proposals:
https://github.com/nim-lang/RFCs
If you have a simple feature request, you can post it here using this template,
but bear in mind that adding new features to the language is currently a low priority.
-->


### Summary
<!--- Short summary of your proposed feature -->

Expand All @@ -18,6 +27,6 @@ about: You want to suggest a new feature? Use this template.

### Additional Information
<!--- For Example:
A link to a project where the issue is relevant.
A link to a related issue or discussion.
-->
* A link to a project where the issue is relevant.
* A link to a related issue or discussion.
-->
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ doc/*.html
doc/*.pdf
doc/*.idx
/web/upload
build/*
/build/*
bin/*

# iOS specific wildcards.
Expand Down Expand Up @@ -71,3 +71,7 @@ test.txt
tweeter.db
tweeter_test.db
megatest.nim

/outputExpected.txt
/outputGotten.txt

26 changes: 6 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ matrix:
- os: osx
env: NIM_COMPILE_TO_CPP=true

allow_failures:
- env: NIM_COMPILE_TO_CPP=true
# To allow failures for a failing configuration, use something like:
# allow_failures:
# - env: NIM_COMPILE_TO_CPP=true
# - os: osx

addons:
Expand All @@ -40,26 +41,11 @@ before_script:
- sh build.sh
- cd ..
- export PATH=$(pwd)/bin${PATH:+:$PATH}
- echo PATH:${PATH}

script:
- nim c koch
- env NIM_COMPILE_TO_CPP=false ./koch boot
- ./koch boot -d:release
- ./koch nimble
- nim e tests/test_nimscript.nims
#- nimble install zip -y
#- nimble install opengl
#- nimble install sdl1
#- nimble install jester@#head -y
#- nimble install niminst
- nim c -d:nimCoroutines testament/tester
- testament/tester --pedantic all -d:nimCoroutines
- nim c -o:bin/nimpretty nimpretty/nimpretty.nim
- nim c -r nimpretty/tester.nim
- ./koch docs --git.commit:devel
- ./koch csource
- ./koch nimsuggest
- nim c -r nimsuggest/tester
- nim c -r nimdoc/tester
- ./koch runCI

before_deploy:
# Make https://nim-lang.github.io/Nim work the same as https://nim-lang.github.io/Nim/overview.html
Expand Down
18 changes: 1 addition & 17 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ install:

build_script:
- bin\nim c koch
- koch boot -d:release
- koch nimble
- nim e tests/test_nimscript.nims
- nim c -o:bin/nimpretty.exe nimpretty/nimpretty.nim
- nim c -r nimpretty/tester.nim
# - nimble install zip -y
# - nimble install opengl -y
# - nimble install sdl1 -y
# - nimble install jester@#head -y
- nim c -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester
- nim c -d:nimCoroutines testament/tester

test_script:
- testament\tester --pedantic all -d:nimCoroutines
- nim c -r nimdoc\tester
# - koch csource
# - koch zip
- koch runCI

deploy: off
5 changes: 4 additions & 1 deletion build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ build_nim_csources(){

[ -f $nim_csources ] || echo_run build_nim_csources

echo_run bin/nim c koch
# Note: if fails, may need to `cd csources && git pull`
# see D20190115T162028
echo_run bin/nim c --skipUserCfg --skipParentCfg koch

echo_run ./koch boot -d:release
echo_run ./koch tools # Compile Nimble and other tools.
54 changes: 50 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## v0.20.0 - XX/XX/2018
## v0.20.0 - XX/XX/2019


### Changes affecting backwards compatibility

Expand All @@ -23,13 +24,19 @@
- The undocumented ``#? strongSpaces`` parsing mode has been removed.
- The `not` operator is now always a unary operator, this means that code like
``assert not isFalse(3)`` compiles.
- `getImpl` on a `var` or `let` symbol will now return the full `IdentDefs`
tree from the symbol declaration instead of just the initializer portion.


#### Breaking changes in the standard library

- `osproc.execProcess` now also takes a `workingDir` parameter.

- `options.UnpackError` is no longer a ref type and inherits from `System.Defect` instead of `System.ValueError`.
- `options.UnpackError` is no longer a ref type and inherits from `system.Defect` instead of `system.ValueError`.

- `system.ValueError` now inherits from `system.CatchableError` instead of `system.Defect`.

- The procs `parseutils.parseBiggsetInt`, `parseutils.parseInt`, `parseutils.parseBiggestUInt` and `parseutils.parseUInt` now raise a `ValueError` when the parsed integer is outside of the valid range. Previously they sometimes raised a `OverflowError` and sometimes returned `0`.

- nre's `RegexMatch.{captureBounds,captures}[]` no longer return `Option` or
`nil`/`""`, respectivly. Use the newly added `n in p.captures` method to
Expand All @@ -50,6 +57,18 @@
`IndexError` for un-named captures. This is consistant with
`RegexMatch.{captureBounds,captures}[]`.

- splitFile now correctly handles edge cases, see #10047

- `isNil` is no longer false for undefined in the JavaScript backend: now it's true for both nil and undefined. Use `isNull` or `isUndefined` if you need exact equallity: `isNil` is consistent with `===`, `isNull` and `isUndefined` with `==`.

- several deprecated modules were removed: `ssl`, `matchers`, `httpserver`,
`unsigned`, `actors`, `parseurl`

- two poorly documented and not used modules (`subexes`, `scgi`) were moved to
graveyard (they are available as Nimble packages)



#### Breaking changes in the compiler

- The compiler now implements the "generic symbol prepass" for `when` statements
Expand All @@ -66,6 +85,9 @@ proc enumToString*(enums: openArray[enum]): string =
```

- ``discard x`` is now illegal when `x` is a function symbol.
- Implicit imports via ``--import: module`` in a config file are now restricted
to the main package.


### Library additions

Expand All @@ -87,11 +109,18 @@ proc enumToString*(enums: openArray[enum]): string =
is instantiation of generic proc symbol.

- Added the parameter ``isSorted`` for the ``sequtils.deduplicate`` proc.

- There is a new stdlib module `std/diff` to compute the famous "diff"
of two texts by line.

- Added `os.relativePath`.

- Added `parseopt.remainingArgs`.

- Added `os.getCurrentCompilerExe` (implmented as `getAppFilename` at CT),
can be used to retrieve the currently executing compiler.


### Library changes

- The string output of `macros.lispRepr` proc has been tweaked
Expand All @@ -111,16 +140,23 @@ proc enumToString*(enums: openArray[enum]): string =
(default value: true) that can be set to `false` for better Posix
interoperability. (Bug #9619.)

- `os.joinPath` and `os.normalizePath` handle edge cases like ``"a/b/../../.."``
differently.

- `securehash` is moved to `lib/deprecated`


### Language additions

- Vm suport for float32<->int32 and float64<->int64 casts was added.
- Vm support for float32<->int32 and float64<->int64 casts was added.
- There is a new pragma block `noSideEffect` that works like
the `gcsafe` pragma block.
- added os.getCurrentProcessId()
- User defined pragmas are now allowed in the pragma blocks
- Pragma blocks are now longer eliminated from the typed AST tree to preserve
- Pragma blocks are no longer eliminated from the typed AST tree to preserve
pragmas for further analysis by macros
- Custom pragmas are now supported for `var` and `let` symbols.


### Language changes

Expand All @@ -129,13 +165,23 @@ proc enumToString*(enums: openArray[enum]): string =
it's more recognizable and allows tools like github to recognize it as Nim,
see [#9647](https://github.com/nim-lang/Nim/issues/9647).
The previous extension will continue to work.
- Pragma syntax is now consistent. Previous syntax where type pragmas did not
follow the type name is now deprecated. Also pragma before generic parameter
list is deprecated to be consistent with how pragmas are used with a proc. See
[#8514](https://github.com/nim-lang/Nim/issues/8514) and
[#1872](https://github.com/nim-lang/Nim/issues/1872) for further details.


### Tool changes
- `jsondoc` now include a `moduleDescription` field with the module
description. `jsondoc0` shows comments as it's own objects as shown in the
documentation.
- `nimpretty`: --backup now defaults to `off` instead of `on` and the flag was
un-documented; use `git` instead of relying on backup files.


### Compiler changes
- The deprecated `fmod` proc is now unavailable on the VM'.


### Bugfixes
2 changes: 1 addition & 1 deletion compiler.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ author = "Andreas Rumpf"
description = "Compiler package providing the compiler sources as a library."
license = "MIT"

installDirs = @["compiler"]
installDirs = @["compiler", "nimsuggest"]

requires "nim >= 0.14.0"
83 changes: 83 additions & 0 deletions compiler/asciitables.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#[
move to std/asciitables.nim once stable, or to a nimble paackage
once compiler can depend on nimble
]#

type Cell* = object
text*: string
width*, row*, col*, ncols*, nrows*: int

iterator parseTableCells*(s: string, delim = '\t'): Cell =
## iterates over all cells in a `delim`-delimited `s`, after a 1st
## pass that computes number of rows, columns, and width of each column.
var widths: seq[int]
var cell: Cell
template update() =
if widths.len<=cell.col:
widths.setLen cell.col+1
widths[cell.col] = cell.width
else:
widths[cell.col] = max(widths[cell.col], cell.width)
cell.width = 0

for a in s:
case a
of '\n':
update()
cell.col = 0
cell.row.inc
elif a == delim:
update()
cell.col.inc
else:
# todo: consider multi-width chars when porting to non-ascii implementation
cell.width.inc
if s.len > 0 and s[^1] != '\n':
update()

cell.ncols = widths.len
cell.nrows = cell.row + 1
cell.row = 0
cell.col = 0
cell.width = 0

template update2() =
cell.width = widths[cell.col]
yield cell
cell.text = ""
cell.width = 0
cell.col.inc

template finishRow() =
for col in cell.col..<cell.ncols:
cell.col = col
update2()
cell.col = 0

for a in s:
case a
of '\n':
finishRow()
cell.row.inc
elif a == delim:
update2()
else:
cell.width.inc
cell.text.add a

if s.len > 0 and s[^1] != '\n':
finishRow()

proc alignTable*(s: string, delim = '\t', fill = ' ', sep = " "): string =
## formats a `delim`-delimited `s` representing a table; each cell is aligned
## to a width that's computed for each column; consecutive columns are
## delimted by `sep`, and alignment space is filled using `fill`.
## More customized formatting can be done by calling `parseTableCells` directly.
for cell in parseTableCells(s, delim):
result.add cell.text
for i in cell.text.len..<cell.width:
result.add fill
if cell.col < cell.ncols-1:
result.add sep
if cell.col == cell.ncols-1 and cell.row < cell.nrows - 1:
result.add '\n'
Loading

0 comments on commit a6de027

Please sign in to comment.