1
0
mirror of https://github.com/golang/go synced 2024-10-04 06:31:22 -06:00
Commit Graph

668 Commits

Author SHA1 Message Date
Robert Griesemer
152279f203 exp/types: Replace String method with TypeString function
This is more in sync with the rest of the package;
for instance, we have functions (not methods) to
deref or find the underlying type of a Type.

In the process use a single bytes.Buffer to create
the string representation for a type rather than
the (occasional) string concatenation.

R=r
CC=golang-dev
https://golang.org/cl/6458057
2012-07-31 19:30:18 -07:00
Robert Griesemer
dcb6f59811 exp/types: implement Type.String methods for testing/debugging
Also:
- replaced existing test with a more comprehensive test
- fixed bug in map type creation

R=r
CC=golang-dev
https://golang.org/cl/6450072
2012-07-31 17:09:12 -07:00
Andrew Balholm
9f3b00579e exp/html: tokenize attributes of end tags
If an end tag has an attribute that is a quoted string containing '>',
the tokenizer would end the tag prematurely. Now it reads the attributes
on end tags just as it does on start tags, but the high-level interface
still doesn't return them, because their presence is a parse error.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6457060
2012-08-01 09:35:02 +10:00
Andrew Balholm
eff32f573b exp/html: replace NUL with U+FFFD in text in foreign content
Pass 5 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6452055
2012-07-29 16:29:49 +10:00
Marcel van Lohuizen
601045e87a exp/locale/collate: changed trie in first step towards support for multiple locales.
- Allow handles into the trie for different locales.  Multiple tables share the same
  try to allow for reuse of blocks.
- Significantly improved memory footprint and reduced allocations of trieNodes.
  This speeds up generation by about 30% and allows keeping trieNodes around
  for multiple locales during generation.
- Renamed print method to fprint.

R=r
CC=golang-dev
https://golang.org/cl/6408052
2012-07-28 18:44:14 +02:00
Andrew Balholm
a1f340fa1a exp/html: parse CDATA sections in foreign content
Also convert NUL to U+FFFD in comments.

Pass 23 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6446055
2012-07-27 16:05:25 +10:00
Andrew Balholm
55f0c8b2cd exp/html: replace NUL bytes in plaintext, raw text, and RCDATA
If NUL bytes occur inside certain elements, convert them to U+FFFD
replacement character.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6452047
2012-07-27 09:27:10 +10:00
Andrew Wilkins
d399b681a4 exp/types: process ast.Fun in checkObj; fix variadic function building
Fixed creation of Func's, taking IsVariadic from parameter list rather
than results.

Updated checkObj to process ast.Fun objects.

R=gri
CC=golang-dev
https://golang.org/cl/6402046
2012-07-26 11:47:46 -07:00
Andrew Balholm
899be50991 exp/html: don't insert empty text nodes
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6443048
2012-07-26 10:32:24 +10:00
Andrew Balholm
4d22519678 exp/html: allow frameset if body contains whitespace
If the body of an HTML document contains text, the <frameset> tag is
ignored. But not if the text is only whitespace.

Pass 4 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6442043
2012-07-25 12:09:58 +10:00
Andrew Balholm
f979528ce6 exp/html: special handling for entities in attributes
Don't unescape entities in attributes when they don't end with
a semicolon and they are followed by '=', a letter, or a digit.

Pass 6 more tests from the WebKit test suite, plus one that was
commented out in token_test.go.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6405073
2012-07-23 12:39:58 +10:00
Marcel van Lohuizen
882b6ef454 exp/locale/collate: This CL includes the following changes:
- Changed the representation of colElem to support a few cases
  for some languages not supported by the current format.
- Changed offsets for implicit primary values. This makes the
  values both easier to read and debug (last 4 nibbles are identical to
  implicit primary value) and also results in better packing.
- Fixed bug in weight conversion code that did not pop up yet by
  sheer luck.
Note that tables.go also includes changes to the contraction trie
from CL 6346092.

R=r, mpvl
CC=golang-dev
https://golang.org/cl/6392060
2012-07-13 11:38:22 +02:00
Marcel van Lohuizen
adc19ac5e3 exp/locale/collate: adjusted contraction trie to support Myanmar (Burmese),
which has a rather large contraction table. The value of the next state
offset now starts after the current block, instead of before.  This is
slightly less efficient (on extra addition per state change), but gives
some extra range for the offsets.
Also introduced constants for final (0) and noIndex (0xFF).
tables.go is updated in a separate CL.

