vincentliu99999
4/4/2013 - 8:07 PM

search_grammar.txt

search = [ notebook , separator ] , 
         [ "any:" , separator ] , 
         term ,
         { separator , term } ;

notebook = "notebook:" , ( word | quoted ) ;

word = wordchar , { wordchar } ;

quoted = '"' , { ( any - '"' ) | '\"' } , '"' ;

separator = { sepchar , separator } ;

sepchar = any - ( wordchar | '"' | "-" ) ;

term = "-" negatable
       | negatable 
       ;

negatable = literal
            | expression
            ;

literal = word | quoted | prefix ;

prefix = { wordchar } , "*" ;

expression = label , ":" , value ;

(*
 * Expression labels must be:
 * The name of a NoteAttribute field (e.g. "subjectDate")
 * or a ResourceAttribute field (e.g. "fileName"),
 * or one of:  "tag", "intitle", "created", "updated", "resource",
 *             "todo", or "encryption".
 * Search results are undefined if an unknown label is used.
 *)
label = word ;

(*
 * The expression value will be interpreted based on the type of the
 * field or attribute.
 * Search results are undefined if the value does not match the
 * required format for this field.
 *)
value = nonspace | quoted ;

nonspace = { any - space } ;


space = ? whitespace character (Unicode character class Z) ? ;

wordchar = ? any Unicode Letter or Number (Unicode character classes L and N) or underscore '_' ? ;

any = ? any printable characters ? ;
</pre>
<p>
The following additional production rules indicate the expected format of expression values to match various note fields and attribute types described above.
</p><pre class="longline">boolean = "true"
          | "false"
          | "*"
          ;

double = [ "-" ] , digit , { digit } , [ "." , { digit } ]
         | "*"
         ;

datetime = absolutedate
           | relativedate
           | "*"
           ;

absolutedate = year , month , day , 
              [ "T" , hour , minute , second ] , [ "Z" ];
year = digit , digit , digit , digit ;
month = ( "0" | "1" ) , digit ;
day = ( "0" | "1" | "2" | "3" ) , digit ;
hour = ( "0" | "1" | "2" ) , digit ;
minute = ( "0" | "1" | "2" | "3" | "4" | "5" ) , digit ;
second = ( "0" | "1" | "2" | "3" | "4" | "5" ) , digit ;

relativedate = relative
               | relative , "-" , { digit }
               ;

relative = "day" | "week" | "month" | "year" ;

digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;