;;; ebnf-abn.el --- parser for ABNF (Augmented BNF)
-;; Copyright (C) 2004 Free Sofware Foundation, Inc.
+;; Copyright (C) 2004, 2005 Free Sofware Foundation, Inc.
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
-;; Time-stamp: <2004/02/28 17:40:41 vinicius>
+;; Time-stamp: <2004/04/03 16:43:57 vinicius>
;; Keywords: wp, ebnf, PostScript
-;; Version: 1.0
+;; Version: 1.1
;; This file is part of GNU Emacs.
(setq token (ebnf-abn-lex))
(and (eq token 'end-of-input)
(error "Invalid ABNF file format"))
+ (and (eq token 'end-of-rule)
+ (setq token (ebnf-abn-lex)))
(while (not (eq token 'end-of-input))
(ebnf-message-float
"Parsing...%s%%"
term (cdr term))
(setq seq (cons term seq)))
(cons token
- (if (= (length seq) 1)
- ;; sequence with only one element
- (car seq)
- ;; a real sequence
- (ebnf-make-sequence (nreverse seq))))))
+ (ebnf-token-sequence seq))))
;;; repetition = [repeat] element
(defun ebnf-abn-lex ()
- "Lexical analyser for ABNF.
+ "Lexical analyzer for ABNF.
Return a lexical token.
'end-of-input)
;; error
((eq token 'error)
- (error "Illegal character"))
+ (error "Invalid character"))
;; end of rule
((eq token 'end-of-rule)
'end-of-rule)
((= (following-char) ?\n)
t)
(t
- (error "Illegal character"))
+ (error "Invalid character"))
))