R=r
CC=golang-dev
https://golang.org/cl/6346092
2012-07-13 11:38:00 +02:00
Jan Ziak
b3382ec9e9 exp/inotify: prevent data race
Fixes #3713.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6331055
2012-06-25 14:08:09 -04:00
Jan Ziak
f5f3c3fe09 exp/inotify: prevent data race during testing
Fixes #3714.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6341047
2012-06-24 19:22:48 -04:00
Marcel van Lohuizen
77b1378c3e exp/locale/collate: added regression test for collate package
based on UCA test files.

R=r
CC=golang-dev
https://golang.org/cl/6216056
2012-06-19 11:34:56 -07:00
Robert Griesemer
ca2ae27dd0 go/ast: multiple "blank" imports are permitted
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6303099
2012-06-18 21:56:41 -07:00
Nigel Tao
834edc4257 exp/html/atom: add some more atoms.
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6298085
2012-06-15 15:39:25 +10:00
Shenghou Ma
9852614291 exp/types: clean up objects after test
Fixes #3739.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6295083
2012-06-15 02:52:18 +08:00
Nigel Tao
66429dcf75 exp/html: simplify some of the parser's internal methods.
benchmark          old ns/op    new ns/op    delta
BenchmarkParser      4006888      3950604   -1.40%

R=r, andybalholm
CC=golang-dev
https://golang.org/cl/6301070
2012-06-13 10:13:05 +10:00
Robert Griesemer
49d6e49087 exp/types: testing resolution of qualified identifiers
Also: fix a bug with exp/types/GcImport.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6302060
2012-06-11 11:06:27 -07:00
Nigel Tao
6c204982e0 exp/html: check the context node for consistency when parsing fragments.
R=rsc
CC=golang-dev
https://golang.org/cl/6303053
2012-06-08 13:55:15 +10:00
Nigel Tao
c8fac7b967 exp/html: when parsing, compare atoms (ints) instead of strings.
This is the mechanical part of the 2-part change that started with
https://golang.org/cl/6305053/

R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6295055
2012-06-07 13:46:57 +10:00
Nigel Tao
cd21eff705 exp/html: make the tokenizer return atoms for tag tokens.
This is part 1 of a 2 part changelist. Part 2 contains the mechanical
change to parse.go to compare atoms (ints) instead of strings.

The overall effect of the two changes are:
benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4462274      4058254   -9.05%
BenchmarkRawLevelTokenizer        913202       912917   -0.03%
BenchmarkLowLevelTokenizer       1268626      1267836   -0.06%
BenchmarkHighLevelTokenizer      1947305      1968944   +1.11%

R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6305053
2012-06-07 13:05:35 +10:00
Nigel Tao
90fa13d2b7 exp/html/atom: add more atoms.
This completely covers the tags used by exp/html's parser.

Before:
295 atoms; 1406 string bytes + 2048 tables = 3454 total data
BenchmarkLookup    50000         59841 ns/op

After:
322 atoms; 1508 string bytes + 2048 tables = 3556 total data
BenchmarkLookup    50000         60159 ns/op

R=r
CC=golang-dev
https://golang.org/cl/6296045
2012-06-07 09:35:35 +10:00
Marcel van Lohuizen
de0c1c9cf5 exp/locale/collate: somehow an incorrect version of tables was checked in earlier.
Regenerated tables using maketables.

R=r, rsc
CC=golang-dev
https://golang.org/cl/6248067
2012-06-04 18:35:26 +02:00
Russ Cox
192550592a exp/html/atom: faster Lookup with smaller tables
Use perfect cuckoo hash, to avoid binary search.
Define Atom bits as offset+len in long string instead
of enumeration, to avoid string headers.

Before: 1909 string bytes + 6060 tables = 7969 total data
After: 1406 string bytes + 2048 tables = 3454 total data

benchmark          old ns/op    new ns/op    delta
BenchmarkLookup        83878        64681  -22.89%

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/6262051
2012-06-02 22:43:11 -04:00
Nigel Tao
d2a6098e9c exp/html/atom: faster, hash-based lookup.
exp/html/atom benchmark:
benchmark          old ns/op    new ns/op    delta
BenchmarkLookup       199226        80770  -59.46%

exp/html benchmark:
benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4864890      4510834   -7.28%
BenchmarkHighLevelTokenizer      2209192      1969684  -10.84%
benchmark                       old MB/s     new MB/s  speedup
BenchmarkParser                    16.07        17.33    1.08x
BenchmarkHighLevelTokenizer        35.38        39.68    1.12x

R=r
CC=golang-dev
https://golang.org/cl/6261054
2012-06-01 09:36:05 +10:00
Nigel Tao
bb4a817a92 exp/html/atom: new package.
50% fewer mallocs in HTML tokenization, resulting in 25% fewer mallocs
in parsing go1.html.

Making the parser use integer comparisons instead of string comparisons
will be a follow-up CL, to be co-ordinated with Andy Balholm's work.

exp/html benchmarks before/after:

BenchmarkParser	     500	   4754294 ns/op	  16.44 MB/s
        parse_test.go:409: 500 iterations, 14651 mallocs per iteration
BenchmarkRawLevelTokenizer	    2000	    903481 ns/op	  86.51 MB/s
        token_test.go:678: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer	    2000	   1260485 ns/op	  62.01 MB/s
        token_test.go:678: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer	    1000	   2165964 ns/op	  36.09 MB/s
        token_test.go:678: 1000 iterations, 6616 mallocs per iteration

BenchmarkParser	     500	   4664912 ns/op	  16.76 MB/s
        parse_test.go:409: 500 iterations, 11266 mallocs per iteration
BenchmarkRawLevelTokenizer	    2000	    903065 ns/op	  86.55 MB/s
        token_test.go:678: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer	    2000	   1260032 ns/op	  62.03 MB/s
        token_test.go:678: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer	    1000	   2143356 ns/op	  36.47 MB/s
        token_test.go:678: 1000 iterations, 3231 mallocs per iteration

R=r, rsc, rogpeppe
CC=andybalholm, golang-dev
https://golang.org/cl/6255062
2012-05-31 15:37:18 +10:00
Marcel van Lohuizen
c633f85f65 exp/locale/collate: avoid double building in maketables.go. Also added check.
R=r
CC=golang-dev
https://golang.org/cl/6202063
2012-05-30 17:47:56 +02:00
Andrew Balholm
4e0749a478 exp/html: Convert \r and \r\n to \n when tokenizing
Also escape "\r" as "&#13;" when rendering HTML.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6260046
2012-05-30 15:50:12 +10:00
Nigel Tao
034fa90dc1 exp/html: add some tokenizer and parser benchmarks.
$GOROOT/src/pkg/exp/html/testdata/go1.html is an execution of the
$GOROOT/doc/go1.html template by godoc.

Sample numbers on my linux,amd64 desktop:
BenchmarkParser	     500	   4699198 ns/op	  16.63 MB/s
--- BENCH: BenchmarkParser
        parse_test.go:409: 1 iterations, 14653 mallocs per iteration
        parse_test.go:409: 100 iterations, 14651 mallocs per iteration
        parse_test.go:409: 500 iterations, 14651 mallocs per iteration
BenchmarkRawLevelTokenizer	    2000	    904957 ns/op	  86.37 MB/s
--- BENCH: BenchmarkRawLevelTokenizer
        token_test.go:657: 1 iterations, 28 mallocs per iteration
        token_test.go:657: 100 iterations, 28 mallocs per iteration
        token_test.go:657: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer	    2000	   1134300 ns/op	  68.91 MB/s
--- BENCH: BenchmarkLowLevelTokenizer
        token_test.go:657: 1 iterations, 41 mallocs per iteration
        token_test.go:657: 100 iterations, 41 mallocs per iteration
        token_test.go:657: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer	    1000	   2096179 ns/op	  37.29 MB/s
--- BENCH: BenchmarkHighLevelTokenizer
        token_test.go:657: 1 iterations, 6616 mallocs per iteration
        token_test.go:657: 100 iterations, 6616 mallocs per iteration
        token_test.go:657: 1000 iterations, 6616 mallocs per iteration

R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6257067
2012-05-30 13:00:32 +10:00
Robert Griesemer
bd7c626348 exp/types: properly read dotted identifiers
Fixes #3682.

R=rsc
CC=golang-dev
https://golang.org/cl/6256067
2012-05-29 13:15:13 -07:00
Russ Cox
95ae5c180e exp/types: disable test
It's broken and seems to be exp/types's fault.

Update #3682.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6243068
2012-05-29 13:33:37 -04:00
Andrew Balholm
9c14184e25 exp/html: implement Noah's Ark clause
Implement the (3-per-family) Noah's Ark clause (i.e. don't put
more than three identical elements on the list of active formatting
elements.

Also, when running tests, sort attributes by name before dumping
them.

Pass 4 additional tests with Noah's Ark clause (including one
that needs attributes to be sorted).

Pass 5 additional, unrelated tests because of sorting attributes.

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/6247056
2012-05-29 13:39:54 +10:00
Andrew Balholm
c23041efd9 exp/html: adjust parseForeignContent to match spec
Remove redundant checks for integration points.

Ignore null bytes in text.

Don't break out of foreign content for a <font> tag unless it
has a color, face, or size attribute.

Check for MathML text integration points when breaking out of
foreign content.

Pass two new tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6256045
2012-05-25 10:03:59 +10:00
Russ Cox
ce69666273 exp/locale/collate: avoid 16-bit math
There's no need for the 16-bit arithmetic here,
and it tickles a long-standing compiler bug.
Fix the exp code not to use 16-bit math and
create an explicit test for the compiler bug.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6256048
2012-05-24 14:50:36 -04:00
Andrew Balholm
82e2272566 exp/html: detect "integration points" in SVG and MathML content
Detect HTML integration points and MathML text integration points.
At these points, process tokens as HTML, not as foreign content.

Pass 33 more tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6249044
2012-05-24 13:46:41 +10:00
Andrew Balholm
e947eba291 exp/html: update test data
Import updated test data from the WebKit Subversion repository (SVN revision 118111).

Some of the old tests were failing because we were HTML5 compliant, but the tests weren't.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6228049
2012-05-24 10:35:31 +10:00
Andrew Balholm
33a89b5fda exp/html: adjust the last few insertion modes to match the spec
Handle text, comment, and doctype tokens in afterBodyIM, afterAfterBodyIM,
and afterAfterFramesetIM.

Pass three more tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6231043
2012-05-23 11:11:34 +10:00
Jan Ziak
fbaf59bf1e cmd/gc: export constants in hexadecimal
R=golang-dev, r, rsc, iant, remyoudompheng, dave
CC=golang-dev
https://golang.org/cl/6206077
2012-05-22 13:53:38 -04:00
Andrew Balholm
8f66d7dc32 exp/html: adjust inSelectIM to match spec
Simplify the flow of control.

Handle EOF, null bytes, <html>, <input>, <keygen>, <textarea>, <script>.

Pass 5 more tests.

R=golang-dev, rsc, nigeltao
CC=golang-dev
https://golang.org/cl/6220062
2012-05-22 15:30:13 +10:00
Andrew Balholm
7648f61c7d exp/html: adjust inCellIM to match spec
Clean up flow of control.

Ignore </table>, </tbody>, </tfoot>, </thead>, </tr> if there is not
an appropriate element in table scope.

Pass 3 more tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6206093
2012-05-22 10:31:08 +10:00
Andrew Balholm
4973c1fc7e exp/html: adjust inRowIM to match spec
Delete cases that just fall down to "anything else" action.

Handle </tbody>, </tfoot>, and </thead>.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6203061
2012-05-20 14:26:20 +10:00
Marcel van Lohuizen
ec099b2bc7 exp/locale/collate: implementation of main collation functionality for
key and simple comparisson. Search is not yet implemented in this CL.
Changed some of the types of table_test.go to allow reuse in the new test.
Also reduced number of primary values for illegal runes to 1 (both map to
the same).

R=r
CC=golang-dev
https://golang.org/cl/6202062
2012-05-17 19:48:56 +02:00
Marcel van Lohuizen
0355a71751 exp/locale/collate: Add maketables tool and generated tables.
Also set maxContractLen automatically.
Note that the table size is much bigger than it needs to be.
Optimization is best done, though, when the language specific
tables are added.

R=r
CC=golang-dev
https://golang.org/cl/6167044
2012-05-09 12:03:55 +02:00
Marcel van Lohuizen
56a76c88f8 exp/locale/collate: from the regression test we derive that the spec
dictates a CJK rune is only part of a certain specified range if it
is explicitly defined in the Unicode Codepoint Database.
Fixed the code and some of the tests accordingly.

R=r
CC=golang-dev
https://golang.org/cl/6160044
2012-05-07 11:51:40 +02:00
Marcel van Lohuizen
18aded7ab9 exp/norm: It is important that the unicode versions of the various packages align.
Replace hard-coded version strings with unicode.Version.

R=r, r
CC=golang-dev
https://golang.org/cl/6163045
2012-05-07 11:41:40 +02:00
Marcel van Lohuizen
10838165d8 exp/locale/collate: fixed two bugs uncovered by regression tests.
The first bug was that tertiary ignorables had the same colElem as
implicit colElems, yielding unexpected results. The current encoding
ensures that a non-implicit colElem is never 0.  This fix uncovered
another bug of the trie that indexed incorrectly into the null block.
This was caused by an unfinished optimization that would avoid the
need to max out the most-significant bits of continuation bytes.
This bug was also present in the trie used in exp/norm and has been
fixed there as well. The appearence of the bug was rare, as the lower
blocks happened to be nearly nil.

