Skip to content

Releases: tdewolff/parse

v2.5.1

29 Aug 22:46
Compare
Choose a tag to compare
  • JS: allow parsing in parameters in group expressions (that couldn't have been an arrow function)
  • JS: store all comments in the head of the document (for license comments)
  • JS: fix parsing identifiers in arrow functions, it used to assume they were part of the parameter list causing nil errors

v2.5.0

26 Aug 13:52
dfae400
Compare
Choose a tag to compare
  • Add JS (ECMAScript 2020) lexer and parser.
  • Add parse.Input and use that instead of io.Reader for input to lexers.
  • Use predefined byte-slices instead of inline ones.

For users, there is a slight breakage of function signatures in this release: instead of calling for example p := css.NewParser(r, false) you should call

input := parse.NewInput(r)
defer input.Restore()
p := css.NewParser(input, false)

or if the byte-slice behind r is not used anywhere else (which is generally the case), then you could just call

p := css.NewParser(parse.NewInput(r), false)

This is for all lexers/parsers.

v2.4.4

24 Jul 16:47
Compare
Choose a tag to compare

Update URLEncodingTable and add DataURIEncodingTable for better URL/URI encoding.

v2.4.3

08 Jun 17:44
Compare
Choose a tag to compare
  • CSS: fix slow execution of selector with many errors
  • Fix panic on MediaType that ends in a space
  • Fix parsing + or - as integers, and don't parse the exponent if there is no number
  • Fix parsing e as a float
  • Moving hash tables/entities maps to minify repository
  • JS: improved performance

v2.4.2

02 Jan 14:17
Compare
Choose a tag to compare
  • Add many hashes for CSS
  • Add amp-boilerplate hash for HTML
  • NewError now has fmt-style function signature
  • Append 0x00 to signal EOF even if source already ends in 0x00 (which may be valid)

v2.4.1

03 Dec 22:58
Compare
Choose a tag to compare

CSS: add Invert and Solid hashes

v2.4.0

30 Nov 14:55
Compare
Choose a tag to compare
  • XML and HTML: Text() []byte returns nil for start tag closers
  • XML and HTML: Text() []byte returns textual content for TextToken, CommentToken, ...
  • Added Offset() int for all lexers and parsers that returns the current character offset in the input stream
  • CSS: EOF after \ now properly handled as DelimToken and not EscapeToken in some cases

v2.3.15

28 Nov 19:00
Compare
Choose a tag to compare

Bugfix: bad URL encoding resulted in no decoding at all, the new EncodeURL and DecodeURL are faster and never fail
Bugfix: get correct Position if it is in the middle of a unicode codepoint

v2.3.14

27 Nov 20:12
Compare
Choose a tag to compare
  • Re-parse input immediately when encountering parse error. Previously this was only done if the error was actually read which would save us from re-parsing the file (i.e. better performance). However, an error is (a) rare and (b) happens only once per file. Re-parsing on errors does not impact the performance of well formatted files, and a reliable error message is valued more.
  • Bugfix: prevent infinite loop on error on input file that contains unicode code points (i.e. any character bigger than 0xC0 usually followed by more bytes).
  • Improve error messages for parsers to include parser name and print offending byte(s)

v2.3.13

26 Nov 23:03
Compare
Choose a tag to compare
  • Improve performance of ReplaceMultipleWhitespace by 20%--25%
  • Add ReplaceEntities and ReplaceMultipleWhitespaceAndEntities to replace QuoteEntity. These allow to do replacements such as: " => ", " => ", " => ", ’ => ’, ' => '.
  • Update list of HTML entity rewrites