44 Commits

Author SHA1 Message Date
ConnorSkees
bc12c0b4e7 refactor number parsing to reduce nesting 2020-05-23 01:49:21 -04:00
ConnorSkees
d4141e09ee document internal function 2020-05-22 20:50:48 -04:00
ConnorSkees
283a2097ff rename Value::Ident to Value::String 2020-05-22 14:35:41 -04:00
ConnorSkees
969726eb30 Revert string interning
There existed issues related to multithreaded tests that are difficult
to resolve. In the future interning may be reimplemented but in a more
limited capacity.

The motivation behind interning *values* was that it appeared checking
for named colors was responsible for much of the time lost when parsing
unquoted strings. If interning were to be reimplemented, it may make
sense to limit it solely to identifiers and style properties.
2020-05-22 14:20:31 -04:00
ConnorSkees
9a6c8ce019 add string interning
this seems to improve performance by ~20% as well as significantly
decrease memory usage
2020-05-21 22:46:40 -04:00
ConnorSkees
c68576bb23 refactor parsing of toplevel variables 2020-05-21 13:25:37 -04:00
ConnorSkees
67091115db better handle - at the start of idents 2020-05-21 12:06:42 -04:00
ConnorSkees
d300d4e1fc test for ] in value 2020-05-21 00:09:52 -04:00
ConnorSkees
b58ed29fd0 add more span information
this resolves a lot of panics that occurred when there was no more input
2020-05-17 00:35:07 -04:00
ConnorSkees
2db3398fe2 properly handle escaped newlines in quoted strings 2020-05-16 17:20:53 -04:00
ConnorSkees
223dade62b Emit proper error for escape sequence overflow
Before this commit, escape sequences above std::char::MAX ('\u{10ffff}')
would overflow and cause a panic. This commit replaces an `unwrap` with
`ok_or` and a clearer error message. This message will likely change
in the future in order to better conform to the `dart-sass` implementation
which currently also fails to cleanly handle this overflow.

See https://github.com/kaj/rsass/pull/73
2020-05-16 16:22:33 -04:00
ConnorSkees
26df276266 Value::to_css_string returns a Cow<'static, str> 2020-05-05 11:08:34 -04:00
ConnorSkees
4321a383f2 eat whitespace after silent comments 2020-05-02 12:49:42 -04:00
ConnorSkees
3ca48702a1 interpolated_ident_body doesn't allocate its own string 2020-05-02 11:47:49 -04:00
ConnorSkees
daf7f247cf refactor iteration over intermediate values 2020-05-01 03:13:20 -04:00
ConnorSkees
8a3ba1ae07 make lowercase in place where possible 2020-04-30 16:08:35 -04:00
ConnorSkees
03316161a8 remove superfluous is_float variable 2020-04-28 15:49:19 -04:00
ConnorSkees
bc09e49c89 remove is_float field of ParsedNumber 2020-04-28 15:28:50 -04:00
ConnorSkees
bcbf3f4a90 clippy 2020-04-28 15:14:44 -04:00
ConnorSkees
a9ec7ff73f fix issue where only 0 would be emitted for non-scientific-notation numbers 2020-04-28 14:49:00 -04:00
ConnorSkees
a183a9ffa2 optimize parsing of numbers
This makes parsing of floats roughly 10x faster
2020-04-28 13:18:54 -04:00
ConnorSkees
2ee4396978 handle scientific notation in numbers 2020-04-28 12:15:10 -04:00
ConnorSkees
d53b44aafe tabs are not emitted literally 2020-04-26 19:02:43 -04:00
ConnorSkees
4a2503b04c refactor attribute parsing 2020-04-26 00:55:38 -04:00
ConnorSkees
a8141d2488 handle edge case in parsing of units ending with hypen followed by whitespace 2020-04-25 20:19:50 -04:00
ConnorSkees
a5cd335318 properly handle whitespace and start and end of url() 2020-04-24 19:00:06 -04:00
ConnorSkees
a86d717f26 properly parse variable flags 2020-04-23 21:30:25 -04:00
ConnorSkees
99ae3ae30a test for multiline comments in subtraction 2020-04-23 19:44:20 -04:00
ConnorSkees
409ac80921 handle multiline comments surrounding @ if condition 2020-04-23 19:32:32 -04:00
ConnorSkees
34b886b758 more robustly handle escaping 2020-04-22 10:57:57 -04:00
ConnorSkees
3805eaab2b clippy 2020-04-21 18:22:26 -04:00
ConnorSkees
fc3facb80c properly handle url() 2020-04-21 04:20:35 -04:00
ConnorSkees
cdfd89cd75 add TODO to interpolated_ident_body 2020-04-21 02:17:11 -04:00
ConnorSkees
3e9e860e20 allow slient comments in special function args 2020-04-20 15:11:03 -04:00
ConnorSkees
0052c754cb rename ident_body to be more explicit it does not include interpolation 2020-04-20 14:57:41 -04:00
ConnorSkees
ca69695776 remove unused IsComment trait 2020-04-20 14:57:22 -04:00
ConnorSkees
46552b3a56 remove usage of use super::*` 2020-04-20 14:53:52 -04:00
ConnorSkees
c031286c9a refactor number and interpolation utils to separate file 2020-04-20 14:49:29 -04:00
ConnorSkees
11a27775a4 refactor read_until utils to separate file 2020-04-20 14:45:40 -04:00
ConnorSkees
8a4d74e268 refactor comment and whitespace utils to separate file 2020-04-20 14:40:51 -04:00
ConnorSkees
40451a211a refactor variable utils to separate file 2020-04-20 14:38:05 -04:00
ConnorSkees
c121bbc1e3 refactor string utils to separate file 2020-04-20 14:35:16 -04:00
ConnorSkees
760c95792c refactor char utils to separate file 2020-04-20 14:30:56 -04:00
ConnorSkees
3fd9692ce5 move utils to directory 2020-04-20 14:27:35 -04:00