summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-11-21 11:27:24 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-11-21 11:27:35 +0100
commitcae5e33a4a66406813769361233438c7d2df6009 (patch)
treebdba5c64996a0bec5ba764d98e26fb11e94b65d3
parent58187f212067beff458e76d7c819750a9cfa100c (diff)
downloadNim-cae5e33a4a66406813769361233438c7d2df6009.tar.gz
language change: 'generic' and 'atomic' are not keywords anymore
-rw-r--r--compiler/lexer.nim8
-rw-r--r--compiler/parser.nim6
-rw-r--r--compiler/semtypes.nim2
-rw-r--r--compiler/wordrecg.nim8
-rw-r--r--doc/keywords.txt3
-rw-r--r--lib/packages/docutils/highlite.nim11
-rw-r--r--tests/concepts/t1128.nim4
7 files changed, 17 insertions, 25 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 2ae2176de..4106494c4 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -33,13 +33,13 @@ type
   TTokType* = enum
     tkInvalid, tkEof,         # order is important here!
     tkSymbol, # keywords:
-    tkAddr, tkAnd, tkAs, tkAsm, tkAtomic,
+    tkAddr, tkAnd, tkAs, tkAsm,
     tkBind, tkBlock, tkBreak, tkCase, tkCast,
     tkConcept, tkConst, tkContinue, tkConverter,
     tkDefer, tkDiscard, tkDistinct, tkDiv, tkDo,
     tkElif, tkElse, tkEnd, tkEnum, tkExcept, tkExport,
     tkFinally, tkFor, tkFrom, tkFunc,
-    tkGeneric, tkIf, tkImport, tkIn, tkInclude, tkInterface,
+    tkIf, tkImport, tkIn, tkInclude, tkInterface,
     tkIs, tkIsnot, tkIterator,
     tkLet,
     tkMacro, tkMethod, tkMixin, tkMod, tkNil, tkNot, tkNotin,
