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
feb1c77f
Commit
feb1c77f
authored
Jun 06, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cafebabe
SVN=121574
parent
d9178fce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
31 deletions
+35
-31
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-1
src/cmd/gc/lex.c
src/cmd/gc/lex.c
+34
-30
No files found.
src/cmd/gc/go.h
View file @
feb1c77f
...
...
@@ -387,7 +387,7 @@ void lexinit(void);
char
*
lexname
(
int
);
long
getr
(
void
);
int
getnsc
(
void
);
ulong
escchar
(
int
,
int
*
);
int
escchar
(
int
,
int
*
,
vlong
*
);
int
getc
(
void
);
void
ungetc
(
int
);
void
mkpackage
(
char
*
);
...
...
src/cmd/gc/lex.c
View file @
feb1c77f
...
...
@@ -171,7 +171,8 @@ cannedimports(void)
long
yylex
(
void
)
{
ulong
c
,
c1
;
int
c
,
c1
;
vlong
v
;
char
*
cp
;
Rune
rune
;
int
escflag
;
...
...
@@ -224,14 +225,14 @@ l0:
caseq:
for
(;;)
{
c
=
escchar
(
'"'
,
&
escflag
);
if
(
c
==
EOF
)
if
(
escchar
(
'"'
,
&
escflag
,
&
v
))
break
;
if
(
escflag
)
{
cp
=
remal
(
cp
,
c1
,
1
);
cp
[
c1
++
]
=
c
;
cp
[
c1
++
]
=
v
;
}
else
{
rune
=
c
;
// botch - this limits size of runes
rune
=
v
;
c
=
runelen
(
rune
);
cp
=
remal
(
cp
,
c1
,
c
);
runetochar
(
cp
+
c1
,
&
rune
);
...
...
@@ -281,15 +282,13 @@ l0:
case
'\''
:
/* '.' */
c
=
escchar
(
'\''
,
&
escflag
);
if
(
c
==
EOF
)
c
=
'\''
;
c1
=
escchar
(
'\''
,
&
escflag
);
if
(
c1
!=
EOF
)
{
if
(
escchar
(
'\''
,
&
escflag
,
&
v
))
v
=
'\''
;
// allow '''
if
(
!
escchar
(
'\''
,
&
escflag
,
&
v
))
{
yyerror
(
"missing '"
);
ungetc
(
c1
);
ungetc
(
v
);
}
yylval
.
val
.
vval
=
c
;
yylval
.
val
.
vval
=
v
;
yylval
.
val
.
ctype
=
CTINT
;
DBG
(
"lex: codepoint literal
\n
"
);
return
LLITERAL
;
...
...
@@ -696,11 +695,11 @@ getnsc(void)
}
ulong
escchar
(
int
e
,
int
*
escflg
)
int
escchar
(
int
e
,
int
*
escflg
,
vlong
*
val
)
{
ulong
c
,
l
;
int
i
;
int
i
,
c
;
vlong
l
;
*
escflg
=
0
;
...
...
@@ -708,13 +707,15 @@ loop:
c
=
getr
();
if
(
c
==
'\n'
)
{
yyerror
(
"newline in string"
);
return
EOF
;
return
1
;
}
if
(
c
!=
'\\'
)
{
if
(
c
==
e
)
c
=
EOF
;
return
c
;
return
1
;
*
val
=
c
;
return
0
;
}
c
=
getr
();
switch
(
c
)
{
case
'\n'
:
...
...
@@ -742,20 +743,21 @@ loop:
case
'7'
:
goto
oct
;
case
'a'
:
return
'\a'
;
case
'b'
:
return
'\b'
;
case
'f'
:
return
'\f'
;
case
'n'
:
return
'\n'
;
case
'r'
:
return
'\r'
;
case
't'
:
return
'\t'
;
case
'v'
:
return
'\v'
;
case
'\\'
:
return
'\\'
;
case
'a'
:
c
=
'\a'
;
break
;
case
'b'
:
c
=
'\b'
;
break
;
case
'f'
:
c
=
'\f'
;
break
;
case
'n'
:
c
=
'\n'
;
break
;
case
'r'
:
c
=
'\r'
;
break
;
case
't'
:
c
=
'\t'
;
break
;
case
'v'
:
c
=
'\v'
;
break
;
case
'\\'
:
c
=
'\\'
;
break
;
default:
if
(
c
!=
e
)
warn
(
"unknown escape sequence: %c"
,
c
);
}
return
c
;
*
val
=
c
;
return
0
;
hex:
l
=
0
;
...
...
@@ -778,7 +780,8 @@ hex:
break
;
}
*
escflg
=
1
;
return
l
;
*
val
=
l
;
return
0
;
oct:
l
=
c
-
'0'
;
...
...
@@ -794,7 +797,8 @@ oct:
if
(
l
>
255
)
warn
(
"oct escape value > 255: %d"
,
l
);
*
escflg
=
1
;
return
l
;
*
val
=
l
;
return
0
;
}
static
struct
...
...
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