R=r
CC=golang-dev
https://golang.org/cl/6127070
2012-05-02 17:01:41 +02:00
Andrew Balholm
a09e9811dc exp/html: adjust inTableBodyIM to match spec
Clean up flow of control.

Handle </tbody>, </tfoot>, and </thead>.

Pass 5 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6117057
2012-04-26 11:48:35 +10:00
Marcel van Lohuizen
fdce27f7b8 exp/locale/collate: Added Builder type for generating a complete
collation table. At this moment, it only implements the generation of
a root table.

R=r
CC=golang-dev
https://golang.org/cl/6039047
2012-04-25 13:19:35 +02:00
Marcel van Lohuizen
52f0afe0db exp/locale/collate: Added skeleton for the higher-level types to provide
context for change lists of lower-level types. The public APIs are defined
in builder.go and collate.go. Type table is the glue between the lower and
higher level code and might be a good starting point for understanding the
collation code.

R=r, r
CC=golang-dev
https://golang.org/cl/5999053
2012-04-25 13:19:00 +02:00
Marcel van Lohuizen
bcf48c7971 exp/locale/collate: added trie for associating colElems to runes.
The trie code looks a lot like the trie in exp/norm. It uses different
types, however.  Also, there is only a lookup for []byte and the unsafe
lookup methods have been dropped, as well as sparse mode.
There is now a method for generating a trie. To output Go code, one now needs
to first generate a trie and then call print() on it.

