Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1b141ca0
Commit
1b141ca0
authored
Mar 16, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added &^ and &^=
R=rsc DELTA=14 (12 added, 0 deleted, 2 changed) OCL=26278 CL=26348
parent
5a270798
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
scanner.go
src/lib/go/scanner.go
+7
-1
scanner_test.go
src/lib/go/scanner_test.go
+2
-0
token.go
src/lib/go/token.go
+5
-1
No files found.
src/lib/go/scanner.go
View file @
1b141ca0
...
@@ -447,7 +447,13 @@ scan_again:
...
@@ -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
));
}
}
...
...
src/lib/go/scanner_test.go
View file @
1b141ca0
...
@@ -76,6 +76,7 @@ var tokens = [...]elt{
...
@@ -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{
...
@@ -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
},
...
...
src/lib/go/token.go
View file @
1b141ca0
...
@@ -40,6 +40,7 @@ const (
...
@@ -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 (
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment