Function: define-wisent-lexer

define-wisent-lexer is a macro defined in wisent.el.gz.

Signature

(define-wisent-lexer NAME DOC &rest BODY)

Documentation

Create a new lexical analyzer with NAME.

DOC is a documentation string describing this analyzer. When a token is available in wisent-lex-istream, eval BODY forms sequentially. BODY must return a lexical token for the LALR parser.

Each token in input was produced by semantic-lex, it is a list:

  (TOKSYM START . END)

TOKSYM is a terminal symbol used in the grammar. START and END mark boundary in the current buffer of that token's value.

Returned tokens must have the form:

  (TOKSYM VALUE START . END)

where VALUE is the buffer substring between START and END positions.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/wisent.el.gz
(defmacro define-wisent-lexer (name doc &rest body)
  "Create a new lexical analyzer with NAME.
DOC is a documentation string describing this analyzer.
When a token is available in `wisent-lex-istream', eval BODY forms
sequentially.  BODY must return a lexical token for the LALR parser.

Each token in input was produced by `semantic-lex', it is a list:

  (TOKSYM START . END)

TOKSYM is a terminal symbol used in the grammar.
START and END mark boundary in the current buffer of that token's
value.

Returned tokens must have the form:

  (TOKSYM VALUE START . END)

where VALUE is the buffer substring between START and END positions."
  (declare (debug (&define name stringp def-body)) (indent 1))
  `(defun
     ,name () ,doc
     (cond
      (wisent-lex-lookahead
       (prog1 wisent-lex-lookahead
         (setq wisent-lex-lookahead nil)))
      (wisent-lex-istream
       ,@body)
      ((wisent-lex-eoi)))))