X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/8a1e4eebeb0528ee7dcc9c95a9a685901db50bf5..fb1558445c2d42add2852e4dd26b79d69cf321c9:/lisp/progmodes/ebnf-iso.el diff --git a/lisp/progmodes/ebnf-iso.el b/lisp/progmodes/ebnf-iso.el index ede354c4f3..f36065bd55 100644 --- a/lisp/progmodes/ebnf-iso.el +++ b/lisp/progmodes/ebnf-iso.el @@ -1,12 +1,13 @@ ;;; ebnf-iso.el --- parser for ISO EBNF -;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +;; Free Software Foundation, Inc. -;; Author: Vinicius Jose Latorre -;; Maintainer: Vinicius Jose Latorre +;; Author: Vinicius Jose Latorre +;; Maintainer: Vinicius Jose Latorre +;; Time-stamp: <2004/04/03 16:48:52 vinicius> ;; Keywords: wp, ebnf, PostScript -;; Time-stamp: <2001/09/24 10:17:20 vinicius> -;; Version: 1.6 +;; Version: 1.8 ;; This file is part of GNU Emacs. @@ -112,7 +113,8 @@ ;; ISO EBNF accepts the characters given by 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 +;; (_). ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -127,11 +129,12 @@ "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.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Syntatic analyzer +;; Syntactic analyzer ;;; ISO EBNF = syntax rule, {syntax rule}; @@ -200,17 +203,9 @@ (eq token 'catenate)) (setq seq (cons term seq))) (cons token - (cond - ;; null sequence - ((null seq) - term) - ;; sequence with only one element - ((and (null term) (= (length seq) 1)) - (car seq)) - ;; a real sequence - (t - (ebnf-make-sequence (nreverse (cons term seq)))) - )))) + (ebnf-token-sequence (if term + (cons term seq) + seq))))) ;;; term = factor, ['-', exception]; @@ -345,6 +340,7 @@ ;; 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) @@ -389,7 +385,7 @@ ;; replace the range "\240-\377" (see `ebnf-range-regexp'). (defconst ebnf-iso-non-terminal-chars - (ebnf-range-regexp " 0-9A-Za-z" ?\240 ?\377)) + (ebnf-range-regexp " 0-9A-Za-z_" ?\240 ?\377)) (defun ebnf-iso-lex () @@ -438,9 +434,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) @@ -612,4 +608,5 @@ See documentation for variable `ebnf-iso-lex'." (provide 'ebnf-iso) +;;; arch-tag: 03315eef-8f64-404a-bf9d-256d42442ee3 ;;; ebnf-iso.el ends here