439
439
(defmacro mew-pick-lex-cut ()
440
440
`(when (and start (< start i))
441
441
(let ((word (substring pattern start i)) key op val)
442
(if (string-match "^\\([-a-z0-9]+\\)\\(!?==?\\)\\(.+\\)$" word)
443
(if (string-match "^\\([-a-z0-9,]+\\)\\(!?==?\\)\\(.+\\)$" word)
444
445
(setq key (mew-match-string 1 word))
445
446
(setq op (mew-match-string 2 word))
534
535
(error "')' alone"))
536
(unless mew-inherit-pick-omit-and
537
(unless (or mew-inherit-pick-omit-and2 mew-inherit-pick-omit-and)
537
538
(setq mew-inherit-pick-ret (cons 'and mew-inherit-pick-ret)))
538
539
(setq mew-inherit-pick-tokens (cdr mew-inherit-pick-tokens))
539
540
(mew-pick-parse-not))
541
542
(unless mew-inherit-pick-omit-and
542
543
(setq mew-inherit-pick-ret (cons 'and mew-inherit-pick-ret)))
543
545
(setq mew-inherit-pick-tokens (cdr mew-inherit-pick-tokens))
544
546
(mew-pick-parse-elements))
630
632
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
637
(defun mew-pick-canonicalize-pattern-est (pattern)
638
(let ((mew-inherit-pick-omit-and2 t))
640
'mew-pick-native-text-est
641
(mew-pick-parse (mew-pick-lex pattern))
644
(defun mew-pick-native-text-est (token)
645
(mew-pick-native-text "mew-pick-pattern-est-" token))
647
(defun mew-pick-pattern-est-and (sym) "AND")
648
(defun mew-pick-pattern-est-or (sym) "OR")
649
(defun mew-pick-pattern-est-open (sym) (error "'(' is not supported"))
650
(defun mew-pick-pattern-est-close (sym) (error "')' is not supported"))
651
(defun mew-pick-pattern-est-not (sym) "ANDNOT")
652
(defun mew-pick-pattern-est-key (key) key)
653
(defun mew-pick-pattern-est-kyvl (kyvl)
654
(error "'%s' is not supported" kyvl))
656
(defvar mew-pick-filter-est-head-fields "date,subject,from,to,cc,resent-from,resent-to,resent-cc,reply-to,mail-followup-to,x-mail-count,x-ml-count,x-ml-name,x-seqno,x-sequence,mailinglist-id,message-id,in-reply-to,references,newsgroups,followup-to")
658
(defun mew-pick-filter-est-kyvl (kyvl)
659
(unless (and (listp kyvl) (= (length kyvl) 3))
660
(error "Filter is invalid" kyvl))
661
(let ((op (nth 0 kyvl))
664
(if (string= ky "head")
665
(setq ky mew-pick-filter-est-head-fields))
672
(setq op "!ISTRINC"))
676
(error "'%s' is not supported" op)))
677
(format "%s %s %s" ky op vl)))
679
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
660
709
(defun mew-pick-canonicalize-pattern-google (pattern)
661
(let* ((mew-inherit-pick-omit-and t)
662
(tokens (mew-pick-parse (mew-pick-lex pattern)))
710
(let ((mew-inherit-pick-omit-and t)
711
(tokens (mew-pick-parse (mew-pick-lex pattern)))
665
714
(setq tkn (car tokens))
666
715
(setq tokens (cdr tokens))
683
732
(defun mew-pick-pattern-google-and (sym) "and")
684
733
(defun mew-pick-pattern-google-or (sym) "or")
685
(defun mew-pick-pattern-google-open (sym) "'(' is not supported")
686
(defun mew-pick-pattern-google-close (sym) "')' is not supported")
734
(defun mew-pick-pattern-google-open (sym) (error "'(' is not supported"))
735
(defun mew-pick-pattern-google-close (sym) (error "')' is not supported"))
687
736
(defun mew-pick-pattern-google-not (sym) "-")
688
737
(defun mew-pick-pattern-google-key (key) key)
689
738
(defun mew-pick-pattern-google-kyvl (kyvl)
690
739
(let ((op (nth 0 kyvl)))
691
740
(error "'%s' is not supported" op)))
694
742
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
699
747
(defun mew-pick-canonicalize-pattern-wds (pattern)
700
(let* ((mew-inherit-pick-omit-and t)
701
(tokens (mew-pick-parse (mew-pick-lex pattern)))
748
(let ((mew-inherit-pick-omit-and t)
749
(tokens (mew-pick-parse (mew-pick-lex pattern)))
704
752
(setq tkn (car tokens))
705
753
(setq tokens (cdr tokens))
722
770
(defun mew-pick-pattern-wds-and (sym) "and")
723
771
(defun mew-pick-pattern-wds-or (sym) "or")
724
(defun mew-pick-pattern-wds-open (sym) "'(' is not supported")
725
(defun mew-pick-pattern-wds-close (sym) "')' is not supported")
772
(defun mew-pick-pattern-wds-open (sym) (error "'(' is not supported"))
773
(defun mew-pick-pattern-wds-close (sym) (error "')' is not supported"))
726
774
(defun mew-pick-pattern-wds-not (sym) "-")
727
775
(defun mew-pick-pattern-wds-key (key) key)
728
776
(defun mew-pick-pattern-wds-kyvl (kyvl)