summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-02-12 18:56:36 +0100
committerAraq <rumpf_a@web.de>2012-02-12 18:56:36 +0100
commit375c95d3ad5ceef283d141160020c9c5f900e15b (patch)
treeb537702df24bd8b3ea9dc2b34dbad346e28e2f0b /compiler
parent4cf64238b67566614bfae0fa0def8362a02f925d (diff)
downloadNim-375c95d3ad5ceef283d141160020c9c5f900e15b.tar.gz
bugfix: no need for arrows to be new token kinds
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/lexer.nim4
-rwxr-xr-xcompiler/parser.nim10
-rwxr-xr-xcompiler/wordrecg.nim4
3 files changed, 10 insertions, 8 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 278ab3b1f..19a470ddd 100755
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -50,7 +50,7 @@ type
     tkCurlyDotLe, tkCurlyDotRi, # {.  and  .}
     tkParDotLe, tkParDotRi,   # (. and .)
     tkComma, tkSemiColon,
-    tkColon, tkColonColon, tkEquals, tkLeArrow, tkRiArrow, tkDot, tkDotDot,
+    tkColon, tkColonColon, tkEquals, tkDot, tkDotDot,
     tkOpr, tkComment, tkAccent, tkInd, tkSad, 
     tkDed, # pseudo token types used by the source renderers:
     tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr,
@@ -78,7 +78,7 @@ const
     "tkTripleStrLit", "tkGStrLit", "tkGTripleStrLit", "tkCharLit", "(", 
     ")", "[", "]", "{", "}", "[.", ".]", "{.", ".}", "(.", ".)",
     ",", ";",
-    ":", "::", "=", "<-", "->", ".", "..",
+    ":", "::", "=", ".", "..",
     "tkOpr", "tkComment", "`", "[new indentation]", 
     "[same indentation]", "[dedentation]", "tkSpaces", "tkInfixOpr", 
     "tkPrefixOpr", "tkPostfixOpr"]
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 6e08cfecf..5d7a9a6e9 100755
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -147,7 +147,7 @@ proc parseExpr(p: var TParser): PNode
 proc parseStmt(p: var TParser): PNode
 proc parseTypeDesc(p: var TParser): PNode
 proc parseDoBlocks(p: var TParser, call: PNode)
-proc parseParamList(p: var TParser, resTypeTok = tkColon): PNode
+proc parseParamList(p: var TParser, retColon = true): PNode
 
 proc IsLeftAssociative(tok: TToken): bool {.inline.} =
   result = tok.tokType != tkOpr or tok.ident.s[0] != '^'
@@ -601,7 +601,7 @@ proc parseTuple(p: var TParser): PNode =
   optPar(p)
   eat(p, tkBracketRi)
 
-proc parseParamList(p: var TParser, resTypeTok = tkColon): PNode = 
+proc parseParamList(p: var TParser, retColon = true): PNode = 
   var a: PNode
   result = newNodeP(nkFormalParams, p)
   addSon(result, ast.emptyNode) # return type
@@ -623,7 +623,9 @@ proc parseParamList(p: var TParser, resTypeTok = tkColon): PNode =
       optInd(p, a)
     optPar(p)
     eat(p, tkParRi)
-  if p.tok.tokType == resTypeTok:
+  let b = if retColon: p.tok.tokType == tkColon
+          else: p.tok.tokType == tkOpr and IdentEq(p.tok.ident, "->")
+  if b:
     getTok(p)
     optInd(p, result)
     result.sons[0] = parseTypeDesc(p)
@@ -635,7 +637,7 @@ proc optPragmas(p: var TParser): PNode =
 proc parseDoBlock(p: var TParser): PNode =
   var info = parLineInfo(p)
   getTok(p)
-  var params = parseParamList(p, tkRiArrow)
+  var params = parseParamList(p, retColon=false)
   var pragmas = optPragmas(p)
   eat(p, tkColon)
   result = newNodeI(nkDo, info)
diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim
index d46c141fd..76788a22e 100755
--- a/compiler/wordrecg.nim
+++ b/compiler/wordrecg.nim
@@ -33,7 +33,7 @@ type
     wShl, wShr, wTemplate, wTry, wTuple, wType, wVar, wWhen, wWhile, wWith, 
     wWithout, wXor, wYield,
     
-    wColon, wColonColon, wEquals, wLeArraw, wRiArrow, wDot, wDotDot,
+    wColon, wColonColon, wEquals, wDot, wDotDot,
     wStar, wMinus,
     wMagic, wThread, wFinal, wProfiler, wObjChecks,
     wImportCpp, wImportObjC,
@@ -79,7 +79,7 @@ const
     "try", "tuple", "type", "var", "when", "while", "with", "without", "xor",
     "yield",
 
-    ":", "::", "=", "<-", "->", ".", "..",
+    ":", "::", "=", ".", "..",
     "*", "-",
     "magic", "thread", "final", "profiler", "objchecks",