]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/ebnf-iso.el
Doc fix.
[gnu-emacs] / lisp / progmodes / ebnf-iso.el
index 024063f19ec9c589bc9369b80dc54b8a17e98626..148f23d2cabe0164c60fa2b2f677966e57acb348 100644 (file)
@@ -1,12 +1,13 @@
 ;;; ebnf-iso.el --- parser for ISO EBNF
 
-;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+;; Free Software Foundation, Inc.
 
-;; Author:     Vinicius Jose Latorre <vinicius@cpqd.com.br>
-;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
-;; Keywords:   wp, ebnf, PostScript
-;; Time-stamp: <2001-07-15 01:03:20 pavel>
-;; Version:    1.5
+;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
+;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
+;; Time-stamp: <2004/02/22 14:24:55 vinicius>
+;; Keywords: wp, ebnf, PostScript
+;; Version: 1.7
 
 ;; This file is part of GNU Emacs.
 
 ;; ISO EBNF accepts the characters given by <character> production above,
 ;; HORIZONTAL TAB (^I), VERTICAL TAB (^K), NEWLINE (^J or ^M) and FORM FEED
 ;; (^L), any other characters are illegal.  But ebnf2ps accepts also the
-;; european 8-bit accentuated characters (from \240 to \377).
+;; european 8-bit accentuated characters (from \240 to \377) and underscore.
 ;;
 ;;
 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   "Value returned by `ebnf-iso-lex' function.")
 
 
-(defconst ebnf-no-meta-identifier nil)
+(defvar ebnf-no-meta-identifier nil
+  "Used by `ebnf-iso-term' and `ebnf-iso-lex' functions.")
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Syntatic analyzer
+;; Syntactic analyzer
 
 
 ;;; ISO EBNF = syntax rule, {syntax rule};
     ;; Override form feed character:
     (aset table ?\f 'form-feed)                ; [FF] form feed
     ;; Override other lexical characters:
+    (aset table ?_  'non-terminal)
     (aset table ?\" 'double-terminal)
     (aset table ?\' 'single-terminal)
     (aset table ?\? 'special)
     (aset ebnf-iso-token-table ?.  'character)))
 
 
+;; replace the range "\240-\377" (see `ebnf-range-regexp').
+(defconst ebnf-iso-non-terminal-chars
+  (ebnf-range-regexp " 0-9A-Za-z_" ?\240 ?\377))
+
+
 (defun ebnf-iso-lex ()
   "Lexical analyser for ISO EBNF.
 
@@ -433,9 +441,9 @@ See documentation for variable `ebnf-iso-lex'."
        'integer)
        ;; special: ?special?
        ((eq token 'special)
-       (setq ebnf-iso-lex (concat "?"
+       (setq ebnf-iso-lex (concat (and ebnf-special-show-delimiter "?")
                                   (ebnf-string " ->@-~" ?\? "special")
-                                  "?"))
+                                  (and ebnf-special-show-delimiter "?")))
        'special)
        ;; terminal: "string"
        ((eq token 'double-terminal)
@@ -447,9 +455,10 @@ See documentation for variable `ebnf-iso-lex'."
        'terminal)
        ;; non-terminal
        ((eq token 'non-terminal)
-       (setq ebnf-iso-lex (ebnf-iso-normalize
-                           (ebnf-trim-right
-                            (ebnf-buffer-substring " 0-9A-Za-z\240-\377"))))
+       (setq ebnf-iso-lex
+             (ebnf-iso-normalize
+              (ebnf-trim-right
+               (ebnf-buffer-substring ebnf-iso-non-terminal-chars))))
        (and ebnf-no-meta-identifier
             (error "Exception sequence should not contain a meta identifier"))
        'non-terminal)
@@ -606,4 +615,5 @@ See documentation for variable `ebnf-iso-lex'."
 (provide 'ebnf-iso)
 
 
+;;; arch-tag: 03315eef-8f64-404a-bf9d-256d42442ee3
 ;;; ebnf-iso.el ends here