comparison lisp/progmodes/ebnf-bnf.el @ 39422:3e68652d365d

Fix character range regexp. Doc fix. (ebnf-bnf-non-terminal-chars): New internal const. (ebnf-bnf-lex): Fix code.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 24 Sep 2001 17:41:41 +0000
parents aa2d472f6aa7
children cc820064216c
comparison
equal deleted inserted replaced
39421:ee17ab90f511 39422:3e68652d365d
3 ;; Copyright (C) 1999, 2000, 2001 Free Sofware Foundation, Inc. 3 ;; Copyright (C) 1999, 2000, 2001 Free Sofware Foundation, Inc.
4 4
5 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> 5 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
6 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 6 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
7 ;; Keywords: wp, ebnf, PostScript 7 ;; Keywords: wp, ebnf, PostScript
8 ;; Time-stamp: <2001/09/18 21:03:57 vinicius> 8 ;; Time-stamp: <2001/09/24 10:17:26 vinicius>
9 ;; Version: 1.6 9 ;; Version: 1.7
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
404 (aset ebnf-bnf-token-table ?$ 'default) 404 (aset ebnf-bnf-token-table ?$ 'default)
405 ;; Override comment character: 405 ;; Override comment character:
406 (aset ebnf-bnf-token-table ebnf-lex-comment-char 'comment) 406 (aset ebnf-bnf-token-table ebnf-lex-comment-char 'comment)
407 ;; Override end of production character: 407 ;; Override end of production character:
408 (aset ebnf-bnf-token-table ebnf-lex-eop-char 'period))) 408 (aset ebnf-bnf-token-table ebnf-lex-eop-char 'period)))
409
410
411 ;; replace the range "\240-\377" (see `ebnf-range-regexp').
412 (defconst ebnf-bnf-non-terminal-chars
413 (ebnf-range-regexp "!#%&'*-,0-:<>@-Z\\\\^-z~" ?\240 ?\377))
409 414
410 415
411 (defun ebnf-bnf-lex () 416 (defun ebnf-bnf-lex ()
412 "Lexical analyser for EBNF. 417 "Lexical analyser for EBNF.
413 418
465 ((eq token 'terminal) 470 ((eq token 'terminal)
466 (setq ebnf-bnf-lex (ebnf-unescape-string (ebnf-get-string))) 471 (setq ebnf-bnf-lex (ebnf-unescape-string (ebnf-get-string)))
467 'terminal) 472 'terminal)
468 ;; non-terminal or terminal 473 ;; non-terminal or terminal
469 ((eq token 'non-terminal) 474 ((eq token 'non-terminal)
470 ;; replace the range "\240-\377" (see `ebnf-range-regexp'). 475 (setq ebnf-bnf-lex (ebnf-buffer-substring ebnf-bnf-non-terminal-chars))
471 (setq ebnf-bnf-lex (ebnf-buffer-substring
472 (ebnf-range-regexp "!#%&'*-,0-:<>@-Z\\\\^-z~"
473 ?\240 ?\377)))
474 (let ((case-fold-search ebnf-case-fold-search) 476 (let ((case-fold-search ebnf-case-fold-search)
475 match) 477 match)
476 (if (and ebnf-terminal-regexp 478 (if (and ebnf-terminal-regexp
477 (setq match (string-match ebnf-terminal-regexp 479 (setq match (string-match ebnf-terminal-regexp
478 ebnf-bnf-lex)) 480 ebnf-bnf-lex))