The first version of csspp which with 100% coverage tests is now out. The .tar.gz is not yet available because SourceForge.net still has a few problems... but you can grab the source from the GIT repository.
The library (and thus command line tool) include support for a very large number of internal functions, variables, user defined functions (without support for the @return yet), nested rules, nested attributes, C/C++ like expressions, arrays, maps, color operations, etc.
The expression support the following types:
-
Integer (numbers without a period)
-
Decimal number
-
Percentage
-
Boolean (the identifiers "true" or "false", result of relational comparisons)
-
String
-
Color, as hash definitions (#121212) or an identifier naming a color (teal, chocolate, marron, etc.)
-
Unicode Range
-
URL
-
NULL
Most of the operators are supported:
-
- and + -- unary operators to negate or compute the entity; these require spaces
-
** -- the power operator works on numbers
-
* -- multiply numbers, duplicate strings, compute unicode range intersections
-
/ -- divide numbers; some fields do not support this operator unless written between parenthesis or as the identifier div
-
% -- compute modulos
-
+ -- add numbers, concatenate strings
-
- -- subtract numbers
-
<, <=, >, >= -- relational operators work on numbers, booleans, and strings
-
=, != -- equality operators work on numbers, booleans, strings, and colors
-
&&, || -- logical and and or operators; work on booleans, numbers, etc.
-
?: -- the C/C++ conditional operator
-
:= -- variable assignment
-
() -- array and map definitions
And expressions support many internal functions (still to be grown!):
-
algebra: abs, ceil, floor, log, max, min, random, round, sign, sqrt
-
boolean: not
-
color: alpha, blue, frgb, frgba, green, hsl, hsla, hue, lightness, red, rgb, rgba, saturation
-
conversion: decimal_number, identifier, integer, percentage, string, unit
-
string: str_length, unique_id
-
system: function_exists, global_variable_exists, if, inspect, type_of, variable_exists
-
trigonometry: acos, asin, atan, cos, sin, tan