R=r, r, mpvl
CC=golang-dev
https://golang.org/cl/5966064
2012-04-25 13:16:57 +02:00
Marcel van Lohuizen
bb3f3c9775 exp/locale/collate: added representation for collation elements
(see http://www.unicode.org/reports/tr10/).

R=r, r
CC=golang-dev
https://golang.org/cl/5981048
2012-04-25 13:16:24 +02:00
Marcel van Lohuizen
e456d015fb exp/locale/collate: implementation of trie that is used for detecting contractions.
(See http://www.unicode.org/reports/tr10/#Contractions.)  Each rune that is at the
start of any contraction is associated a trie. This trie, in turn, may be shared
by other runes that have the same set of suffixes.

R=r, r
CC=golang-dev
https://golang.org/cl/5970066
2012-04-25 13:15:48 +02:00
Rob Pike
459837c86e all: fix errors found by go vet
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6125044
2012-04-25 11:33:27 +10:00
Andrew Balholm
dde8358a1c exp/html: adjust inTableIM to match spec
Don't foster-parent text nodes that consist only of whitespace.
(I implemented this entirely in inTableIM instead of creating an
inTableTextIM, because the sole purpose of inTableTextIM seems to be
to combine character tokens into a string, which our tokenizer does
already.)

Use parseImpliedToken to clarify a couple of cases.

Handle <style>, <script>, <input>, and <form>.

Ignore doctype tokens.

Pass 20 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6117048
2012-04-25 10:49:27 +10:00
Andrew Balholm
b885633d62 exp/html: make inBodyIM match spec
This CL corrects the remaining differences that I could find between the
implementation of inBodyIM and the spec:

Handle <rp> and <rt>.

Adjust SVG and MathML attributes.

Reconstruct active formatting elements in the "any other start tag" case.

Pass 7 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6101055
2012-04-24 15:27:48 +10:00
Andrew Balholm
0cc8ee9808 exp/html: add more cases to inBodyIM
Don't set framesetOK to false for hidden input elements.

Handle <param>, <source>, <track>, <textarea>, <iframe>, <noembed>,
and <noscript>

Pass 7 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6094045
2012-04-22 16:19:21 +10:00
Andrew Balholm
904c7c8e99 exp/html: more work on inBodyIM
Reorder some cases.
Handle <pre>, <listing>, </form>, </li>, </dd>, </dt>, </h1>, </h2>,
</h3>, </h4>, </h5>, and </h6> tags.

Pass 6 additional tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6089043
2012-04-21 09:20:38 +10:00
Andrew Balholm
eea5a432cb exp/html: start making inBodyIM match the spec
Reorder some start tags.

Improve handling of </body>.
Handle </html>.

Pass 2 additional tests (by handling </html>).

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6082043
2012-04-20 15:48:13 +10:00
Andrew Balholm
6791057296 exp/html: ignore null bytes in text
pass one additional test

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6048051
2012-04-20 14:25:42 +10:00
Andrew Balholm
7d63ff09a5 exp/html: improve afterHeadIM
Clean up the flow of control.
Fix the TODO for handling <html> tags.
Add a case to ignore doctype declarations.

Pass one additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6072047
2012-04-20 10:48:10 +10:00
Andrew Balholm
fca32f02e9 exp/html: improve InHeadIM
Clean up the flow of control, and add a case for doctype tokens (to
ignore them).

R=nigeltao
CC=golang-dev
https://golang.org/cl/6069045
2012-04-20 09:08:58 +10:00
Andrew Balholm
c88ca5906c exp/html: add parseImpliedToken method to parser
This method will allow us to be explicit about what we're doing when
we insert an implied token, and avoid repeating the logic involved in
multiple places.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6060048
2012-04-19 11:48:17 +10:00
Andrew Balholm
b65c9a633e exp/html: improve beforeHeadIM
Add a case to ignore doctype tokens.

Clean up the flow of control to more clearly match the spec.

Pass one more test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6062047
2012-04-18 22:45:36 +10:00
Andrew Balholm
b39bbf1e5b exp/html: adjust beforeHTMLIM to match spec
Add case for doctype tokens (which are ignored).

This CL does not change the status of any tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6061047
2012-04-18 13:26:35 +10:00
Andrew Balholm
9a6cef8bbf exp/html: more comprehensive tests
Currently, the html package only runs a limited subset of the tests
in the testdata directory. This tends to limit development of the
parser to fixing the bug that causes the first failing test.

This CL gives it the ability to run all the tests and produce a
log showing the status of each test. (It does it when tests are run with
'go test --update-logs') The status is listed as PASS, FAIL, or PARSE
(PARSE means that parsing produced the correct tree, but rendering and
re-parsing does not produce the same tree).

When 'go test' is run without --update-logs, it runs the tests marked
'PASS' in the logs (and the parsing portion of the tests marked 'PARSE').
Thus it will fail if there has been a regression since the last
time the logs were updated.

My goal for this CL is to allow develoment of the html package to
be less test-driven, while still having the advantages of regression
tests. In other words, one can work on any portion of the parser
and quickly see whether he is breaking things or improving them.

Current statistics of the tests:
$ grep ^PASS *.log|wc -l
        1017
$ grep ^PARSE *.log|wc -l
          46
$ grep ^FAIL *.log|wc -l
         181

R=nigeltao
CC=golang-dev
https://golang.org/cl/6031049
2012-04-17 17:17:22 +10:00
Nigel Tao
6277656d69 html, exp/html: escape ' and " as &#39; and &#34;, since IE8 and
below do not support &apos;.

This makes package html consistent with package text/template's
HTMLEscape function.

Fixes #3489.

R=rsc, mikesamuel, dsymonds
CC=golang-dev
https://golang.org/cl/5992071
2012-04-12 09:35:43 +10:00
Marcel van Lohuizen
98aa4968b7 exp/norm: exposed runeInfo type in API.
For completeness, we also expose the Canonical Combining Class of a rune.
This does not increase the data size.

R=r
CC=golang-dev
https://golang.org/cl/5931043
2012-04-11 16:47:53 +02:00
Benny Siegert
512aeb305e exp/utf8string: Correct package name in error messages
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5969051
2012-04-02 12:06:05 -04:00
David Symonds
dc640ebd1a exp/terminal: delete.
This is now known as code.google.com/p/go.crypto/ssh/terminal.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5970044
2012-03-30 15:27:39 +11:00
Robert Griesemer
5390722100 exp/types: generalized GCImporter API.
- Renamed ExportData -> FindGcExportData
  and base it on an a bufio.Reader rather
  than a filename so it can be used in
  environments where object files are
  stored elsewhere.

- Factor former GcImporter into GcImportData
  and GcImport. Implementations with different
  storage locations for object files can build
  a customized GcImport using GcImportData.

This is pkg/exp only - no impact on Go 1.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5574069
2012-03-26 11:26:05 -07:00
Robert Griesemer
f5f80368c4 exp/norm/normalize.go: fix typo
R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/5874045
2012-03-21 14:55:05 -07:00
Rob Pike
883a96d950 spec: delete references to unsafe.Reflect,Typeof,Unreflect
They have been deleted from package unsafe.
Also delete their appearance in exp/types.

Fixes #3338.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5847056
2012-03-17 22:50:59 +11:00
Robert Griesemer
56cae1c230 all: gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5781058
2012-03-08 10:48:51 -08:00
Alex Brainman
5aee1f3a0f exp/wingui: getting relocated to
go get code.google.com/p/gowingui

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/5752067
2012-03-07 17:48:09 +11:00
Rob Pike
544a72cc86 exp/wingui: remove reference to Make.inc
R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/5757058
2012-03-07 14:06:16 +11:00
Robert Griesemer
7c6654aa70 all: fixed various typos
(Semi-automatically detected.)

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/5715052
2012-03-01 14:56:05 -08:00
Russ Cox
ebe1664d27 go/build: replace FindTree, ScanDir, Tree, DirInfo with Import, Package
This is an API change, but one I have been promising would
happen when it was clear what the go command needed.

This is basically a complete replacement of what used to be here.

build.Tree is gone.

build.DirInfo is expanded and now called build.Package.

build.FindTree is now build.Import(package, srcDir, build.FindOnly).
The returned *Package contains information that FindTree returned,
but applicable only to a single package.

build.ScanDir is now build.ImportDir.

build.FindTree+build.ScanDir is now build.Import.

The new Import API allows specifying the source directory,
in order to resolve local imports (import "./foo") and also allows
scanning of packages outside of $GOPATH.  They will come back
with less information in the Package, but they will still work.

The old go/build API exposed both too much and too little.
This API is much closer to what the go command needs,
and it works well enough in the other places where it is
used.  Path is gone, so it can no longer be misused.  (Fixes issue 2749.)

This CL updates clients of go/build other than the go command.
The go command changes are in a separate CL, to be submitted
at the same time.

R=golang-dev, r, alex.brainman, adg
CC=golang-dev
https://golang.org/cl/5713043
2012-03-01 12:12:09 -05:00
Robert Griesemer
e952e241ae gotype: provide -comments flag
When debugging ASTs, it's useful to also
see the comments on occasion. Usage:

gotype -ast -comments file.go

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5703043
2012-02-27 21:35:26 -08:00
Robert Griesemer
3391de8df7 exp/types: fix package comment
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5695046
2012-02-22 23:40:28 -08:00
Robert Griesemer
8b7cdb7f25 go/printer, gofmt: improved comma placement
Not a Go 1 issue, but appeared to be fairly easy to fix.

- Note that a few existing test cases look slightly worse but
  those cases were not representative for real code. All real
  code looks better now.

- Manual move of the comment in go/scanner/example_test.go
  before applying gofmt.

- gofmt -w $GOROOT/src $GOROOT/misc

Fixes #3062.

R=rsc
CC=golang-dev
https://golang.org/cl/5674093
2012-02-22 11:27:45 -08:00
Marcel van Lohuizen
ecd24f381e exp/norm: Added Iter type for iterating on segment boundaries. This type is mainly to be used
by other low-level libraries, like collate.  Extra care has been given to optimize the performance
of normalizing to NFD, as this is what will be used by the collator.  The overhead of checking
whether a string is normalized vs simply decomposing a string is neglible.  Assuming that most
strings are in the FCD form, this iterator can be used to decompose strings and normalize with
minimal overhead.

R=r
CC=golang-dev
https://golang.org/cl/5676057
2012-02-21 13:13:21 +01:00
Rob Pike
7e8a369426 exp/inotify: remove use of _test
Fixes #2573.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5676063
2012-02-15 21:23:58 -08:00
Rob Pike
cc34f4b565 windows: fix build
R=golang-dev
TBR=dsymonds
CC=golang-dev
https://golang.org/cl/5673064
2012-02-16 16:07:26 +11:00
Rob Pike
34de45c435 exp/winfsnotify: remove reference to _test
Updates #2573.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5677063
2012-02-16 15:34:27 +11:00
Russ Cox
9f333170bf cmd/go: a raft of fixes
* add -work option to save temporary files (Fixes issue 2980)
* fix go test -i to work with cgo packages (Fixes issue 2936)
* do not overwrite/remove empty directories or non-object
  files during build (Fixes issue 2829)
* remove package main vs package non-main heuristic:
  a directory must contain only one package (Fixes issue 2864)
* to make last item workable, ignore +build tags for files
  named on command line: go build x.go builds x.go even
  if it says // +build ignore.
* add // +build ignore tags to helper programs

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5674043
2012-02-14 16:39:20 -05:00
Russ Cox
7b848c6964 cmd/dist: cross-compiling fixes
This CL makes it possible to run make.bash with
GOOS and GOARCH set to something other than
the native host GOOS and GOARCH.

As part of the CL, the tool directory moves from bin/tool/
to pkg/tool/goos_goarch where goos and goarch are
the values for the host system (running the build), not
the target.  pkg/ is not technically appropriate, but C objects
are there now tool (pkg/obj/) so this puts all the generated
binaries in one place (rm -rf $GOROOT/pkg cleans everything).
Including goos_goarch in the name allows different systems
to share a single $GOROOT on a shared file system.

Fixes #2920.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5645093
2012-02-13 22:31:51 -05:00
Shenghou Ma
c11361e253 exp/norm: fix typo
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5649086
2012-02-13 11:50:06 -08:00
Russ Cox
35586f718c os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only.  Also, signals
go to everyone who asks, not just one client.

This could plausibly move into package os now
that there are no magic side effects as a result
of the import.

Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)

Tested on darwin,linux 386,amd64.

Fixes #1266.

R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 13:52:37 -05:00
Marcel van Lohuizen
a52fb458df exp/norm: merged charinfo and decomposition tables. As a result only
one trie lookup per rune is needed. See forminfo.go for a description
of the new format.  Also included leading and trailing canonical
combining class in decomposition information.  This will often avoid
additional trie lookups.

R=r, r
CC=golang-dev
https://golang.org/cl/5616071
2012-02-13 14:54:46 +01:00
James Whitehead
09f6a49194 exp/types: Use build.FindTree in GcImporter
Fixes #2932

R=gri
CC=golang-dev
https://golang.org/cl/5654046
2012-02-10 13:35:03 -08:00
Robert Griesemer
d08dd8bec1 go/scanner: clean up error interface
Issue 2856 asks for a rename of a few methods to a
more idiomatic Go style. This is a very early API
that evolved organically throughout the years.
Together with the fact that ErrorVectors were embedded
in other data structures (e.g. Parser), just renaming
methods (e.g. GetError -> Error) would lead to undesired
behavior (e.g., Parser would act like an Error). Instead,
cleaned up API a bit more:

- removed ErrorVector in favor of ErrorList (already
present)
- simplified Scanner.Init by making the error handler a
function instead of requiring an ErrorHandler implementation
- adjusted helper functions accordingly
- updated Go 1 doc

Fixes #2856.

R=rsc
CC=golang-dev
https://golang.org/cl/5624047
2012-02-08 11:41:32 -08:00
Rob Pike
5be24046c7 all: avoid bytes.NewBuffer(nil)
The practice encourages people to think this is the way to
create a bytes.Buffer when new(bytes.Buffer) or
just var buf bytes.Buffer work fine.
(html/token.go was missing the point altogether.)

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5637043
2012-02-06 14:09:00 +11:00
Rob Pike
1f565e7d20 tools: update references to "x" to be "go tool x"
For instance, don't talk about gofix, talk about the
fix tool or "go tool fix".

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5608053
2012-02-04 07:03:20 +11:00
Russ Cox
b3750ff52d build: rename $GOROOT/bin/go-tool to $GOROOT/bin/tool.
The go- is redundant now that the directory is required
to be inside $GOROOT.  Rob LGTMed the idea.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5618044
2012-02-02 23:32:41 -05:00
Nigel Tao
102638cb53 std: add struct field tags to untagged literals.
R=rsc, dsymonds, bsiegert, rogpeppe
CC=golang-dev
https://golang.org/cl/5619052
2012-02-03 10:12:25 +11:00
Marcel van Lohuizen
8ba20dbdb5 exp/norm: a few minor changes in prepration for a table format change:
- Unified bounary conditions for NFC and NFD and removed some indirections.
   This enforces boundaries at the character level, which is typically what
   the user expects. (NFD allows a boundary between 'a' and '`', for example,
   which may give unexpected results for collation.  The current implementation
   is already stricter than the standard, so nothing much changes.  This change
   just formalizes it.
 - Moved methods of qcflags to runeInfo.
 - Swapped YesC and YesMaybe bits in qcFlags. This is to aid future changes.
 - runeInfo return values use named fields in preperation for struct change.
 - Replaced some left-over uint32s with rune.

R=r
CC=golang-dev
https://golang.org/cl/5607050
2012-02-02 13:55:53 +01:00
Marcel van Lohuizen
d673c95d6c exp/norm: Added some benchmarks for form-specific performance measurements.
R=r
CC=golang-dev
https://golang.org/cl/5605051
2012-02-02 13:19:12 +01:00