308 Commits

Author SHA1 Message Date
ConnorSkees
f52d784756 remove panic from unclosed call args 2020-05-24 10:18:15 -04:00
ConnorSkees
737a6ba90d emit proper error on unclosed quote 2020-05-24 10:04:30 -04:00
ConnorSkees
042dbfa914 remove panics from missing identifiers 2020-05-24 08:56:53 -04:00
ConnorSkees
2aaaf59e4f make division with number as lhs more robust 2020-05-24 08:17:08 -04:00
ConnorSkees
cbec20f753 make value parsing more robust 2020-05-24 07:51:28 -04:00
ConnorSkees
5137353cb4 rustfmt 2020-05-23 14:08:40 -04:00
ConnorSkees
ff2962b124 remove more unwraps 2020-05-23 14:07:57 -04:00
ConnorSkees
34f9436163 remove unwrap in favor of if let 2020-05-23 14:03:47 -04:00
ConnorSkees
da768badea remove unwrap in favor of if let 2020-05-23 13:59:03 -04:00
ConnorSkees
076ee7ca4e remove redundant clone of identifier 2020-05-23 13:53:24 -04:00
ConnorSkees
a3548b0044 remove panic for missing equal 2020-05-23 11:50:25 -04:00
ConnorSkees
2a79fa2a40 implement some of the more esoteric binary ops
addition, subtraction, and multiplication of functions and maps, along
with correct error messages and tests
2020-05-22 23:30:48 -04:00
ConnorSkees
7261f57e01 emit proper error for map as rhs of addition 2020-05-22 20:47:53 -04:00
ConnorSkees
80e32b4290 emit proper error for map as lhs of addition 2020-05-22 20:34:41 -04:00
ConnorSkees
b4b2edc9a4 use Identifier for SassFunction names 2020-05-22 20:13:39 -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
3e5abf0587 remove keywords 2020-05-22 14:09:28 -04:00
ConnorSkees
b15740976c remove superfluous allocations when resolving idents 2020-05-22 13:49:19 -04:00
ConnorSkees
5bed62c404 keywords are thread_local 2020-05-22 13:47:48 -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
ff8447fd7e handle operators as part of binops 2020-05-21 14:07:46 -04:00
ConnorSkees
4cba3dfd4e handle ~ in values 2020-05-21 13:36:55 -04:00
ConnorSkees
c714d52775 handle | in values 2020-05-21 13:31:03 -04:00
ConnorSkees
709b95d035 improve span information in values 2020-05-21 11:48:38 -04:00
ConnorSkees
0c144e22ba handle ` in values 2020-05-21 01:07:34 -04:00
ConnorSkees
d300d4e1fc test for ] in value 2020-05-21 00:09:52 -04:00
ConnorSkees
3decf3739c refactor Integer to separate file 2020-05-20 22:46:26 -04:00
ConnorSkees
45a29c9697 refactor Number::to_integer 2020-05-20 22:40:21 -04:00
ConnorSkees
3fcd0b8be4 replace todo with unreachable to make clearer that methods should not be used 2020-05-20 21:05:55 -04:00
ConnorSkees
bea90060a8 minor cleanup 2020-05-20 00:14:55 -04:00
ConnorSkees
8520048b26 implement small int optimizations
This allows for numbers within 18 digits of precision (the vast
majority of numbers) to be represented by just 2 i64s rather than 2 heap
allocated BigInts. In the future these optimizations may become more
aggressive and granular, but for now `grass` is already more than an order of
magnitude faster than `dart-sass`.
2020-05-19 23:23:04 -04:00
ConnorSkees
cf987abb53 remove bimap in favor of ad hoc structure 2020-05-19 19:13:49 -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
6e7f1cc319 remove some panicking 2020-05-17 00:08:50 -04:00
ConnorSkees
4ee82e66be refactor comparison ops to src/value/ops.rs 2020-05-16 22:45:32 -04:00
ConnorSkees
c07bb7ecce refactor == and != order of operations 2020-05-16 22:43:13 -04:00
ConnorSkees
697ff3d12f error messages for values beginnning with #
prior to this commit, error messages that occurred within idents
beginning with interpolation would be swallowed by error messages for
hex (largely, "Expected identifier.")
2020-05-16 19:25:11 -04:00
ConnorSkees
f3e7abdaba allow units to begin with escape sequences 2020-05-16 18:54:42 -04:00
ConnorSkees
374e9f9eb4 correctly parse idents starting with interpolation 2020-05-14 00:10:24 -04:00
ConnorSkees
5b69ad2659 special functions are always lowercased 2020-05-13 00:16:36 -04:00
ConnorSkees
e5226e5cfe eat_calc_args doesn't allocate its own string 2020-05-06 12:15:42 -04:00
ConnorSkees
1b774a9b91 simplify Unit::From<String> 2020-05-06 12:01:40 -04:00
ConnorSkees
01858ff543 use static strings inside unit conversion table 2020-05-06 11:55:49 -04:00
ConnorSkees
6729f24b17 Value::inspect returns cow 2020-05-06 11:50:35 -04:00
ConnorSkees
26df276266 Value::to_css_string returns a Cow<'static, str> 2020-05-05 11:08:34 -04:00
ConnorSkees
96e916e750 handle negative values in @for 2020-05-02 15:11:58 -04:00
ConnorSkees
07f12b6fb4 remove unnecessary logical not 2020-05-02 12:31:53 -04:00
ConnorSkees
cf0cb01141 further optimize formatting of numbers
grass differs from rsass in that all numbers are bigints. this makes our
fomatting of numbers 6x slower than rsass and barely faster than
node-sass. ideally in the future, we would just use plain float
formatting. i've learned that dart-sass no longer configures precision as a cli
flag, so there is potentially some manual loop unrolling or
optimizations we could make knowing that all numbers must be a max of 10
digits. the next release of num_rational should contain an
implementation of to_f64() for BigRational, so that may solve our
problems.
2020-05-02 10:36:23 -04:00
ConnorSkees
daf7f247cf refactor iteration over intermediate values 2020-05-01 03:13:20 -04:00