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
626d2506
Commit
626d2506
authored
Jan 16, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
casify struct fields
R=r OCL=22998 CL=22998
parent
aedf121e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
23 deletions
+23
-23
ast.go
usr/gri/pretty/ast.go
+3
-3
compilation.go
usr/gri/pretty/compilation.go
+11
-11
parser.go
usr/gri/pretty/parser.go
+1
-1
pretty.go
usr/gri/pretty/pretty.go
+8
-8
No files found.
usr/gri/pretty/ast.go
View file @
626d2506
...
...
@@ -99,14 +99,14 @@ export func NewObject(pos, kind int, ident string) *Object {
// Scopes
export
type
Scope
struct
{
p
arent
*
Scope
;
P
arent
*
Scope
;
entries
map
[
string
]
*
Object
;
}
export
func
NewScope
(
parent
*
Scope
)
*
Scope
{
scope
:=
new
(
Scope
);
scope
.
p
arent
=
parent
;
scope
.
P
arent
=
parent
;
scope
.
entries
=
make
(
map
[
string
]
*
Object
,
8
);
return
scope
;
}
...
...
@@ -127,7 +127,7 @@ func (scope *Scope) Lookup(ident string) *Object {
if
obj
!=
nil
{
return
obj
;
}
scope
=
scope
.
p
arent
;
scope
=
scope
.
P
arent
;
}
return
nil
;
}
...
...
usr/gri/pretty/compilation.go
View file @
626d2506
...
...
@@ -24,13 +24,13 @@ func assert(b bool) {
export
type
Flags
struct
{
v
erbose
bool
;
s
ixg
bool
;
d
eps
bool
;
c
olumns
bool
;
t
estmode
bool
;
t
okenchan
bool
;
n
aming
bool
;
V
erbose
bool
;
S
ixg
bool
;
D
eps
bool
;
C
olumns
bool
;
T
estmode
bool
;
T
okenchan
bool
;
N
aming
bool
;
}
...
...
@@ -125,18 +125,18 @@ export func Compile(src_file string, flags *Flags) (*AST.Program, int) {
}
var
err
errorHandler
;
err
.
Init
(
src_file
,
src
,
flags
.
c
olumns
);
err
.
Init
(
src_file
,
src
,
flags
.
C
olumns
);
var
scanner
Scanner
.
Scanner
;
scanner
.
Init
(
&
err
,
src
,
true
,
flags
.
t
estmode
);
scanner
.
Init
(
&
err
,
src
,
true
,
flags
.
T
estmode
);
var
tstream
<-
chan
*
Scanner
.
Token
;
if
flags
.
t
okenchan
{
if
flags
.
T
okenchan
{
tstream
=
scanner
.
TokenStream
();
}
var
parser
Parser
.
Parser
;
parser
.
Open
(
flags
.
verbose
,
flags
.
sixg
,
flags
.
deps
,
flags
.
n
aming
,
&
scanner
,
tstream
);
parser
.
Open
(
flags
.
Verbose
,
flags
.
Sixg
,
flags
.
Deps
,
flags
.
N
aming
,
&
scanner
,
tstream
);
prog
:=
parser
.
ParseProgram
();
...
...
usr/gri/pretty/parser.go
View file @
626d2506
...
...
@@ -160,7 +160,7 @@ func (P *Parser) OpenScope() {
func
(
P
*
Parser
)
CloseScope
()
{
P
.
top_scope
=
P
.
top_scope
.
p
arent
;
P
.
top_scope
=
P
.
top_scope
.
P
arent
;
}
...
...
usr/gri/pretty/pretty.go
View file @
626d2506
...
...
@@ -18,14 +18,14 @@ var (
)
func
init
()
{
Flag
.
BoolVar
(
&
flags
.
v
erbose
,
"v"
,
false
,
"verbose mode: trace parsing"
);
Flag
.
BoolVar
(
&
flags
.
s
ixg
,
"6g"
,
true
,
"6g compatibility mode"
);
Flag
.
BoolVar
(
&
flags
.
V
erbose
,
"v"
,
false
,
"verbose mode: trace parsing"
);
Flag
.
BoolVar
(
&
flags
.
S
ixg
,
"6g"
,
true
,
"6g compatibility mode"
);
//TODO fix this code again
//Flag.BoolVar(&flags.
d
eps, "d", false, "print dependency information only");
Flag
.
BoolVar
(
&
flags
.
c
olumns
,
"columns"
,
Platform
.
USER
==
"gri"
,
"print column info in error messages"
);
Flag
.
BoolVar
(
&
flags
.
t
estmode
,
"t"
,
false
,
"test mode: interprets /* ERROR */ and /* SYNC */ comments"
);
Flag
.
BoolVar
(
&
flags
.
t
okenchan
,
"token_chan"
,
false
,
"use token channel for scanner-parser connection"
);
Flag
.
BoolVar
(
&
flags
.
n
aming
,
"naming"
,
false
,
"verify export naming scheme"
);
//Flag.BoolVar(&flags.
D
eps, "d", false, "print dependency information only");
Flag
.
BoolVar
(
&
flags
.
C
olumns
,
"columns"
,
Platform
.
USER
==
"gri"
,
"print column info in error messages"
);
Flag
.
BoolVar
(
&
flags
.
T
estmode
,
"t"
,
false
,
"test mode: interprets /* ERROR */ and /* SYNC */ comments"
);
Flag
.
BoolVar
(
&
flags
.
T
okenchan
,
"token_chan"
,
false
,
"use token channel for scanner-parser connection"
);
Flag
.
BoolVar
(
&
flags
.
N
aming
,
"naming"
,
false
,
"verify export naming scheme"
);
}
...
...
@@ -55,7 +55,7 @@ func main() {
if
nerrors
>
0
{
return
;
}
if
!
flags
.
naming
&&
!*
silent
&&
!
flags
.
t
estmode
{
if
!
flags
.
Naming
&&
!*
silent
&&
!
flags
.
T
estmode
{
Printer
.
Print
(
prog
);
}
}
...
...
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