property
: IDENT S*
;
declaration
: property ':' S* expr prio?
;
prio
: IMPORTANT_SYM S*
;
expr
: term [ operator? term ]*
;
term
: unary_operator?
[ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
TIME S* | FREQ S* ]
| STRING S* | IDENT S* | URI S* | hexcolor | function
;
function
: FUNCTION S* expr ')' S*
;
hexcolor
: HASH S*
;
#ifdef WIN32I did manage to find two C CSS libraries, one is the MIT licensed libcss and the other was the gnome libcroco project. Both have burdensome dependencies, and the latter is unfortunately LGPL.
if(parse_css)
{
cerr << "Css parsing not supported in win32" << endl;
return 1;
}
return 0;
#else
The loader doesn't need to know what properties are valid, because all properties share a common syntax.
The renderer can decide how the values are used, but there is no way for "2px solid red" to be interpreted except as a sequence of [dimension, identifier, identifier]. It's wasteful to re-parse the same string into the same exact values every time the property is used.
I can't? CSS is a language. This language defines a variety of data-types, and syntactic notation to demarcate these data-types. You can't add a new data-type to CSS.
Pedantry, but 'someclass' isn't a class. '.someclass' is. There's nothing wrong with your comparison, but 5 is syntactically a number, and CYAN an identifier. There's no reason to store them both as strings.
You're right. I just looked up some CSS functions, and there's one called attr() that gets the value of an attribute for the matched node. However, that doesn't mean you can't store the function and its parameters as a Function syntax node, and evaluate it during rendering.
And if you must know yes, I do plan on using the same names as the web related ones, i just used the ones above to prove a point about not knowing variable types ahead of time.
I actually plan to use both web related property names, as well as using xml elements for the structure so that it is possible to bypass the server handling of the data and let the client do the work.
I really don't see a problem with this.