Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump Nim from 1.4.8 to 1.6.0 #419

Merged
merged 3 commits into from Oct 21, 2021
Merged

Commits on Oct 19, 2021

  1. Copy the full SHA
    8602092 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2021

  1. patched_stdlib: update std/json

    This commit pulls in the latest changes to the json module from the Nim
    standard library.
    
    The `json.nim` file in the configlet repo is the result of applying the
    below patch to the upstream 1.6.0 `json.nim` file.
    
    diff --git a/Nim/lib/pure/json.nim b/configlet/src/patched_stdlib/json.nim
    index 85c3393..55daa6d 100644
    --- a/Nim/lib/pure/json.nim
    +++ b/configlet/src/patched_stdlib/json.nim
    @@ -1,11 +1,28 @@
    -#
    -#
    -#            Nim's Runtime Library
    -#        (c) Copyright 2015 Andreas Rumpf, Dominik Picheta
    -#
    -#    See the file "copying.txt", included in this
    -#    distribution, for details about the copyright.
    -#
    +# This file is minimally adapted from this version in the Nim standard library:
    +# https://github.com/nim-lang/Nim/blob/58080525a1dc/lib/pure/json.nim
    +# The standard library version is lenient: it silently allows a trailing comma.
    +# The below version is stricter: it raises a `JsonParsingError` for a trailing
    +# comma.
    +
    +# Copyright (c) 2015 Andreas Rumpf, Dominik Picheta
    +
    +# Permission is hereby granted, free of charge, to any person obtaining a copy
    +# of this software and associated documentation files (the "Software"), to deal
    +# in the Software without restriction, including without limitation the rights
    +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    +# copies of the Software, and to permit persons to whom the Software is
    +# furnished to do so, subject to the following conditions:
    +
    +# The above copyright notice and this permission notice shall be included in
    +# all copies or substantial portions of the Software.
    +
    +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    +# THE SOFTWARE.
    
     ## This module implements a simple high performance `JSON`:idx:
     ## parser. JSON (JavaScript Object Notation) is a lightweight
    @@ -893,6 +910,9 @@ proc parseJson(p: var JsonParser; rawIntegers, rawFloats: bool): JsonNode =
           result[key] = val
           if p.tok != tkComma: break
           discard getTok(p)
    +      # Raise `JsonParsingError` for a trailing comma, unlike `std/json`
    +      if p.tok == tkCurlyRi:
    +        raiseParseErr(p, "found trailing comma. } or key/value pair")
         eat(p, tkCurlyRi)
       of tkBracketLe:
         result = newJArray()
    @@ -901,6 +921,9 @@ proc parseJson(p: var JsonParser; rawIntegers, rawFloats: bool): JsonNode =
           result.add(parseJson(p, rawIntegers, rawFloats))
           if p.tok != tkComma: break
           discard getTok(p)
    +      # Raise `JsonParsingError` for a trailing comma, unlike `std/json`
    +      if p.tok == tkBracketRi:
    +        raiseParseErr(p, "found trailing comma. ] or array item")
         eat(p, tkBracketRi)
       of tkError, tkCurlyRi, tkBracketRi, tkColon, tkComma, tkEof:
         raiseParseErr(p, "{")
    ee7 committed Oct 20, 2021
    Copy the full SHA
    06c70b4 View commit details
    Browse the repository at this point in the history
  2. patched_stdlib: update std/parsejson

    This commit pulls in the latest changes to the parsejson module from the
    Nim standard library.
    
    The `parsejson.nim` file in the configlet repo is the result of applying
    the below patch to the upstream 1.6.0 `parsejson.nim` file.
    
    diff --git a/Nim/lib/pure/parsejson.nim b/configlet/src/patched_stdlib/parsejson.nim
    index 196d8c3..48e1e05 100644
    --- a/Nim/lib/pure/parsejson.nim
    +++ b/configlet/src/patched_stdlib/parsejson.nim
    @@ -1,11 +1,29 @@
    -#
    -#
    -#            Nim's Runtime Library
    -#        (c) Copyright 2018 Nim contributors
    -#
    -#    See the file "copying.txt", included in this
    -#    distribution, for details about the copyright.
    -#
    +# This file is minimally adapted from this version in the Nim standard library:
    +# https://github.com/nim-lang/Nim/blob/285539c87aa2/lib/pure/parsejson.nim
    +# The standard library version is lenient: it silently allows line comments
    +# with `//`, and long comments with `/* */`.
    +# The below version is stricter: it raises a `JsonParsingError` for such
    +# comments.
    +
    +# Copyright (c) 2018 Nim contributors
    +
    +# Permission is hereby granted, free of charge, to any person obtaining a copy
    +# of this software and associated documentation files (the "Software"), to deal
    +# in the Software without restriction, including without limitation the rights
    +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    +# copies of the Software, and to permit persons to whom the Software is
    +# furnished to do so, subject to the following conditions:
    +
    +# The above copyright notice and this permission notice shall be included in
    +# all copies or substantial portions of the Software.
    +
    +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    +# THE SOFTWARE.
    
     ## This module implements a json parser. It is used
     ## and exported by the `json` standard library
    @@ -54,7 +72,6 @@ type
         errBracketRiExpected, ## `]` expected
         errCurlyRiExpected,   ## `}` expected
         errQuoteExpected,     ## `"` or `'` expected
    -    errEOC_Expected,      ## `*/` expected
         errEofExpected,       ## EOF expected
         errExprExpected       ## expr expected
    
    @@ -85,7 +102,6 @@ const
         "']' expected",
         "'}' expected",
         "'\"' or \"'\" expected",
    -    "'*/' expected",
         "EOF expected",
         "expression expected"
       ]
    @@ -263,43 +279,8 @@ proc skip(my: var JsonParser) =
       var pos = my.bufpos
       while true:
         case my.buf[pos]
    -    of '/':
    -      if my.buf[pos+1] == '/':
    -        # skip line comment:
    -        inc(pos, 2)
    -        while true:
    -          case my.buf[pos]
    -          of '\0':
    -            break
    -          of '\c':
    -            pos = lexbase.handleCR(my, pos)
    -            break
    -          of '\L':
    -            pos = lexbase.handleLF(my, pos)
    -            break
    -          else:
    -            inc(pos)
    -      elif my.buf[pos+1] == '*':
    -        # skip long comment:
    -        inc(pos, 2)
    -        while true:
    -          case my.buf[pos]
    -          of '\0':
    -            my.err = errEOC_Expected
    -            break
    -          of '\c':
    -            pos = lexbase.handleCR(my, pos)
    -          of '\L':
    -            pos = lexbase.handleLF(my, pos)
    -          of '*':
    -            inc(pos)
    -            if my.buf[pos] == '/':
    -              inc(pos)
    -              break
    -          else:
    -            inc(pos)
    -      else:
    -        break
    +    # Raise `JsonParsingError` for comments with `//` or `/* */`,
    +    # unlike `std/parsejson`
         of ' ', '\t':
           inc(pos)
         of '\c':
    @@ -350,7 +331,7 @@ proc parseName(my: var JsonParser) =
    
     proc getTok*(my: var JsonParser): TokKind =
       setLen(my.a, 0)
    -  skip(my) # skip whitespace, comments
    +  skip(my) # skip whitespace
       case my.buf[my.bufpos]
       of '-', '.', '0'..'9':
         parseNumber(my)
    ee7 committed Oct 20, 2021
    Copy the full SHA
    1a53d22 View commit details
    Browse the repository at this point in the history