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
f9c58c25
Commit
f9c58c25
authored
Jun 09, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more nihan
SVN=121622
parent
9abf9e8a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
go.h
src/cmd/gc/go.h
+1
-1
lex.c
src/cmd/gc/lex.c
+15
-10
No files found.
src/cmd/gc/go.h
View file @
f9c58c25
...
@@ -387,7 +387,7 @@ void lexinit(void);
...
@@ -387,7 +387,7 @@ void lexinit(void);
char
*
lexname
(
int
);
char
*
lexname
(
int
);
long
getr
(
void
);
long
getr
(
void
);
int
getnsc
(
void
);
int
getnsc
(
void
);
int
escchar
(
int
,
vlong
*
);
int
escchar
(
int
,
int
*
,
vlong
*
);
int
getc
(
void
);
int
getc
(
void
);
void
ungetc
(
int
);
void
ungetc
(
int
);
void
mkpackage
(
char
*
);
void
mkpackage
(
char
*
);
...
...
src/cmd/gc/lex.c
View file @
f9c58c25
...
@@ -175,6 +175,7 @@ yylex(void)
...
@@ -175,6 +175,7 @@ yylex(void)
vlong
v
;
vlong
v
;
char
*
cp
;
char
*
cp
;
Rune
rune
;
Rune
rune
;
int
escflag
;
Sym
*
s
;
Sym
*
s
;
l0:
l0:
...
@@ -224,19 +225,19 @@ l0:
...
@@ -224,19 +225,19 @@ l0:
caseq:
caseq:
for
(;;)
{
for
(;;)
{
if
(
escchar
(
'"'
,
&
v
))
if
(
escchar
(
'"'
,
&
escflag
,
&
v
))
break
;
break
;
if
(
v
>=
Runeself
)
{
if
(
escflag
||
v
<
Runeself
)
{
cp
=
remal
(
cp
,
c1
,
1
);
cp
[
c1
++
]
=
v
;
}
else
{
// botch - this limits size of runes
// botch - this limits size of runes
rune
=
v
;
rune
=
v
;
c
=
runelen
(
rune
);
c
=
runelen
(
rune
);
cp
=
remal
(
cp
,
c1
,
c
);
cp
=
remal
(
cp
,
c1
,
c
);
runetochar
(
cp
+
c1
,
&
rune
);
runetochar
(
cp
+
c1
,
&
rune
);
c1
+=
c
;
c1
+=
c
;
continue
;
}
}
cp
=
remal
(
cp
,
c1
,
1
);
cp
[
c1
++
]
=
v
;
}
}
goto
catem
;
goto
catem
;
...
@@ -281,9 +282,9 @@ l0:
...
@@ -281,9 +282,9 @@ l0:
case
'\''
:
case
'\''
:
/* '.' */
/* '.' */
if
(
escchar
(
'\''
,
&
v
))
if
(
escchar
(
'\''
,
&
escflag
,
&
v
))
v
=
'\''
;
// allow '''
v
=
'\''
;
// allow '''
if
(
!
escchar
(
'\''
,
&
v
))
{
if
(
!
escchar
(
'\''
,
&
escflag
,
&
v
))
{
yyerror
(
"missing '"
);
yyerror
(
"missing '"
);
ungetc
(
v
);
ungetc
(
v
);
}
}
...
@@ -695,12 +696,13 @@ getnsc(void)
...
@@ -695,12 +696,13 @@ getnsc(void)
int
int
escchar
(
int
e
,
vlong
*
val
)
escchar
(
int
e
,
int
*
escflg
,
vlong
*
val
)
{
{
int
i
;
int
i
,
c
;
long
c
;
vlong
l
;
vlong
l
;
*
escflg
=
0
;
loop:
loop:
c
=
getr
();
c
=
getr
();
if
(
c
==
'\n'
)
{
if
(
c
==
'\n'
)
{
...
@@ -720,6 +722,7 @@ loop:
...
@@ -720,6 +722,7 @@ loop:
goto
loop
;
goto
loop
;
case
'x'
:
case
'x'
:
*
escflg
=
1
;
// it's a byte
i
=
2
;
i
=
2
;
goto
hex
;
goto
hex
;
...
@@ -739,6 +742,7 @@ loop:
...
@@ -739,6 +742,7 @@ loop:
case
'5'
:
case
'5'
:
case
'6'
:
case
'6'
:
case
'7'
:
case
'7'
:
*
escflg
=
1
;
// it's a byte
goto
oct
;
goto
oct
;
case
'a'
:
c
=
'\a'
;
break
;
case
'a'
:
c
=
'\a'
;
break
;
...
@@ -793,6 +797,7 @@ oct:
...
@@ -793,6 +797,7 @@ oct:
}
}
if
(
l
>
255
)
if
(
l
>
255
)
warn
(
"oct escape value > 255: %d"
,
l
);
warn
(
"oct escape value > 255: %d"
,
l
);
*
val
=
l
;
*
val
=
l
;
return
0
;
return
0
;
}
}
...
...
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