Function: icalendar-parse-one-of
icalendar-parse-one-of is a byte-compiled function defined in
icalendar-parser.el.gz.
Signature
(icalendar-parse-one-of TYPES LIMIT)
Documentation
Parse a value, from point up to LIMIT, of one of the TYPES.
TYPES should be a list of type symbols. For each type in TYPES, the
parser function associated with that type will be called at point. The
return value of the first successful parser function is returned. If
none of the parser functions are able to parse a value, an
icalendar-parse-error is signaled.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:parse-one-of (types limit)
"Parse a value, from point up to LIMIT, of one of the TYPES.
TYPES should be a list of type symbols. For each type in TYPES, the
parser function associated with that type will be called at point. The
return value of the first successful parser function is returned. If
none of the parser functions are able to parse a value, an
`icalendar-parse-error' is signaled."
(let* ((value nil)
(start (point))
(type (car types))
(parser (get type 'ical:value-parser))
(rest (cdr types)))
(while (and parser (not value))
(condition-case nil
(setq value (funcall parser limit))
(ical:parse-error
;; value of this type not found, so try again:
(goto-char start)
(setq type (car rest)
rest (cdr rest)
parser (get type 'ical:value-parser)))))
(unless value
(ical:signal-parse-error
(format "Unable to parse any of %s between %d and %d" types start limit)
:position start))
value))