comparison lisp/progmodes/ebnf-bnf.el @ 54192:20bee085cbee

Doc fix.
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Sat, 28 Feb 2004 22:22:38 +0000
parents 766aaa5bded5
children fc6e53c00fcf
comparison
equal deleted inserted replaced
54191:9e9c096c2efc 54192:20bee085cbee
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
4 ;; Free Sofware Foundation, Inc. 4 ;; Free Sofware Foundation, Inc.
5 5
6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> 6 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> 7 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
8 ;; Time-stamp: <2004/02/22 14:25:06 vinicius> 8 ;; Time-stamp: <2004/02/28 18:25:52 vinicius>
9 ;; Keywords: wp, ebnf, PostScript 9 ;; Keywords: wp, ebnf, PostScript
10 ;; Version: 1.8 10 ;; Version: 1.8
11 11
12 ;; This file is part of GNU Emacs. 12 ;; This file is part of GNU Emacs.
13 13
52 ;; $?C? default special 52 ;; $?C? default special
53 ;; A = B. production (A is the header and B the body) 53 ;; A = B. production (A is the header and B the body)
54 ;; C D sequence (C occurs before D) 54 ;; C D sequence (C occurs before D)
55 ;; C | D alternative (C or D occurs) 55 ;; C | D alternative (C or D occurs)
56 ;; A - B exception (A excluding B, B without any non-terminal) 56 ;; A - B exception (A excluding B, B without any non-terminal)
57 ;; n * A repetition (A repeats n (integer) times) 57 ;; n * A repetition (A repeats at least n (integer) times)
58 ;; n * n A repetition (A repeats exactly n (integer) times)
59 ;; n * m A repetition (A repeats at least n (integer) and at most
60 ;; m (integer) times)
58 ;; (C) group (expression C is grouped together) 61 ;; (C) group (expression C is grouped together)
59 ;; [C] optional (C may or not occurs) 62 ;; [C] optional (C may or not occurs)
60 ;; C+ one or more occurrences of C 63 ;; C+ one or more occurrences of C
61 ;; {C}+ one or more occurrences of C 64 ;; {C}+ one or more occurrences of C
62 ;; {C}* zero or more occurrences of C 65 ;; {C}* zero or more occurrences of C
76 ;; 79 ;;
77 ;; sequence = {exception}*. ;; sequence 80 ;; sequence = {exception}*. ;; sequence
78 ;; 81 ;;
79 ;; exception = repeat [ "-" repeat]. ;; exception 82 ;; exception = repeat [ "-" repeat]. ;; exception
80 ;; 83 ;;
81 ;; repeat = [ integer "*" ] term. ;; repetition 84 ;; repeat = [ integer "*" [ integer ]] term. ;; repetition
82 ;; 85 ;;
83 ;; term = factor 86 ;; term = factor
84 ;; | [factor] "+" ;; one-or-more 87 ;; | [factor] "+" ;; one-or-more
85 ;; | [factor] "/" [factor] ;; one-or-more 88 ;; | [factor] "/" [factor] ;; one-or-more
86 ;; . 89 ;; .
94 ;; | "{" body [ "||" body ] "}*" ;; zero-or-more 97 ;; | "{" body [ "||" body ] "}*" ;; zero-or-more
95 ;; | "{" body [ "||" body ] "}" ;; zero-or-more 98 ;; | "{" body [ "||" body ] "}" ;; zero-or-more
96 ;; . 99 ;; .
97 ;; 100 ;;
98 ;; non_terminal = "[!#%&'*-,0-:<>@-Z\\\\^-z~\\240-\\377]+". 101 ;; non_terminal = "[!#%&'*-,0-:<>@-Z\\\\^-z~\\240-\\377]+".
102 ;; ;; that is, a valid non_terminal accepts decimal digits, letters (upper
103 ;; ;; and lower), 8-bit accentuated characters,
104 ;; ;; "!", "#", "%", "&", "'", "*", "+", ",", ":",
105 ;; ;; "<", ">", "@", "\", "^", "_", "`" and "~".
99 ;; 106 ;;
100 ;; terminal = "\\([^\"\\]\\|\\\\[ -~\\240-\\377]\\)+". 107 ;; terminal = "\\([^\"\\]\\|\\\\[ -~\\240-\\377]\\)+".
101 ;; 108 ;; ;; that is, a valid terminal accepts any printable character (including
102 ;; special = "[^?\\n\\000-\\010\\016-\\037\\177-\\237]*". 109 ;; ;; 8-bit accentuated characters) except `"', as `"' is used to delimit a
110 ;; ;; terminal. Also, accepts escaped characters, that is, a character
111 ;; ;; pair starting with `\' followed by a printable character, for
112 ;; ;; example: \", \\.
113 ;;
114 ;; special = "[^?\\000-\\010\\012-\\037\\177-\\237]*".
115 ;; ;; that is, a valid special accepts any printable character (including
116 ;; ;; 8-bit accentuated characters) and tabs except `?', as `?' is used to
117 ;; ;; delimit a special.
103 ;; 118 ;;
104 ;; integer = "[0-9]+". 119 ;; integer = "[0-9]+".
120 ;; ;; that is, an integer is a sequence of one or more decimal digits.
105 ;; 121 ;;
106 ;; comment = ";" "[^\\n\\000-\\010\\016-\\037\\177-\\237]*" "\\n". 122 ;; comment = ";" "[^\\n\\000-\\010\\016-\\037\\177-\\237]*" "\\n".
123 ;; ;; that is, a comment starts with the character `;' and terminates at end
124 ;; ;; of line. Also, it only accepts printable characters (including 8-bit
125 ;; ;; accentuated characters) and tabs.
107 ;; 126 ;;
108 ;; 127 ;;
109 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 128 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
110 129
111 ;;; Code: 130 ;;; Code:
232 (ebnf-no-non-terminal (car seq)) 251 (ebnf-no-non-terminal (car seq))
233 (setq seq (cdr seq))))) 252 (setq seq (cdr seq)))))
234 )))) 253 ))))
235 254
236 255
237 ;;; repeat = [ integer "*" ] term. 256 ;;; repeat = [ integer "*" [ integer ]] term.
238 257
239 (defun ebnf-repeat (token) 258 (defun ebnf-repeat (token)
240 (if (not (eq token 'integer)) 259 (if (not (eq token 'integer))
241 (ebnf-term token) 260 (ebnf-term token)
242 (let ((times ebnf-bnf-lex)) 261 (let ((times ebnf-bnf-lex)
262 upper)
243 (or (eq (ebnf-bnf-lex) 'repeat) 263 (or (eq (ebnf-bnf-lex) 'repeat)
244 (error "Missing `*'")) 264 (error "Missing `*'"))
245 (ebnf-token-repeat times (ebnf-term (ebnf-bnf-lex)))))) 265 (setq token (ebnf-bnf-lex))
266 (when (eq token 'integer)
267 (setq upper ebnf-bnf-lex
268 token (ebnf-bnf-lex)))
269 (ebnf-token-repeat times (ebnf-term token) upper))))
246 270
247 271
248 ;;; term = factor 272 ;;; term = factor
249 ;;; | [factor] "+" ;; one-or-more 273 ;;; | [factor] "+" ;; one-or-more
250 ;;; | [factor] "/" [factor] ;; one-or-more 274 ;;; | [factor] "/" [factor] ;; one-or-more