mirror of
https://github.com/golang/go
synced 2024-11-26 02:17:58 -07:00
added &^ and &^=
R=rsc DELTA=14 (12 added, 0 deleted, 2 changed) OCL=26278 CL=26348
This commit is contained in:
parent
5a27079801
commit
1b141ca068
@ -447,7 +447,13 @@ scan_again:
|
|||||||
case '>': tok = S.switch4(token.GTR, token.GEQ, '>', token.SHR, token.SHR_ASSIGN);
|
case '>': tok = S.switch4(token.GTR, token.GEQ, '>', token.SHR, token.SHR_ASSIGN);
|
||||||
case '=': tok = S.switch2(token.ASSIGN, token.EQL);
|
case '=': tok = S.switch2(token.ASSIGN, token.EQL);
|
||||||
case '!': tok = S.switch2(token.NOT, token.NEQ);
|
case '!': tok = S.switch2(token.NOT, token.NEQ);
|
||||||
case '&': tok = S.switch3(token.AND, token.AND_ASSIGN, '&', token.LAND);
|
case '&':
|
||||||
|
if S.ch == '^' {
|
||||||
|
S.next();
|
||||||
|
tok = S.switch2(token.AND_NOT, token.AND_NOT_ASSIGN);
|
||||||
|
} else {
|
||||||
|
tok = S.switch3(token.AND, token.AND_ASSIGN, '&', token.LAND);
|
||||||
|
}
|
||||||
case '|': tok = S.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR);
|
case '|': tok = S.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR);
|
||||||
default: S.error(loc, "illegal character " + charString(ch));
|
default: S.error(loc, "illegal character " + charString(ch));
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ var tokens = [...]elt{
|
|||||||
elt{ token.XOR, "^", operator },
|
elt{ token.XOR, "^", operator },
|
||||||
elt{ token.SHL, "<<", operator },
|
elt{ token.SHL, "<<", operator },
|
||||||
elt{ token.SHR, ">>", operator },
|
elt{ token.SHR, ">>", operator },
|
||||||
|
elt{ token.AND_NOT, "&^", operator },
|
||||||
|
|
||||||
elt{ token.ADD_ASSIGN, "+=", operator },
|
elt{ token.ADD_ASSIGN, "+=", operator },
|
||||||
elt{ token.SUB_ASSIGN, "-=", operator },
|
elt{ token.SUB_ASSIGN, "-=", operator },
|
||||||
@ -88,6 +89,7 @@ var tokens = [...]elt{
|
|||||||
elt{ token.XOR_ASSIGN, "^=", operator },
|
elt{ token.XOR_ASSIGN, "^=", operator },
|
||||||
elt{ token.SHL_ASSIGN, "<<=", operator },
|
elt{ token.SHL_ASSIGN, "<<=", operator },
|
||||||
elt{ token.SHR_ASSIGN, ">>=", operator },
|
elt{ token.SHR_ASSIGN, ">>=", operator },
|
||||||
|
elt{ token.AND_NOT_ASSIGN, "&^=", operator },
|
||||||
|
|
||||||
elt{ token.LAND, "&&", operator },
|
elt{ token.LAND, "&&", operator },
|
||||||
elt{ token.LOR, "||", operator },
|
elt{ token.LOR, "||", operator },
|
||||||
|
@ -40,6 +40,7 @@ const (
|
|||||||
XOR;
|
XOR;
|
||||||
SHL;
|
SHL;
|
||||||
SHR;
|
SHR;
|
||||||
|
AND_NOT;
|
||||||
|
|
||||||
ADD_ASSIGN;
|
ADD_ASSIGN;
|
||||||
SUB_ASSIGN;
|
SUB_ASSIGN;
|
||||||
@ -52,6 +53,7 @@ const (
|
|||||||
XOR_ASSIGN;
|
XOR_ASSIGN;
|
||||||
SHL_ASSIGN;
|
SHL_ASSIGN;
|
||||||
SHR_ASSIGN;
|
SHR_ASSIGN;
|
||||||
|
AND_NOT_ASSIGN;
|
||||||
|
|
||||||
LAND;
|
LAND;
|
||||||
LOR;
|
LOR;
|
||||||
@ -145,6 +147,7 @@ var tokens = map [int] string {
|
|||||||
XOR : "^",
|
XOR : "^",
|
||||||
SHL : "<<",
|
SHL : "<<",
|
||||||
SHR : ">>",
|
SHR : ">>",
|
||||||
|
AND_NOT : "&^",
|
||||||
|
|
||||||
ADD_ASSIGN : "+=",
|
ADD_ASSIGN : "+=",
|
||||||
SUB_ASSIGN : "-=",
|
SUB_ASSIGN : "-=",
|
||||||
@ -157,6 +160,7 @@ var tokens = map [int] string {
|
|||||||
XOR_ASSIGN : "^=",
|
XOR_ASSIGN : "^=",
|
||||||
SHL_ASSIGN : "<<=",
|
SHL_ASSIGN : "<<=",
|
||||||
SHR_ASSIGN : ">>=",
|
SHR_ASSIGN : ">>=",
|
||||||
|
AND_NOT_ASSIGN : "&^=",
|
||||||
|
|
||||||
LAND : "&&",
|
LAND : "&&",
|
||||||
LOR : "||",
|
LOR : "||",
|
||||||
@ -264,7 +268,7 @@ func Precedence(tok int) int {
|
|||||||
return 4;
|
return 4;
|
||||||
case ADD, SUB, OR, XOR:
|
case ADD, SUB, OR, XOR:
|
||||||
return 5;
|
return 5;
|
||||||
case MUL, QUO, REM, SHL, SHR, AND:
|
case MUL, QUO, REM, SHL, SHR, AND, AND_NOT:
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
return LowestPrec;
|
return LowestPrec;
|
||||||
|
Loading…
Reference in New Issue
Block a user