commit | 33b1f2a498b27ffbaab8af3c2301cbbe566074f0 | [log] [tgz] |
---|---|---|
author | Leon Senft <leonsenft@google.com> | Fri Jul 24 14:56:33 2020 -0700 |
committer | Leon Senft <leonsenft@users.noreply.github.com> | Sat Jul 25 15:17:45 2020 -0700 |
tree | 4a08953fd06e977dfff1e7e663bd7b654e8ea372 | |
parent | 5d0997fef755b6eeb815dab82213792971db3160 [diff] |
Support parsing identifiers with escape codes in them The output of `CssPrinter` will now also retain escape codes in identifiers. This ensures they remain valid identifiers, as the escaped values may not parse as valid identifiers. The parser will also no longer accept an ID or class selector with space between the first token (`#` or `.` respectively) and the identifier. The parser will now fail immediately on these selector errors instead of attempting to recover. Recovering in a robust manner is difficult given that this parser immediately attempts to parse at the selector granularity, rather than first parsing the style sheet into rules as described [here][parse-rule]. [parse-rule]: https://www.w3.org/TR/css-syntax-3/#consume-a-qualified-rule Fixes https://github.com/dart-lang/csslib/issues/58.
A Dart CSS parser.
Parsing CSS is easy!
import 'package:csslib/parser.dart'; main() { var stylesheet = parse( '.foo { color: red; left: 20px; top: 20px; width: 100px; height:200px }'); print(stylesheet.toDebugString()); }
You can pass a String
or List<int>
to parse
.