Quantcast

Syntactic sugar...

classic Classic list List threaded Threaded
1 message Options
fge
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Syntactic sugar...

fge
This post was updated on .
CSS is a lot of repetitions, which means I had to repeat a lot of patterns...

So, I coded some small syntactic sugar over BaseParser

Here is what I can write in my code with the current set of sugar coat:

* return Join(with(Optional(WhiteSpace())), elements(IgnoreCase(keyword), ':', rule, ';'));
* return AnyNumber(of(AnyFont()), joinedWith(Comma()));
* return Exactly(3, of(HexDigit()));
* return Join(4, of(PositiveLength()), with(WhiteSpace()));
* return UpTo(3, of(TwoDigits()), joinedWith(':'));

Here is the current code. It currently lacks comments...
Loading...