summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/lexer.nim4
-rw-r--r--compiler/parser.nim12
-rw-r--r--compiler/pbraces.nim11
-rw-r--r--compiler/renderer.nim4
-rw-r--r--compiler/wordrecg.nim4
-rw-r--r--doc/keywords.txt2
-rw-r--r--lib/packages/docutils/highlite.nim4
7 files changed, 26 insertions, 15 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 09bcb4ce0..45d090b16 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -48,7 +48,7 @@ type
     tkShl, tkShr, tkStatic,
     tkTemplate,
     tkTry, tkTuple, tkType, tkUsing,
-    tkVar, tkWhen, tkWhile, tkWith, tkWithout, tkXor,
+    tkVar, tkWhen, tkWhile, tkXor,
     tkYield, # end of keywords
     tkIntLit, tkInt8Lit, tkInt16Lit, tkInt32Lit, tkInt64Lit,
     tkUIntLit, tkUInt8Lit, tkUInt16Lit, tkUInt32Lit, tkUInt64Lit,
@@ -89,7 +89,7 @@ const
     "shl", "shr", "static",
     "template",
     "try", "tuple", "type", "using",
-    "var", "when", "while", "with", "without", "xor",
+    "var", "when", "while", "xor",
     "yield",
     "tkIntLit", "tkInt8Lit", "tkInt16Lit", "tkInt32Lit", "tkInt64Lit",
     "tkUIntLit", "tkUInt8Lit", "tkUInt16Lit", "tkUInt32Lit", "tkUInt64Lit",
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 06ecf900e..924f7f26c 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1038,9 +1038,15 @@ proc parseTypeDescKAux(p: var TParser, kind: TNodeKind,
   optInd(p, result)
   if not isOperator(p.tok) and isExprStart(p):
     addSon(result, primary(p, mode))
-  if kind == nkDistinctTy and p.tok.tokType in {tkWith, tkWithout}:
-    let nodeKind = if p.tok.tokType == tkWith: nkWith
-                   else: nkWithout
+  if kind == nkDistinctTy and p.tok.tokType == tkSymbol:
+    # XXX document this feature!
+    var nodeKind: TNodeKind
+    if p.tok.ident.s == "with":
+      nodeKind = nkWith
+    elif p.tok.ident.s == "without":
+      nodeKind = nkWithout
+    else:
+      return result
     getTok(p)
     let list = newNodeP(nodeKind, p)
     result.addSon list
diff --git a/compiler/pbraces.nim b/compiler/pbraces.nim
index fa4ccc139..eba6f0b62 100644
--- a/compiler/pbraces.nim
+++ b/compiler/pbraces.nim
@@ -906,9 +906,14 @@ proc parseTypeDescKAux(p: var TParser, kind: TNodeKind,
   optInd(p, result)
   if not isOperator(p.tok) and isExprStart(p):
     addSon(result, primary(p, mode))
-  if kind == nkDistinctTy and p.tok.tokType in {tkWith, tkWithout}:
-    let nodeKind = if p.tok.tokType == tkWith: nkWith
-                   else: nkWithout
+  if kind == nkDistinctTy and p.tok.tokType == tkSymbol:
+    var nodeKind: TNodeKind
+    if p.tok.ident.s == "with":
+      nodeKind = nkWith
+    elif p.tok.ident.s == "without":
+      nodeKind = nkWithout
+    else:
+      return result
     getTok(p)
     let list = newNodeP(nodeKind, p)
     result.addSon list
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index 05329394a..bbe81fe37 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -1079,9 +1079,9 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
       gsub(g, n.sons[0])
       if n.len > 1:
         if n[1].kind == nkWith:
-          putWithSpace(g, tkWith, " with")
+          putWithSpace(g, tkSymbol, " with")
         else:
-          putWithSpace(g, tkWithout, " without")
+          putWithSpace(g, tkSymbol, " without")
         gcomma(g, n[1])
     else:
       put(g, tkDistinct, "distinct")
diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim
index 773ab8ff5..1e89ea1e2 100644
--- a/compiler/wordrecg.nim
+++ b/compiler/wordrecg.nim
@@ -30,7 +30,7 @@ type
     wMacro, wMethod, wMixin, wMod, wNil,
     wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn,
     wShl, wShr, wStatic, wTemplate, wTry, wTuple, wType, wUsing, wVar,
-    wWhen, wWhile, wWith, wWithout, wXor, wYield,
+    wWhen, wWhile, wXor, wYield,
 
     wColon, wColonColon, wEquals, wDot, wDotDot,
     wStar, wMinus,
@@ -116,7 +116,7 @@ const
     "out", "proc", "ptr", "raise", "ref", "return",
     "shl", "shr", "static",
     "template", "try", "tuple", "type", "using", "var",
-    "when", "while", "with", "without", "xor",
+    "when", "while", "xor",
     "yield",
 
     ":", "::", "=", ".", "..",
diff --git a/doc/keywords.txt b/doc/keywords.txt
index 405bf1981..f8b444924 100644
--- a/doc/keywords.txt
+++ b/doc/keywords.txt
@@ -16,6 +16,6 @@ shl shr static
 template try tuple type
 using
 var
-when while with without
+when while
 xor
 yield
diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim
index 06b90768c..1d396d9e0 100644
--- a/lib/packages/docutils/highlite.nim
+++ b/lib/packages/docutils/highlite.nim
@@ -58,8 +58,8 @@ const
     "interface", "is", "isnot", "iterator", "let", "macro", "method",
     "mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc",
     "ptr", "raise", "ref", "return", "shl", "shr", "static",
-    "template", "try", "tuple", "type", "using", "var", "when", "while", "with",
-    "without", "xor", "yield"]
+    "template", "try", "tuple", "type", "using", "var", "when", "while",
+    "xor", "yield"]
 
 proc getSourceLanguage*(name: string): SourceLanguage =
   for i in countup(succ(low(SourceLanguage)), high(SourceLanguage)):