1
0
mirror of https://github.com/golang/go synced 2024-11-24 16:00:12 -07:00
go/doc
Robert Griesemer f8cf82f6f2 go/printer: implement SourcePos mode
If a printer is configured with the SourcePos mode
set, it will emit //-line comments as necessary to
ensure that the result - if reparsed - reflects the
original source position information.

This change required a bit of reworking of the
output section in printer.go. Specifically:

- Introduced new Config mode 'SourcePos'.

- Introduced new position 'out' which tracks the
position of the generated output if it were read
in again. If there is a discrepancy between out
and the current AST/source position, a //line
comment is emitted to correct for it.

- Lazy emission of indentation so that //line
comments can be placed correctly. As a result,
the trimmer will have to do less work.

- Merged writeItem into writeString.

- Merged writeByteN into writeByte.

- Use a []byte instead of a byte.Buffer both in the
printer and in the trimmer (eliminates dependency).

Also: introduced explicit printer.Mode type (in
sync w/ parser.Mode, scanner.Mode, etc.)

Runs all tests. Applied gofmt to src, misc w/o changes.

Fixes #1047.
Fixes #2697.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5643066
2012-02-10 13:27:32 -08:00
..
articles doc: remove overuse of simply 2012-02-06 13:34:35 -05:00
codelab/wiki doc/codelab/wiki: Add the usual Copyright notice. 2012-01-23 09:28:32 +11:00
codewalk doc/codewalk: update urlpoll to use time.Duration. 2012-01-19 14:45:59 +11:00
devel weekly.2012-02-07 2012-02-08 14:37:47 +11:00
gopher
play
progs doc/progs: Add the usual Copyright notice. 2012-01-23 11:19:48 +11:00
talks use new strconv API 2011-12-05 15:48:46 -05:00
all.css doc: fix misspelt CSS properties. 2011-12-23 08:48:21 +11:00
button_background.png
code.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
codereview_with_mq.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
community.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
contrib.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
contribute.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
debugging_with_gdb.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
docs.html godoc: support canonical Paths in HTML metadata 2012-01-20 07:37:36 +11:00
effective_go.html docs: replace references to gofix etc. with tool invocations 2012-02-04 07:49:51 +11:00
effective_go.tmpl docs: replace references to gofix etc. with tool invocations 2012-02-04 07:49:51 +11:00
ExpressivenessOfGo.pdf
frontpage.css
gccgo_contribute.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
gccgo_install.html doc: remove overuse of simply 2012-02-06 13:34:35 -05:00
go1.html go/printer: implement SourcePos mode 2012-02-10 13:27:32 -08:00
go1.tmpl go/printer: implement SourcePos mode 2012-02-10 13:27:32 -08:00
go1compat.html doc: new document about compatibility of releases 2012-02-09 09:42:40 +11:00
go_faq.html FAQ: more words about why GOMAXPROCS>1 might not speed you up 2012-01-26 14:44:38 -08:00
go_for_cpp_programmers.html doc: fix typo in Go for C++ programmers 2012-01-20 14:44:05 -08:00
go_mem.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
go_spec.html spec: address CL 5647054 comments 2012-02-08 15:37:58 -05:00
go_tutorial.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
go_tutorial.tmpl godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
go-logo-black.png
go-logo-blue.png
go-logo-white.png
godocs.js godoc: add anchors to cmd documentation headings 2012-01-19 18:59:06 +11:00
ie.css
install.html docs: replace references to gofix etc. with tool invocations 2012-02-04 07:49:51 +11:00
logo-153x55.png
logo.png
Makefile bufio: drop error return for NewReaderSize and NewWriterSize 2012-02-08 13:07:13 +11:00
makehtml doc: add Defer, Panic, and Recover article 2011-12-12 13:15:29 +11:00
play_overlay.png
playground.html godoc: specify HTML page metadata with a JSON blob 2012-01-19 11:24:54 +11:00
popups.js
root.html godoc: support canonical Paths in HTML metadata 2012-01-20 07:37:36 +11:00
sieve.gif
tmpltohtml.go doc: only trim newlines in tmpltohtml, gofmt progs 2012-01-09 20:05:34 +11:00
video-001.png
video-002.png
video-003.png
video-004.png
video-005.jpg