From 862c0ef83d7a85798df0474522dd4ba8cfcab674 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 6 Mar 2014 21:57:35 +0200 Subject: split the inline and closure iterators into different symbol kinds for easier discrimination between them --- compiler/semgnrc.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/semgnrc.nim') diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index b21d851c9..ffc1a43b2 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -42,7 +42,7 @@ proc semGenericStmtSymbol(c: PContext, n: PNode, s: PSym): PNode = of skUnknown: # Introduced in this pass! Leave it as an identifier. result = n - of skProc, skMethod, skIterator, skConverter: + of skProc, skMethod, skIterators, skConverter: result = symChoice(c, n, s, scOpen) of skTemplate: if macroToExpand(s): @@ -141,7 +141,7 @@ proc semGenericStmt(c: PContext, n: PNode, # symbol lookup ... of skUnknown, skParam: # Leave it as an identifier. - of skProc, skMethod, skIterator, skConverter: + of skProc, skMethod, skIterators, skConverter: result.sons[0] = symChoice(c, n.sons[0], s, scOption) first = 1 of skGenericParam: -- cgit 1.4.1-2-gfad0 From b76d2eac7f551cafa0ac797330e3bd0650ab26d9 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 22 Mar 2014 22:59:23 +0100 Subject: fixes #1006 --- compiler/c2nim/cparse.nim | 3 ++- compiler/semgnrc.nim | 2 ++ doc/manual.txt | 17 ++++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'compiler/semgnrc.nim') diff --git a/compiler/c2nim/cparse.nim b/compiler/c2nim/cparse.nim index 86533fe26..52d50ca39 100644 --- a/compiler/c2nim/cparse.nim +++ b/compiler/c2nim/cparse.nim @@ -1279,7 +1279,8 @@ proc leftBindingPower(p : var TParser, tok : ref TToken) : int = of pxComma: return 10 # throw == 20 - of pxAsgn, pxPlusAsgn, pxMinusAsgn, pxStarAsgn, pxSlashAsgn, pxModAsgn, pxShlAsgn, pxShrAsgn, pxAmpAsgn, pxHatAsgn, pxBarAsgn: + of pxAsgn, pxPlusAsgn, pxMinusAsgn, pxStarAsgn, pxSlashAsgn, pxModAsgn, + pxShlAsgn, pxShrAsgn, pxAmpAsgn, pxHatAsgn, pxBarAsgn: return 30 of pxConditional: return 40 diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index ffc1a43b2..2de397e25 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -94,6 +94,8 @@ proc semGenericStmt(c: PContext, n: PNode, let luf = if withinMixin notin flags: {checkUndeclared} else: {} var s = qualifiedLookUp(c, n, luf) if s != nil: result = semGenericStmtSymbol(c, n, s) + else: + # XXX for example: ``result.add`` -- ``add`` needs to be looked up here... of nkEmpty, nkSym..nkNilLit: # see tests/compile/tgensymgeneric.nim: diff --git a/doc/manual.txt b/doc/manual.txt index 5c4aa2c17..c2acd3e6a 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -499,18 +499,21 @@ other binary operators are left-associative. Precedence ---------- -For operators that are not keywords the precedence is determined by the -following rules: +Unary operators always bind stronger than any binary +operator: ``$a + b`` is ``($a) + b`` and not ``$(a + b)``. -If the operator ends with ``=`` and its relevant character is none of -``<``, ``>``, ``!``, ``=``, ``~``, ``?``, it is an *assignment operator* which -has the lowest precedence. - -If the operator's relevant character is ``@`` it is a `sigil-like`:idx: +If an unary operator's relevant character is ``@`` it is a `sigil-like`:idx: operator which binds stronger than a ``primarySuffix``: ``@x.abc`` is parsed as ``(@x).abc`` whereas ``$x.abc`` is parsed as ``$(x.abc)``. +For binary operators that are not keywords the precedence is determined by the +following rules: + +If the operator ends with ``=`` and its relevant character is none of +``<``, ``>``, ``!``, ``=``, ``~``, ``?``, it is an *assignment operator* which +has the lowest precedence. + Otherwise precedence is determined by the relevant character. ================ =============================================== ================== =============== -- cgit 1.4.1-2-gfad0 From a4f30c36822511ce4460a5d23b2ec82e36f5e796 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 22 Mar 2014 23:02:01 +0100 Subject: fixes wrong commit --- compiler/semgnrc.nim | 2 -- 1 file changed, 2 deletions(-) (limited to 'compiler/semgnrc.nim') diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index 2de397e25..ffc1a43b2 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -94,8 +94,6 @@ proc semGenericStmt(c: PContext, n: PNode, let luf = if withinMixin notin flags: {checkUndeclared} else: {} var s = qualifiedLookUp(c, n, luf) if s != nil: result = semGenericStmtSymbol(c, n, s) - else: - # XXX for example: ``result.add`` -- ``add`` needs to be looked up here... of nkEmpty, nkSym..nkNilLit: # see tests/compile/tgensymgeneric.nim: -- cgit 1.4.1-2-gfad0