1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
typedef enum {
Root, NthChild, NthOfType, FirstChild, FirstOfType, Lang
} PseudoType;
typedef struct _PseudoCond {
PseudoType type;
int a, b;
string s;
struct _PseudoCond *next;
} PseudoCond;
typedef enum {
Exists, Equals, Includes, StartsWith, EndsWidth, Contains, LangMatch,
HasClass, HasID
} Operator;
typedef struct _AttribCond {
Operator op;
string name;
string value;
struct _AttribCond *next;
} AttribCond;
typedef enum {
Descendant, Child, Adjacent, Sibling
} Combinator;
typedef struct _SimpleSelector {
string name;
AttribCond *attribs;
PseudoCond *pseudos;
Combinator combinator;
struct _SimpleSelector *context;
} SimpleSelector, *Selector;
string selector_to_string(const Selector selector);
Selector parse_selector(const string selector);
|