Webrexp Grammar - Twinside/Webrexp GitHub Wiki
Here is the grammar used for the expression, it might change in the future
webrexp ::= exprUnion (';' exprUnion)*
noderange ::= [0-9]
| [0-9] '-' [0-9]
ranges ::= noderange
| ranges ',' noderange
webident ::= [a-zA-Z0-9-_]+
webref ::= webident
| '_'
| webref '.' webident
| webref '@' webident
| webref '#' webident
attribute ::= webident
stringLiteral ::= '"' .* '"' // in fact, it's a regular escaped string
// literal, so you can \t and \n as you want.
actionTerm ::= attribute
| '(' actionExpr ')'
| stringLiteral
| [0-9]+
| '.'
| '#'
| '?'
actionExpr ::= actionTerm
| actionExpr '&' actionExpr
| actionExpr '|' actionExpr
| actionExpr '=' actionExpr
| actionExpr '!=' actionExpr
| actionExpr '<' actionExpr
| actionExpr '>' actionExpr
| actionExpr '<=' actionExpr
| actionExpr '>=' actionExpr
| actionExpr '+' actionExpr
| actionExpr '-' actionExpr
| actionExpr '*' actionExpr
| actionExpr '/' actionExpr
// CSS3 compatible operators
| actionExpr '~=' actionExpr
| actionExpr '^=' actionExpr
| actionExpr '$=' actionExpr
| actionExpr '*=' actionExpr
| actionExpr '|=' actionExpr
actionList ::= actionExpr (';' actionExpr)*
exprUnion ::= exprPath (',' exprPath)*
exprPath ::= expr+
repeat-count ::= num ',' num
| num ','
| num
expr ::= expterm
| expr '*'
| expr '{' repeat-count '}'
| expr '|' expr
expterm ::= '(' webrexp ')'
| '[' actionList ']'
| '#{' ranges '}'
| '>' webref
| '>>'
| '->'
| '+'
| '~'
| '<'
| '!'
| stringLiteral
| webref