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
3d4d5ad0
Commit
3d4d5ad0
authored
Jan 26, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
defer statement
R=r OCL=23542 CL=23542
parent
1ce17918
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
9 deletions
+13
-9
usr/gri/pretty/parser.go
usr/gri/pretty/parser.go
+6
-6
usr/gri/pretty/printer.go
usr/gri/pretty/printer.go
+3
-1
usr/gri/pretty/scanner.go
usr/gri/pretty/scanner.go
+2
-0
usr/gri/pretty/selftest2.go
usr/gri/pretty/selftest2.go
+1
-1
usr/gri/pretty/test.sh
usr/gri/pretty/test.sh
+1
-1
No files found.
usr/gri/pretty/parser.go
View file @
3d4d5ad0
...
...
@@ -1186,11 +1186,11 @@ func (P *Parser) ParseSimpleStat(range_ok bool) *AST.Stat {
}
func
(
P
*
Parser
)
Parse
GoStat
(
)
*
AST
.
Stat
{
P
.
Trace
(
"
Go
Stat"
);
func
(
P
*
Parser
)
Parse
InvocationStat
(
keyword
int
)
*
AST
.
Stat
{
P
.
Trace
(
"
Invocation
Stat"
);
s
:=
AST
.
NewStat
(
P
.
pos
,
Scanner
.
GO
);
P
.
Expect
(
Scanner
.
GO
);
s
:=
AST
.
NewStat
(
P
.
pos
,
keyword
);
P
.
Expect
(
keyword
);
s
.
Expr
=
P
.
ParseExpression
(
1
);
P
.
Ecart
();
...
...
@@ -1434,8 +1434,8 @@ func (P *Parser) ParseStatement() *AST.Stat {
Scanner
.
LBRACK
,
Scanner
.
STRUCT
,
// composite type
Scanner
.
MUL
,
Scanner
.
AND
,
Scanner
.
ARROW
:
// unary
s
=
P
.
ParseSimpleStat
(
false
);
case
Scanner
.
GO
:
s
=
P
.
Parse
GoStat
(
);
case
Scanner
.
GO
,
Scanner
.
DEFER
:
s
=
P
.
Parse
InvocationStat
(
P
.
tok
);
case
Scanner
.
RETURN
:
s
=
P
.
ParseReturnStat
();
case
Scanner
.
BREAK
,
Scanner
.
CONTINUE
,
Scanner
.
GOTO
,
Scanner
.
FALLTHROUGH
:
...
...
usr/gri/pretty/printer.go
View file @
3d4d5ad0
...
...
@@ -776,7 +776,9 @@ func (P *Printer) Stat(s *AST.Stat) {
P
.
indentation
--
;
P
.
newlines
=
1
;
case
Scanner
.
GO
,
Scanner
.
RETURN
,
Scanner
.
FALLTHROUGH
,
Scanner
.
BREAK
,
Scanner
.
CONTINUE
,
Scanner
.
GOTO
:
case
Scanner
.
GO
,
Scanner
.
DEFER
,
Scanner
.
RETURN
,
Scanner
.
FALLTHROUGH
,
Scanner
.
BREAK
,
Scanner
.
CONTINUE
,
Scanner
.
GOTO
:
P
.
Token
(
s
.
Pos
,
s
.
Tok
);
if
s
.
Expr
!=
nil
{
P
.
separator
=
blank
;
...
...
usr/gri/pretty/scanner.go
View file @
3d4d5ad0
...
...
@@ -84,6 +84,7 @@ const (
CONTINUE
;
DEFAULT
;
DEFER
;
ELSE
;
FALLTHROUGH
;
FOR
;
...
...
@@ -185,6 +186,7 @@ func TokenString(tok int) string {
case
CONTINUE
:
return
"continue"
;
case
DEFAULT
:
return
"default"
;
case
DEFER
:
return
"defer"
;
case
ELSE
:
return
"else"
;
case
FALLTHROUGH
:
return
"fallthrough"
;
case
FOR
:
return
"for"
;
...
...
usr/gri/pretty/selftest2.go
View file @
3d4d5ad0
...
...
@@ -123,7 +123,7 @@ func f3(a *[]int, m map[string] int) {
var
i
string
;
var
x
int
;
for
i
,
x
=
range
m
{
println
(
i
,
x
);
defer
println
(
i
,
x
);
}
}
...
...
usr/gri/pretty/test.sh
View file @
3d4d5ad0
...
...
@@ -27,7 +27,7 @@ apply1() {
# the following have semantic errors: bug039.go | bug040.go
method1.go
|
selftest1.go
|
func3.go
|
\
bug014.go
|
bug025.go
|
bug029.go
|
bug032.go
|
bug039.go
|
bug040.go
|
bug050.go
|
bug068.go
|
\
bug088.go
|
bug083.go
|
bug106.go
|
bug125.go
|
bug126.go
|
bug132.go
)
;;
bug088.go
|
bug083.go
|
bug106.go
|
bug125.go
|
bug126.go
|
bug132.go
|
bug133.go
)
;;
*
)
$1
$2
;
count
$F
;;
esac
}
...
...
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