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
Show 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);
...
@@ -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
);
ulong
escchar
(
int
,
int
*
);
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 @
feb1c77f
...
@@ -171,7 +171,8 @@ cannedimports(void)
...
@@ -171,7 +171,8 @@ cannedimports(void)
long
long
yylex
(
void
)
yylex
(
void
)
{
{
ulong
c
,
c1
;
int
c
,
c1
;
vlong
v
;
char
*
cp
;
char
*
cp
;
Rune
rune
;
Rune
rune
;
int
escflag
;
int
escflag
;
...
@@ -224,14 +225,14 @@ l0:
...
@@ -224,14 +225,14 @@ l0:
caseq:
caseq:
for
(;;)
{
for
(;;)
{
c
=
escchar
(
'"'
,
&
escflag
);
if
(
escchar
(
'"'
,
&
escflag
,
&
v
))
if
(
c
==
EOF
)
break
;
break
;
if
(
escflag
)
{
if
(
escflag
)
{
cp
=
remal
(
cp
,
c1
,
1
);
cp
=
remal
(
cp
,
c1
,
1
);
cp
[
c1
++
]
=
c
;
cp
[
c1
++
]
=
v
;
}
else
{
}
else
{
rune
=
c
;
// botch - this limits size of runes
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
);
...
@@ -281,15 +282,13 @@ l0:
...
@@ -281,15 +282,13 @@ l0:
case
'\''
:
case
'\''
:
/* '.' */
/* '.' */
c
=
escchar
(
'\''
,
&
escflag
);
if
(
escchar
(
'\''
,
&
escflag
,
&
v
))
if
(
c
==
EOF
)
v
=
'\''
;
// allow '''
c
=
'\''
;
if
(
!
escchar
(
'\''
,
&
escflag
,
&
v
))
{
c1
=
escchar
(
'\''
,
&
escflag
);
if
(
c1
!=
EOF
)
{
yyerror
(
"missing '"
);
yyerror
(
"missing '"
);
ungetc
(
c1
);
ungetc
(
v
);
}
}
yylval
.
val
.
vval
=
c
;
yylval
.
val
.
vval
=
v
;
yylval
.
val
.
ctype
=
CTINT
;
yylval
.
val
.
ctype
=
CTINT
;
DBG
(
"lex: codepoint literal
\n
"
);
DBG
(
"lex: codepoint literal
\n
"
);
return
LLITERAL
;
return
LLITERAL
;
...
@@ -696,11 +695,11 @@ getnsc(void)
...
@@ -696,11 +695,11 @@ getnsc(void)
}
}
ulong
int
escchar
(
int
e
,
int
*
escflg
)
escchar
(
int
e
,
int
*
escflg
,
vlong
*
val
)
{
{
ulong
c
,
l
;
int
i
,
c
;
int
i
;
vlong
l
;
*
escflg
=
0
;
*
escflg
=
0
;
...
@@ -708,13 +707,15 @@ loop:
...
@@ -708,13 +707,15 @@ loop:
c
=
getr
();
c
=
getr
();
if
(
c
==
'\n'
)
{
if
(
c
==
'\n'
)
{
yyerror
(
"newline in string"
);
yyerror
(
"newline in string"
);
return
EOF
;
return
1
;
}
}
if
(
c
!=
'\\'
)
{
if
(
c
!=
'\\'
)
{
if
(
c
==
e
)
if
(
c
==
e
)
c
=
EOF
;
return
1
;
return
c
;
*
val
=
c
;
return
0
;
}
}
c
=
getr
();
c
=
getr
();
switch
(
c
)
{
switch
(
c
)
{
case
'\n'
:
case
'\n'
:
...
@@ -742,20 +743,21 @@ loop:
...
@@ -742,20 +743,21 @@ loop:
case
'7'
:
case
'7'
:
goto
oct
;
goto
oct
;
case
'a'
:
return
'\a'
;
case
'a'
:
c
=
'\a'
;
break
;
case
'b'
:
return
'\b'
;
case
'b'
:
c
=
'\b'
;
break
;
case
'f'
:
return
'\f'
;
case
'f'
:
c
=
'\f'
;
break
;
case
'n'
:
return
'\n'
;
case
'n'
:
c
=
'\n'
;
break
;
case
'r'
:
return
'\r'
;
case
'r'
:
c
=
'\r'
;
break
;
case
't'
:
return
'\t'
;
case
't'
:
c
=
'\t'
;
break
;
case
'v'
:
return
'\v'
;
case
'v'
:
c
=
'\v'
;
break
;
case
'\\'
:
return
'\\'
;
case
'\\'
:
c
=
'\\'
;
break
;
default:
default:
if
(
c
!=
e
)
if
(
c
!=
e
)
warn
(
"unknown escape sequence: %c"
,
c
);
warn
(
"unknown escape sequence: %c"
,
c
);
}
}
return
c
;
*
val
=
c
;
return
0
;
hex:
hex:
l
=
0
;
l
=
0
;
...
@@ -778,7 +780,8 @@ hex:
...
@@ -778,7 +780,8 @@ hex:
break
;
break
;
}
}
*
escflg
=
1
;
*
escflg
=
1
;
return
l
;
*
val
=
l
;
return
0
;
oct:
oct:
l
=
c
-
'0'
;
l
=
c
-
'0'
;
...
@@ -794,7 +797,8 @@ oct:
...
@@ -794,7 +797,8 @@ oct:
if
(
l
>
255
)
if
(
l
>
255
)
warn
(
"oct escape value > 255: %d"
,
l
);
warn
(
"oct escape value > 255: %d"
,
l
);
*
escflg
=
1
;
*
escflg
=
1
;
return
l
;
*
val
=
l
;
return
0
;
}
}
static
struct
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