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
9662e7b2
Commit
9662e7b2
authored
Jan 06, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- adjusted pretty to use old new, make
R=r OCL=22160 CL=22160
parent
215eb7eb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
19 deletions
+19
-19
usr/gri/pretty/ast.go
usr/gri/pretty/ast.go
+8
-8
usr/gri/pretty/compilation.go
usr/gri/pretty/compilation.go
+2
-2
usr/gri/pretty/globals.go
usr/gri/pretty/globals.go
+6
-6
usr/gri/pretty/scanner.go
usr/gri/pretty/scanner.go
+3
-3
No files found.
usr/gri/pretty/ast.go
View file @
9662e7b2
...
...
@@ -56,14 +56,14 @@ export func NewExpr(pos, tok int, x, y *Expr) *Expr {
if
x
!=
nil
&&
x
.
tok
==
Scanner
.
TYPE
||
y
!=
nil
&&
y
.
tok
==
Scanner
.
TYPE
{
panic
(
"no type expression allowed"
);
}
e
:=
new
(
*
Expr
);
e
:=
new
(
Expr
);
e
.
pos
,
e
.
tok
,
e
.
x
,
e
.
y
=
pos
,
tok
,
x
,
y
;
return
e
;
}
export
func
NewLit
(
pos
,
tok
int
,
s
string
)
*
Expr
{
e
:=
new
(
*
Expr
);
e
:=
new
(
Expr
);
e
.
pos
,
e
.
tok
,
e
.
s
=
pos
,
tok
,
s
;
return
e
;
}
...
...
@@ -112,7 +112,7 @@ func (t *Type) nfields() int {
export
func
NewType
(
pos
,
tok
int
)
*
Type
{
t
:=
new
(
*
Type
);
t
:=
new
(
Type
);
t
.
pos
,
t
.
tok
=
pos
,
tok
;
return
t
;
}
...
...
@@ -120,7 +120,7 @@ export func NewType(pos, tok int) *Type {
// requires complete Type type
export
func
NewTypeExpr
(
t
*
Type
)
*
Expr
{
e
:=
new
(
*
Expr
);
e
:=
new
(
Expr
);
e
.
pos
,
e
.
tok
,
e
.
t
=
t
.
pos
,
Scanner
.
TYPE
,
t
;
return
e
;
}
...
...
@@ -142,7 +142,7 @@ export type Stat struct {
export
func
NewStat
(
pos
,
tok
int
)
*
Stat
{
s
:=
new
(
*
Stat
);
s
:=
new
(
Stat
);
s
.
pos
,
s
.
tok
=
pos
,
tok
;
return
s
;
}
...
...
@@ -167,7 +167,7 @@ export type Decl struct {
export
func
NewDecl
(
pos
,
tok
int
,
exported
bool
)
*
Decl
{
d
:=
new
(
*
Decl
);
d
:=
new
(
Decl
);
d
.
pos
,
d
.
tok
,
d
.
exported
=
pos
,
tok
,
exported
;
return
d
;
}
...
...
@@ -186,7 +186,7 @@ export type Comment struct {
export
func
NewComment
(
pos
int
,
text
string
)
*
Comment
{
c
:=
new
(
*
Comment
);
c
:=
new
(
Comment
);
c
.
pos
,
c
.
text
=
pos
,
text
;
return
c
;
}
...
...
@@ -201,7 +201,7 @@ export type Program struct {
export
func
NewProgram
(
pos
int
)
*
Program
{
p
:=
new
(
*
Program
);
p
:=
new
(
Program
);
p
.
pos
=
pos
;
return
p
;
}
usr/gri/pretty/compilation.go
View file @
9662e7b2
...
...
@@ -167,7 +167,7 @@ func AddDeps(globalset map [string] bool, wset *array.Array, src_file string, fl
if
nimports
>
0
{
print
(
src_file
,
".6:
\t
"
);
localset
:=
new
(
map
[
string
]
bool
);
localset
:=
make
(
map
[
string
]
bool
);
for
i
:=
0
;
i
<
nimports
;
i
++
{
decl
:=
prog
.
decls
.
At
(
i
)
.
(
*
AST
.
Decl
);
assert
(
decl
.
tok
==
Scanner
.
IMPORT
&&
decl
.
val
.
tok
==
Scanner
.
STRING
);
...
...
@@ -198,7 +198,7 @@ func AddDeps(globalset map [string] bool, wset *array.Array, src_file string, fl
export
func
ComputeDeps
(
src_file
string
,
flags
*
Flags
)
{
globalset
:=
new
(
map
[
string
]
bool
);
globalset
:=
make
(
map
[
string
]
bool
);
wset
:=
array
.
New
(
0
);
wset
.
Push
(
src_file
);
for
wset
.
Len
()
>
0
{
...
...
usr/gri/pretty/globals.go
View file @
9662e7b2
...
...
@@ -119,7 +119,7 @@ export type Elem struct {
export
var
Universe_void_typ
*
Type
// initialized by Universe to Universe.void_typ
export
func
NewObject
(
pos
,
kind
int
,
ident
string
)
*
Object
{
obj
:=
new
(
*
Object
);
obj
:=
new
(
Object
);
obj
.
exported
=
false
;
obj
.
pos
=
pos
;
obj
.
kind
=
kind
;
...
...
@@ -131,7 +131,7 @@ export func NewObject(pos, kind int, ident string) *Object {
export
func
NewType
(
form
int
)
*
Type
{
typ
:=
new
(
*
Type
);
typ
:=
new
(
Type
);
typ
.
ref
=
-
1
;
// not yet exported
typ
.
form
=
form
;
return
typ
;
...
...
@@ -139,7 +139,7 @@ export func NewType(form int) *Type {
export
func
NewPackage
(
file_name
string
,
obj
*
Object
,
scope
*
Scope
)
*
Package
{
pkg
:=
new
(
*
Package
);
pkg
:=
new
(
Package
);
pkg
.
ref
=
-
1
;
// not yet exported
pkg
.
file_name
=
file_name
;
pkg
.
key
=
"<the package key>"
;
// empty key means package forward declaration
...
...
@@ -150,9 +150,9 @@ export func NewPackage(file_name string, obj *Object, scope *Scope) *Package {
export
func
NewScope
(
parent
*
Scope
)
*
Scope
{
scope
:=
new
(
*
Scope
);
scope
:=
new
(
Scope
);
scope
.
parent
=
parent
;
scope
.
entries
=
new
(
map
[
string
]
*
Object
,
8
);
scope
.
entries
=
make
(
map
[
string
]
*
Object
,
8
);
return
scope
;
}
...
...
@@ -161,7 +161,7 @@ export func NewScope(parent *Scope) *Scope {
// Object methods
func
(
obj
*
Object
)
Copy
()
*
Object
{
copy
:=
new
(
*
Object
);
copy
:=
new
(
Object
);
copy
.
exported
=
obj
.
exported
;
copy
.
pos
=
obj
.
pos
;
copy
.
kind
=
obj
.
kind
;
...
...
usr/gri/pretty/scanner.go
View file @
9662e7b2
...
...
@@ -246,7 +246,7 @@ var Keywords map [string] int;
func
init
()
{
Keywords
=
new
(
map
[
string
]
int
);
Keywords
=
make
(
map
[
string
]
int
);
for
i
:=
KEYWORDS_BEG
+
1
;
i
<
KEYWORDS_END
;
i
++
{
Keywords
[
TokenString
(
i
)]
=
i
;
}
...
...
@@ -759,10 +759,10 @@ export type Token struct {
func
(
S
*
Scanner
)
TokenStream
()
<-
chan
*
Token
{
ch
:=
new
(
chan
*
Token
,
100
);
ch
:=
make
(
chan
*
Token
,
100
);
go
func
(
S
*
Scanner
,
ch
chan
<-
*
Token
)
{
for
{
t
:=
new
(
*
Token
);
t
:=
new
(
Token
);
t
.
pos
,
t
.
tok
,
t
.
val
=
S
.
Scan
();
ch
<-
t
;
if
t
.
tok
==
EOF
{
...
...
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