Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
3857747d
Commit
3857747d
authored
May 24, 2011
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/scanner: remove some code
R=r CC=golang-dev
https://golang.org/cl/4550077
parent
3c7271f0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
32 deletions
+4
-32
src/pkg/go/scanner/scanner.go
src/pkg/go/scanner/scanner.go
+2
-31
src/pkg/go/scanner/scanner_test.go
src/pkg/go/scanner/scanner_test.go
+2
-1
No files found.
src/pkg/go/scanner/scanner.go
View file @
3857747d
...
...
@@ -22,6 +22,7 @@ package scanner
import
(
"bytes"
"fmt"
"go/token"
"path/filepath"
"strconv"
...
...
@@ -134,36 +135,6 @@ func (S *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode uint
}
func
charString
(
ch
int
)
string
{
var
s
string
switch
ch
{
case
-
1
:
return
`EOF`
case
'\a'
:
s
=
`\a`
case
'\b'
:
s
=
`\b`
case
'\f'
:
s
=
`\f`
case
'\n'
:
s
=
`\n`
case
'\r'
:
s
=
`\r`
case
'\t'
:
s
=
`\t`
case
'\v'
:
s
=
`\v`
case
'\\'
:
s
=
`\\`
case
'\'
'
:
s
=
`\'`
default
:
s
=
string
(
ch
)
}
return
"'"
+
s
+
"' (U+"
+
strconv
.
Itob
(
ch
,
16
)
+
")"
}
func
(
S
*
Scanner
)
error
(
offs
int
,
msg
string
)
{
if
S
.
err
!=
nil
{
S
.
err
.
Error
(
S
.
file
.
Position
(
S
.
file
.
Pos
(
offs
)),
msg
)
...
...
@@ -700,7 +671,7 @@ scanAgain:
tok
=
S
.
switch3
(
token
.
OR
,
token
.
OR_ASSIGN
,
'|'
,
token
.
LOR
)
default
:
if
S
.
mode
&
AllowIllegalChars
==
0
{
S
.
error
(
offs
,
"illegal character "
+
charString
(
ch
))
S
.
error
(
offs
,
fmt
.
Sprintf
(
"illegal character '%c' (%U)"
,
ch
,
ch
))
}
insertSemi
=
S
.
insertSemi
// preserve insertSemi info
}
...
...
src/pkg/go/scanner/scanner_test.go
View file @
3857747d
...
...
@@ -650,7 +650,8 @@ var errors = []struct {
pos
int
err
string
}{
{
`#`
,
token
.
ILLEGAL
,
0
,
"illegal character '#' (U+23)"
},
{
"
\a
"
,
token
.
ILLEGAL
,
0
,
"illegal character '
\a
' (U+0007)"
},
{
`#`
,
token
.
ILLEGAL
,
0
,
"illegal character '#' (U+0023)"
},
{
`' '`
,
token
.
CHAR
,
0
,
""
},
{
`''`
,
token
.
CHAR
,
0
,
"illegal character literal"
},
{
`'\8'`
,
token
.
CHAR
,
2
,
"unknown escape sequence"
},
...
...
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