# example:  type[name=*.Builder && public && !abstract && method=method[] ]

matchers    = LWSP matcher *(LWSP (AND/OR) LWSP matcher) LWSP       ;
matcher     = mtype LWSP "[" LWSP mexpr LWSP "]"                    ; 
mtype       = 1*ALPHA                                               ; # matcher type e.g. 'method'     
mexpr       = filter                                              ; # matcher expression
filter      = (group/afilters) *( LWSP (AND/OR) LWSP [NOT] gopen LWSP filter LWSP gclose );
group       = [NOT] LWSP gopen LWSP afilters LWSP gclose            ;
afilters    = afilter LWSP *( LWSP (AND/OR) LWSP afilter)           ; # number of attribute filterS e.g  'x=y && !z && y=5'
afilter     = (attname LWSP (EQ/NOT_EQ/LESS/GREATER/LESS_EQ/GREATER_EQ) LWSP attvalexpr) / (LWSP [NOT] LWSP attname); # attribute filter. e.g 'x=y' or '!x' or 'x<=3'
attname     = ALPHA *ALPHANUM                                       ;
attvalexpr  = attval LWSP *(LWSP PLUS LWSP attval)                  ;
attval      = range / BOOL / NUM / NULL / qval / datetime / ival / varexpr / antexpr ; 
qval        = (DQUOTE *((%x21 / %x23-7E) / WSP) DQUOTE) / (SQUOTE *((%x21-26 / %x28-7E)/WSP) SQUOTE)       ; # quoted text
ival        = antexpr varexpr antexpr *(antexpr varexpr antexpr)    ; # interpolated value
antexpr     = *("*" / "?" / "." / ALPHANUM)                         ; # ANT expression
varexpr     = "${" varname "}"                                      ; # variable expression
varname     = 1*(ALPHANUM / "." / "-" / "_" / ":" )                 ; # variable name

range       = rfrom LWSP ".." LWSP rto                              ; # number range x..y
rfrom       = NUM                                                   ;
rto         = NUM                                                   ;
datetime    = date [ LWSP ["T"/WSP] LWSP time] [LWSP tz]            ; # datetime yyyy.mm.dd HH:MM:ss SSS TZ
date        = 1*4DIGIT ("."/"-"/"/") months ("."/"-"/"/") days      ; # date yyyy.mm.dd or yyyy/mm/dd                             ;
time        = hours ":" minutes ":" seconds ["." 3DIGIT]            ; # time HH:MM:ss.SSS
tz          = (3ALPHA [LWSP tzoffset] ) / tzoffset                  ; # timezone e.g GMT +02:30
tzoffset    = SIGN LWSP hours [ [":"] minutes ]                     ; # timezone offset
months      = %x30-31 %x30-39                                       ; # 0 - 19
days        = %x30-33 %x30-39                                       ; # 0 - 39
hours       = (%x30-31 %x30-39) / (%x32 %x30-33)                    ;
minutes     = %x30-35 %x30-39                                       ;
seconds     = %x30-35 %x30-39                                       ;

gopen       = "("                                                   ; # group start
gclose      = ")"                                                   ; # group end

# things which should be standard

# todo:needs some work
NUM         = [SIGN] (INT32 / FLOAT / LONG / DOUBLE / BINARY / HEX );
FLOAT       = ((1*18DIGIT) / ( 0*18(DIGIT/".") DIGIT) / ( 1*17(DIGIT/".") "e" ("+"/"-") 1*16DIGIT ) ) "F" ; # do for now
LONG        = 1*19DIGIT "L"                                         ;
DOUBLE      = ((1*64DIGIT) / (1*17(DIGIT/".") "e" ("+"/"-") 1*16DIGIT) ) "D"; # do for now
BINARY      = %x30 "b" 1*(%x30-31 / "_")                            ;
HEX         = %x30 "x" 1*8DIGIT                                     ;
SIGN        = "-"/"+"                                               ;

$include "./core.abnf";