/[emacs]/emacs/lisp/emacs-lisp/rx.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/rx.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by gerd, Mon Oct 1 07:28:43 2001 UTC revision 1.1.4.1 by lektu, Fri Sep 6 09:34:37 2002 UTC
# Line 78  Line 78 
78  ;;         (and line-start ?\n)))  ;;         (and line-start ?\n)))
79  ;;  ;;
80  ;; "\\$[I]d: [^ ]+ \\([^ ]+\\) "  ;; "\\$[I]d: [^ ]+ \\([^ ]+\\) "
81  ;; (rx (and "$Id": "  ;; (rx (and "$Id": "
82  ;;          (1+ (not (in " ")))  ;;          (1+ (not (in " ")))
83  ;;          " "  ;;          " "
84  ;;          (submatch (1+ (not (in " "))))  ;;          (submatch (1+ (not (in " "))))
85  ;;          " ")))  ;;          " ")))
# Line 90  Line 90 
90  ;; etc.  ;; etc.
91    
92  ;;; History:  ;;; History:
93  ;;  ;;
94    
95  ;;; Code:  ;;; Code:
96    
# Line 244  See also `rx-constituents'." Line 244  See also `rx-constituents'."
244    (while (and (not (null op)) (symbolp op))    (while (and (not (null op)) (symbolp op))
245      (setq op (cdr (assq op rx-constituents))))      (setq op (cdr (assq op rx-constituents))))
246    op)    op)
247        
248    
249  (defun rx-check (form)  (defun rx-check (form)
250    "Check FORM according to its car's parsing info."    "Check FORM according to its car's parsing info."
# Line 390  FORM is either `(repeat N FORM1)' or `(r Line 390  FORM is either `(repeat N FORM1)' or `(r
390  (defun rx-kleene (form)  (defun rx-kleene (form)
391    "Parse and produce code from FORM.    "Parse and produce code from FORM.
392  FORM is `(OP FORM1)', where OP is one of the `zero-or-one',  FORM is `(OP FORM1)', where OP is one of the `zero-or-one',
393  `zero-or-more' etc.  operators.    `zero-or-more' etc.  operators.
394  If OP is one of `*', `+', `?', produce a greedy regexp.  If OP is one of `*', `+', `?', produce a greedy regexp.
395  If OP is one of `*?', `+?', `??', produce a non-greedy regexp.  If OP is one of `*?', `+?', `??', produce a non-greedy regexp.
396  If OP is anything else, produce a greedy regexp if `rx-greedy-flag'  If OP is anything else, produce a greedy regexp if `rx-greedy-flag'
# Line 403  is non-nil." Line 403  is non-nil."
403          (op (cond ((memq (car form) '(* *? 0+ zero-or-more)) "*")          (op (cond ((memq (car form) '(* *? 0+ zero-or-more)) "*")
404                    ((memq (car form) '(+ +? 1+ one-or-more))  "+")                    ((memq (car form) '(+ +? 1+ one-or-more))  "+")
405                    (t "?"))))                    (t "?"))))
406      (format "\\(?:%s\\)%s%s" (rx-to-string (cadr form) 'no-group)      (format "\\(?:%s\\)%s%s" (rx-to-string (cadr form) 'no-group)
407              op suffix)))              op suffix)))
408    
409    
# Line 422  is non-nil." Line 422  is non-nil."
422                (cdr (assq form rx-categories)))                (cdr (assq form rx-categories)))
423      (error "Unknown category `%s'" form))      (error "Unknown category `%s'" form))
424    t)    t)
425                                
426    
427  (defun rx-category (form)  (defun rx-category (form)
428    "Parse and produce code from FORM, which is `(category SYMBOL ...)'."    "Parse and produce code from FORM, which is `(category SYMBOL ...)'."
# Line 470  NO-GROUP non-nil means don't put shy gro Line 470  NO-GROUP non-nil means don't put shy gro
470                    info)                    info)
471                   ((null info)                   ((null info)
472                    (error "Unknown Rx form `%s'" form))                    (error "Unknown Rx form `%s'" form))
473                   (t                   (t
474                    (funcall (nth 0 info) form)))))                    (funcall (nth 0 info) form)))))
475          ((consp form)          ((consp form)
476           (let ((info (rx-info (car form))))           (let ((info (rx-info (car form))))
# Line 508  CHAR Line 508  CHAR
508       matches any character in SET.  SET may be a character or string.       matches any character in SET.  SET may be a character or string.
509       Ranges of characters can be specified as `A-Z' in strings.       Ranges of characters can be specified as `A-Z' in strings.
510    
511  '(in SET)'  '(in SET)'
512       like `any'.       like `any'.
513    
514  `(not (any SET))'  `(not (any SET))'
# Line 694  CHAR Line 694  CHAR
694       still match.  A non-greedy regexp matches as little as possible.       still match.  A non-greedy regexp matches as little as possible.
695    
696  `(maximal-match SEXP)'  `(maximal-match SEXP)'
697       produce a greedy regexp for SEXP.   This is the default.       produce a greedy regexp for SEXP.  This is the default.
698    
699  `(zero-or-more SEXP)'  `(zero-or-more SEXP)'
700       matches zero or more occurrences of what SEXP matches.       matches zero or more occurrences of what SEXP matches.
# Line 710  CHAR Line 710  CHAR
710    
711  `(one-or-more SEXP)'  `(one-or-more SEXP)'
712       matches one or more occurrences of A.       matches one or more occurrences of A.
713      
714  `(1+ SEXP)'  `(1+ SEXP)'
715       like `one-or-more'.       like `one-or-more'.
716    
# Line 722  CHAR Line 722  CHAR
722    
723  `(zero-or-one SEXP)'  `(zero-or-one SEXP)'
724       matches zero or one occurrences of A.       matches zero or one occurrences of A.
725        
726  `(optional SEXP)'  `(optional SEXP)'
727       like `zero-or-one'.       like `zero-or-one'.
728    
# Line 739  CHAR Line 739  CHAR
739       matches N to M occurrences of what SEXP matches.       matches N to M occurrences of what SEXP matches.
740    
741  `(eval FORM)'  `(eval FORM)'
742        evaluate FORM and insert result.   If result is a string,        evaluate FORM and insert result.  If result is a string,
743        `regexp-quote' it.        `regexp-quote' it.
744    
745  `(regexp REGEXP)'  `(regexp REGEXP)'

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26