@@ -75,12 +75,12 @@ const
   tokKeywordHigh* = pred(tkIntLit)
   TokTypeToStr*: array[TTokType, string] = ["tkInvalid", "[EOF]",
     "tkSymbol",
-    "addr", "and", "as", "asm", "atomic",
+    "addr", "and", "as", "asm",
     "bind", "block", "break", "case", "cast",
     "concept", "const", "continue", "converter",
     "defer", "discard", "distinct", "div", "do",
     "elif", "else", "end", "enum", "except", "export",
-    "finally", "for", "from", "func", "generic", "if",
+    "finally", "for", "from", "func", "if",
     "import", "in", "include", "interface", "is", "isnot", "iterator",
     "let",
     "macro", "method", "mixin", "mod",
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 41303ead9..b1cfd7609 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1140,13 +1140,9 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode =
     else:
       result = newNodeP(nkObjectTy, p)
       getTok(p)
-  of tkGeneric, tkConcept:
+  of tkConcept:
     if mode == pmTypeDef:
-      let wasGeneric = p.tok.tokType == tkGeneric
       result = parseTypeClass(p)
-      # hack so that it's remembered and can be marked as deprecated in
-      # sem'check:
-      if wasGeneric: result.flags.incl nfBase2
     else:
       parMessage(p, errInvalidToken, p.tok)
   of tkStatic:
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index b032557b7..b2c6efc37 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -1218,8 +1218,6 @@ template modifierTypeKindOfNode(n: PNode): TTypeKind =
 
 proc semTypeClass(c: PContext, n: PNode, prev: PType): PType =
   # if n.sonsLen == 0: return newConstraint(c, tyTypeClass)
-  if nfBase2 in n.flags:
-    message(n.info, warnDeprecated, "use 'concept' instead; 'generic'")
   let
     pragmas = n[1]
     inherited = n[2]
diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim
index f5ba35dfb..8881acadd 100644
--- a/compiler/wordrecg.nim
+++ b/compiler/wordrecg.nim
@@ -21,11 +21,11 @@ type
   TSpecialWord* = enum
     wInvalid,
 
-    wAddr, wAnd, wAs, wAsm, wAtomic,
+    wAddr, wAnd, wAs, wAsm,
     wBind, wBlock, wBreak, wCase, wCast, wConcept, wConst,
     wContinue, wConverter, wDefer, wDiscard, wDistinct, wDiv, wDo,
     wElif, wElse, wEnd, wEnum, wExcept, wExport,
-    wFinally, wFor, wFrom, wFunc, wGeneric, wIf, wImport, wIn,
+    wFinally, wFor, wFrom, wFunc, wIf, wImport, wIn,
     wInclude, wInterface, wIs, wIsnot, wIterator, wLet,
     wMacro, wMethod, wMixin, wMod, wNil,
     wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn,
@@ -103,12 +103,12 @@ const
 
   specialWords*: array[low(TSpecialWord)..high(TSpecialWord), string] = ["",
 
-    "addr", "and", "as", "asm", "atomic",
+    "addr", "and", "as", "asm",
     "bind", "block", "break", "case", "cast",
     "concept", "const", "continue", "converter",
     "defer", "discard", "distinct", "div", "do",
     "elif", "else", "end", "enum", "except", "export",
-    "finally", "for", "from", "func", "generic", "if",
+    "finally", "for", "from", "func", "if",
     "import", "in", "include", "interface", "is", "isnot", "iterator",
     "let",
     "macro", "method", "mixin", "mod", "nil", "not", "notin",
diff --git a/doc/keywords.txt b/doc/keywords.txt
index f8b444924..4eea3403a 100644
--- a/doc/keywords.txt
+++ b/doc/keywords.txt
@@ -1,10 +1,9 @@
-addr and as asm atomic
+addr and as asm
 bind block break
 case cast concept const continue converter
 defer discard distinct div do
 elif else end enum except export
 finally for from func
-generic
 if import in include interface is isnot iterator
 let
 macro method mixin mod
diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim
index 1d396d9e0..70369b001 100644
--- a/lib/packages/docutils/highlite.nim
+++ b/lib/packages/docutils/highlite.nim
@@ -49,12 +49,12 @@ const
 
   # The following list comes from doc/keywords.txt, make sure it is
   # synchronized with this array by running the module itself as a test case.
-  nimKeywords = ["addr", "and", "as", "asm", "atomic", "bind", "block",
+  nimKeywords = ["addr", "and", "as", "asm", "bind", "block",
     "break", "case", "cast", "concept", "const", "continue", "converter",
     "defer", "discard", "distinct", "div", "do",
     "elif", "else", "end", "enum", "except", "export",
     "finally", "for", "from", "func",
-    "generic", "if", "import", "in", "include",
+    "if", "import", "in", "include",
     "interface", "is", "isnot", "iterator", "let", "macro", "method",
     "mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc",
     "ptr", "raise", "ref", "return", "shl", "shr", "static",
@@ -901,12 +901,11 @@ when isMainModule:
   for filename in ["doc/keywords.txt", "../../../doc/keywords.txt"]:
     try:
       let input = string(readFile(filename))
-      keywords = input.split()
+      keywords = input.splitWhitespace()
       break
     except:
       echo filename, " not found"
   doAssert(not keywords.isNil, "Couldn't read any keywords.txt file!")
-  doAssert keywords.len == nimKeywords.len, "No matching lengths"
-  for i in 0..keywords.len-1:
-    #echo keywords[i], " == ", nimKeywords[i]
+  for i in 0..min(keywords.len, nimKeywords.len)-1:
     doAssert keywords[i] == nimKeywords[i], "Unexpected keyword"
+  doAssert keywords.len == nimKeywords.len, "No matching lengths"
diff --git a/tests/concepts/t1128.nim b/tests/concepts/t1128.nim
index 7f7525a13..69a2fa9b7 100644
--- a/tests/concepts/t1128.nim
+++ b/tests/concepts/t1128.nim
@@ -4,8 +4,8 @@ discard """
 
 type
   TFooContainer[T] = object
-  
-  TContainer[T] = generic var c
+
+  TContainer[T] = concept var c
     foo(c, T)
 
 proc foo[T](c: var TFooContainer[T], val: T) =