Debian Codegraph @

psgml-api.texi

raw ◀ ▶
1 Debian patch touch this file
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename psgml-api.info
4 @settitle psgml-api
5 @c @setchapternewpage odd
6 @c %**end of header
7 @c $Id: psgml-api.texi,v 1.2 1999/12/03 17:29:39 lenst Exp $
8
9 @ifinfo
•10 @dircategory Emacs editing modes
11 @format
12 START-INFO-DIR-ENTRY
13 * PSGML-API: (psgml-api). PSGML, the API documentation.
14 END-INFO-DIR-ENTRY
15 @end format
16 @end ifinfo
17
18 @ifinfo
19 Documentation for PSGML, a major mode for SGML.
20
21 Copyright 1994 Lennart Staflin
22
23 Permission is granted to make and distribute verbatim
24 copies of this manual provided the copyright notice and
25 this permission notice are preserved on all copies.
26
27 @ignore
28 Permission is granted to process this file through TeX
29 and print the results, provided the printed document
30 carries a copying permission notice identical to this
31 one except for the removal of this paragraph (this
32 paragraph not being relevant to the printed manual).
33
34 @end ignore
35 Permission is granted to copy and distribute modified
36 versions of this manual under the conditions for
37 verbatim copying, and provided that the entire
38 resulting derived work is distributed under the terms
39 of a permission notice identical to this one.
40
41 Permission is granted to copy and distribute
42 translations of this manual into another language,
43 under the above conditions for modified versions,
44 except that this permission notice may be stated in a
45 translation approved by the Free Software Foundation.
46
47 @end ifinfo
48
49 @titlepage
50
51 @title Internals of PSGML
52 @author Lennart Staflin
53
54 @c The following two commands
55 @c start the copyright page.
56 @page
57 @vskip 0pt plus 1filll
58 Copyright @copyright{} 1994 Lennart Staflin
59
60 @c Published by ...
61
62 Permission is granted to make and distribute verbatim
63 copies of this manual provided the copyright notice and
64 this permission notice are preserved on all copies.
65
66 @ignore
67 Permission is granted to process this file through TeX
68 and print the results, provided the printed document
69 carries a copying permission notice identical to this
70 one except for the removal of this paragraph (this
71 paragraph not being relevant to the printed manual).
72
73 @end ignore
74 Permission is granted to copy and distribute modified
75 versions of this manual under the conditions for
76 verbatim copying, and provided that the entire
77 resulting derived work is distributed under the terms
78 of a permission notice identical to this one.
79
80 Permission is granted to copy and distribute
81 translations of this manual into another language,
82 under the above conditions for modified versions,
83 except that this permission notice may be stated in a
84 translation approved by the Free Software Foundation.
85 @end titlepage
86
87 @node Top, Types, (dir), (dir)
88 @comment node-name, next, previous, up
89 @ifinfo
90 @top PSGML Internals
91 @end ifinfo
92
93 @menu
94 * Types:: Types and operations
95 * Hooks:: Hooks
96 * Implementation:: Implementation notes
97 * Index:: Index
98
99 --- The Detailed Node Listing ---
100
101 Types and operations
102
103 * element:: The element structure
104 * attribute:: Attribute Types
105 * parser state:: Parser state
106 * DTD:: DTD
107 * entities:: Entities
108 @end menu
109
110 @node Types, Hooks, Top, Top
111 @comment node-name, next, previous, up
112 @chapter Types and operations
113
114 NOTE:
115 Names of element types, attributes and entities should be treated as far
116 as possible as a real type. In versions prior to 1.0 names are
117 represented by lisp symbols but in 1.0 they are strings.
118
119 Perhaps I should make a @file{psgml-api.el} that defines some functions
120 to deal with names. Then it would be possible to write code that works
121 in both 0.4 and 1.0.
122
123
124 @menu
125 * element:: The element structure
126 * attribute:: Attribute Types
127 * parser state:: Parser state
128 * DTD:: DTD
129 * entities:: Entities
130 @end menu
131
132 @node element, attribute, Types, Types
133 @comment node-name, next, previous, up
134 @section The element structure
135
136 @deftp {Data type} element
137 The basic data type representing the element structure is the Element (this
138 happens to be a node in the parse tree).
139 @end deftp
140
141
142 @subsection Mapping buffer positions to elements
143
144 @defun sgml-find-context-of pos
145 Return the element current at buffer position @var{pos}. If @var{pos}
146 is in markup, @code{sgml-markup-type} will be a symbol identifying the
147 markup type. It will be @code{nil} if @var{pos} is outside markup.
148 @end defun
149
150 @defun sgml-find-element-of pos
151 Return the element containing the character at buffer position @var{pos}.
152 @end defun
153
154
155 @subsection Functions operating on elements
156
157 @defun sgml-element-name element
158 Returns the name of the element. (obsolete)
159 @end defun
160
161 @defun sgml-element-gi element
162 Return the general identifier (string) of @var{element}.
163 @end defun
164
165 @defun sgml-element-level element
166 Returns the level of @var{element} in the element structure. The
167 document element is level 1.
168 @end defun
169
170 @subsubsection Structure
171
172 @defun sgml-top-element
173 Return the document element.
174 @end defun
175
176 @defun sgml-off-top-p element
177 True if @var{element} is the pseudo element above the document element.
178 @end defun
179
180 These functions return other related elements, or possibly @code{nil}.
181
182 @defun sgml-element-content element
183 First element in content of @var{element}, or nil.
184 @end defun
185
186 @defun sgml-element-next element
187 Next sibling of @var{element}. To loop thru all sub elements of an
188 element, @code{el}, You could do like this:
189
190 @lisp
191 (let ((c (sgml-element-content el)))
192 (while c
193 <<Do something with c>>
194 (setq c (sgml-element-next c))))
195 @end lisp
196 @end defun
197
198 @defun sgml-element-parent element
199 Parent of @var{element}.
200 @end defun
201
202
203 @subsubsection Tags
204
205 @defun sgml-element-stag-optional element
206 Return true if the start-tag of @var{element} is omissible.
207 @end defun
208
209 @defun sgml-element-etag-optional element
210 Return true if the end-tag of @var{element} is omissible.
211 @end defun
212
213 @defun sgml-element-stag-len element
214 Return the length of the start-tag of @var{element}. If the start-tag
215 has been omitted the length is 0.
216 @end defun
217
218 @defun sgml-element-etag-len element
219 Return the length of the end-tag of @var{element}. If the end-tag
220 has been omitted the length is 0.
221 @end defun
222
223 @defun sgml-element-net-enabled element
224 Return true, if @var{element} or some parent of the element has null end
225 tag (NET) enabled. Return @code{t}, if it is @var{element} that has NET
226 enabled.
227 @end defun
228
229
230 @subsubsection Positions
231
232 These functions relates an element to positions in the buffer.
233
234 @defun sgml-element-start element
235 Position of start of @var{element}.
236 @end defun
237
238 @defun sgml-element-end element
239 Position after @var{element}.
240 @end defun
241
242 @defun sgml-element-stag-end element
243 Position after start-tag of @var{element}.
244 @end defun
245
246 @defun sgml-element-etag-start element
247 Position before end-tag of @var{element}.
248 @end defun
249
250
251 @subsubsection Attributes
252
253 @defun sgml-element-attlist element
254 Return the attribute declaration list for @var{element}.
255 @end defun
256
257 @defun sgml-element-attribute-specification-list element
258 Return the attribute specification list for @var{element}.
259 @end defun
260
261 @defun sgml-element-attval element attribute
262 Return the value of the @var{attribute} in @var{element}, string or nil.
263 @end defun
264
265
266 @subsubsection Misc technical
267
268
269 @defun sgml-element-data-p element
270 True if @var{element} can contain data characters.
271 @end defun
272
273 @defun sgml-element-mixed element
274 True if @var{element} has mixed content.
275 @end defun
276
277 @defun sgml-element-eltype element
278 @end defun
279
280 @defun sgml-element-empty element
281 True if @var{element} is empty.
282 @end defun
283
284 @defun sgml-element-excludes element
285 @end defun
286
287 @defun sgml-element-includes element
288 @end defun
289
290 @defun sgml-element-model element
291 Declared content or content model of @var{element}.
292 @end defun
293
294 @defun sgml-element-context-string element
295 Return string describing context of @var{element}.
296 @end defun
297
298 @c ----------------------------------------------------------------------
299 @node attribute, parser state, element, Types
300 @comment node-name, next, previous, up
301 @section Attribute Types
302
303 Basic types for attributes are names and values. (See note about names
304 in @ref{Types}.) And attribute values (attval) by lisp strings.
305
306
307 @subsection Attribute Declaration List Type
308
309 @deftp {Data type} attlist attdecl*
310 This is the result of the ATTLIST declarations in the DTD.
311 All attribute declarations for an element is the elements
312 attlist.
313 @end deftp
314
315 @defun sgml-lookup-attdecl name attlist
316 Return attribute declaration (attdecl) for attribute @var{name} in
317 attribute declaration list @var{attlist}.
318 @end defun
319
320 @defun sgml-attribute-with-declared-value attlist declared-value
321 Find the first attribute in @var{attlist} that has @var{declared-value}.
322 @end defun
323
324
325 @subsection Attribute Declaration Type
326
327 @deftp {Data type} attdecl name declared-value default-value
328 This is the representation of an individual attribute declaration
329 contained in an ATTLIST declaration.
330 @end deftp
331
332 @defun sgml-make-attdecl name declared-value default-value
333 Produces an attdecl.
334 @end defun
335
336 @defun sgml-attdecl-name attdecl
337 Returns the name of an attribute declaration.
338 @end defun
339
340 @defun sgml-attdecl-declared-value attdecl
341 Returns the declared-value of attribute declaration @var{attdecl}.
342 @end defun
343
344 @defun sgml-attdecl-default-value: attdecl
345 Returns the default-value of attribute declaration @var{attdecl}.
346 @end defun
347
348
349 @subsection Declared Value Type
350
351 @deftp {Data type} declared-value (token-group | notation | simple)
352 A declared value of an SGML attribute can be of different kinds. If the
353 declared value is a token group there is an associated list of name
354 tokens. For notation there is also a list of associated names, the
355 allowed notation names. The other declared values are represented by the
356 type name as a lisp symbol.
357 @c token-group = nametoken+
358 @c notation = nametoken+
359 @c simple = symbol
360 @end deftp
361
362 @defun sgml-declared-value-token-group declared-value
363 Return the name token group for the @var{declared-value}.
364 This applies to name token groups. For other declared values nil is
365 returned.
366 @end defun
367
368 @defun sgml-declared-value-notation declared-value
369 Return the list of notation names for the @var{declared-value}.
370 This applies to notation declared value. For other declared values
371 nil is returned.
372 @end defun
373
374
375 @subsection Default Value Type
376
377 @deftp {Data type} default-value (required | implied | conref | specified )
378 @c implied, conref = constant symbol
379 @c specified = (fixed | normal)
380 @c fixed, normal = attval
381 There are several kinds of default values. The @var{required},
382 @var{implied}, and @var{conref} has no associated information. The
383 @var{specified} have an associated attribute value and can be either
384 @code{fixed} or @code{normal}.
385 @end deftp
386
387 @defun sgml-make-default-value type &optional attval
388 @end defun
389
390 @defun sgml-default-value-attval default-value
391 Return the actual default value of the declared @var{default-value}.
392 The actual value is a string. Return @code{nil} if no actual value.
393 @end defun
394
395 @defun sgml-default-value-type-p type default-value
396 Return true if @var{default-value} is of @var{type}. Where @var{type}
397 is a symbol, one of @code{required}, @code{implied}, @code{conref}, or
398 @code{fixed}.
399 @end defun
400
401
402 @subsection Attribute Specification Type
403
404 @deftp {Data type} attspec name attval
405 This is the result of parsing an attribute specification.
406 @end deftp
407
408 @defun sgml-make-attspec name attval
409 Create an attspec from @var{name} and @var{attval}.
410 Special case, if @var{attval} is @code{nil} this is an implied attribute.
411 @end defun
412
413 @defun sgml-attspec-name attspec
414 Return the name of the attribute specified by @var{attspec}.
415 @end defun
416
417 @defun sgml-attspec-attval attspec
418 Return the value (attval) of attribute specification @var{attspec}.
419 If @var{attspec} is @code{nil}, @code{nil} is returned.
420 @end defun
421
422
423 @subsection Attribute Specification List Type
424
425 @deftp {Data type} asl attspec*
426 This is the result of parsing an attribute specification list.
427 @end deftp
428
429 @defun sgml-lookup-attspec name asl
430 Return the attribute specification for attribute with @var{name} in the
431 attribute specification list @var{asl}. If the attribute is unspecified
432 @code{nil} is returned.
433 @end defun
434
435
436
437 @c ------------------------------------------------------------------
438 @node parser state, DTD, attribute, Types
439 @comment node-name, next, previous, up
440 @section Parser state
441
442 The state of the parser that needs to be kept between commands are
443 stored in a buffer local variable. Some global variables are
444 initialised from this variable when parsing starts.
445
446 @defvar sgml-buffer-parse-state
447 The state of the parser that is kept between commands. The value of
448 this variable is of type pstate.
449 @end defvar
450
451 @deftp {Data type} pstate
452 The parser state.
453 @end deftp
454
455 @defun sgml-pstate-dtd pstate
456 The document type information (dtd) for the parser.
457 @end defun
458
459
460 @c ------------------------------------------------------------------
461 @node DTD, entities, parser state, Types
462 @comment node-name, next, previous, up
463 @section DTD
464
465 @deftp {Data type} dtd
466 Represents what PSGML knows about the DTD.
467 @end deftp
468
469 @defun sgml-dtd-doctype dtd
470 The document type name.
471 @end defun
472
473 @defun sgml-dtd-eltypes dtd
474 The table of element types.
475 @end defun
476
477 @defun sgml-dtd-entities dtd
478 The table of declared general entities (entity-table).
479 @end defun
480
481 @defun sgml-dtd-parameters dtd
482 The table of declared parameter entities (entity-table).
483 @end defun
484
485 @defun sgml-dtd-shortmaps dtd
486 The list of short reference maps.
487 @end defun
488
489 @defun sgml-dtd-notations dtd
490 Not yet implemented.
491 @end defun
492
493
494
495 @c ------------------------------------------------------------------
496 @node entities, , DTD, Types
497 @comment node-name, next, previous, up
498 @section Entities
499
500 @deftp {Data type} entity
501 An entity has the following properties:
502
503 @table @var
504 @item name
505 The name of the entity (a string). This is either the name of a
506 declared entity (general or parameter) or the doctype name if it is the
507 implicit entity referred to by the doctype declaration.
508
509 @item type
510 This is a symbol. It is @code{text} if it is a text entity, other
511 values are @code{cdata}, @code{ndata}, @code{sdata}, @code{sgml} or
512 @code{dtd}.
513
514 @item text
515 This is the text of the entity, either a string or an external
516 identifier.
517 @end table
518 @end deftp
519
520 Operations on entities
521
522 @defun sgml-make-entity name type text
523 Create an entity.
524 @end defun
525
526 @defun sgml-entity-name entity
527 The name of the entity.
528 @end defun
529
530 @defun sgml-entity-type entity
531 The type of the entity.
532 @end defun
533
534 @defun sgml-entity-text entity
535 The text of the entity.
536 @end defun
537
538 @defun sgml-entity-insert-text entity
539 Insert the text of the entity into the current buffer at point.
540 @end defun
541
542 @defun sgml-entity-data-p entity
543 True if @var{entity} is a data entity, that is not of type @code{text}.
544 @end defun
545
546
547 @deftp {Data type} entity-table
548 A table of entities that can be referenced by entity name.
549 @end deftp
550
551 @defun sgml-lookup-entity name entity-table
552 The entity with named @var{name} in the table @var{entity-table}. If no
553 such entity exists, @code{nil} is returned.
554 @end defun
555
556 @defun sgml-entity-declare name entity-table type text
557 Create an entity from @var{name}, @var{type} and @var{text}; and enter
558 the entity into the table @var{entity-table}.
559 @end defun
560
561 @defun sgml-entity-completion-table entity-table
562 Make a completion table from the @var{entity-table}.
563 @end defun
564
565 @defun sgml-map-entities fn entity-table &optional collect
566 Apply the function @var{fn} to all entities in @var{entity-table}. If
567 @var{collect} is @code{t}, the results of the applications are collected
568 in a list and returned.
569 @end defun
570
571
572
573 @c ------------------------------------------------------------------
574 @node Hooks, Implementation, Types, Top
575 @comment node-name, next, previous, up
576 @chapter Hooks
577
578 @defvar sgml-open-element-hook
579 The hook run by @code{sgml-open-element}.
580 Theses functions are called with two arguments, the first argument is
581 the opened element and the second argument is the attribute specification
582 list. It is probably best not to refer to the content or the end-tag of
583 the element.
584 @end defvar
585
586 @defvar sgml-close-element-hook
587 The hook run by @code{sgml-close-element}. These functions are invoked
588 with @code{sgml-current-tree} bound to the element just parsed.
589 @end defvar
590
591 @defvar sgml-doctype-parsed-hook
592 This hook is called after the doctype has been parsed.
593 It can be used to load any additional information into the DTD structure.
594 @end defvar
595
596 @defvar sgml-sysid-resolve-functions
597 This variable should contain a list of functions.
598 Each function should take one argument, the system identifier of an entity.
599 If the function can handle that identifier, it should insert the text
600 of the entity into the current buffer at point and return t. If the
601 system identifier is not handled the function should return nil.
602 @end defvar
603
604 @defvar sgml-doctype-parsed-hook
605 This hook is caled after the doctype has been parsed.
606 It can be used to load any additional information into the DTD structure.
607 @end defvar
608
609 @defvar sgml-close-element-hook
610 @c ***
611 The hook run by `sgml-close-element'.
612 These functions are invoked with `sgml-current-tree' bound to the
613 element just parsed.
614 @end defvar
615
616 *** sgml-new-attribute-list-function
617 This hook is run when a new element is inserted to construct the
618 attribute specification list. The default function prompts for the
619 required attributes.
620
621
622 @c ------------------------------------------------------------------
623 @node Implementation, Index, Hooks, Top
624 @comment node-name, next, previous, up
625 @chapter Implementation notes
626
627 @section Data Types and Operations
628
629 @subsection Element Type
630
631 @deftp {Data type} eltype
632 Data type representing the information about an element type. An
633 @code{eltype} has information from @samp{ELEMENT} and @samp{ATTLIST}
634 declarations. It can also store data for the application.
635 @end deftp
636
637 The element types are symbols in a special oblist. The oblist is the
638 table of element types. The symbols name is the GI, its value is used
639 to store three flags and the function definition holds the content
640 model. Other information about the element type is stored on the
641 property list.
642
643 @defun sgml-eltype-name et
644 The name (a string) of the element type @var{et}.
645 @end defun
646
647 @defun sgml-eltype-appdata et prop
648 Get application data from element type @var{et} with name @var{prop}.
649 @var{prop} should be a symbol, reserved names are: flags, model, attlist,
650 includes, excludes, conref-regexp, mixed, stag-optional, etag-optional.
651
652 This function can be used as a place in @code{setf}, @code{push} and
653 other functions from the CL library.
654 @end defun
655
656 @defun sgml-eltype-all-miscdata eltype
657 A list of all data properties for eltype except for flags, model,
658 includes and excludes. This function filters the property list of
659 @var{eltype}. Used when saving the parsed DTD.
660 @end defun
661
662 @defun sgml-eltype-set-all-miscdata eltype miscdata
663 Append the @var{miscdata} data properties to the properties of
664 @var{eltype}.
665 @end defun
666
667 @defun sgml-eltype-attlist et
668 The attribute specification list for the element type @var{et}.
669 @end defun
670
671 @defun sgml-eltype-completion-table eltypes
672 Make a completion table from a list, @var{eltypes}, of element types.
673 @end defun
674
675 @defun sgml-eltype-stag-optional et
676 True if the element type @var{et} has optional start-tag.
677 @end defun
678
679 @defun sgml-eltype-etag-optional et
680 True if the element type @var{et} has optional end-tag.
681 @end defun
682
683 @defun sgml-eltype-excludes et
684 The list of excluded element types for element type @var{et}.
685 @end defun
686
687 @defun sgml-eltype-includes et
688 The list of included element types for element type @var{et}.
689 @end defun
690
691 @defun sgml-eltype-flags et
692 Contains three flags as a number. The flags are stag-optional,
693 etag-optional and mixed.
694 @end defun
695
696 @defun sgml-eltype-mixed et
697 True if element type @var{et} has mixed content.
698 @end defun
699
700 @defun sgml-eltype-model et
701 The content model of element type @var{et}. The content model is either
702 the start state in the DFA for the content model or a symbol identifying
703 a declared content.
704 @end defun
705
706 @defun sgml-eltype-shortmap et
707 The name of the shortmap associated with element type @var{et}. This
708 can also be the symbol @code{empty} (if declared with a @samp{<!USEMAP
709 gi #EMPTY>} or @code{nil} (if no associated map).
710 @end defun
711
712
713 @defun sgml-eltype-token et
714 Return a token for the element type @var{et}.
715 @end defun
716
717 @defun sgml-eltypes-in-state state tree
718 List of element types valid in @var{state} and @var{tree}.
719 @end defun
720
721
722 @subsection DTD
723
724 The DTD data type is realised as a lisp vector using @code{defstruct}.
725
726 There are two additional fields for internal use: dependencies and
727 merged.
728
729 @defun sgml-dtd-dependencies dtd
730 The list of files used to create this DTD.
731 @end defun
732
733 @defun sgml-dtd-merged dtd
734 The pair (@var{file} . @var{merged-dtd}), if the DTD has had a
735 precompiled dtd merged into it. @var{File} is the file containing the
736 compiled DTD and @var{merged-dtd} is the DTD loaded from that file.
737 @end defun
738
739
740 @subsection Element and Tree
741
742 @deftp {Data Type} tree
743 This is the data type for the nodes in the tree build by the parser.
744 @end deftp
745
746 The tree nodes are represented as lisp vectors, using @code{defstruct}
747 to define basic operations.
748
749 The Element data type is a view of the tree built by the parser.
750
751
752 @section Parsing model
753
754 PSGML uses finite state machines and a stack to parse SGML. Every
755 element type has an associated DFA (deterministic finite automaton).
756 This DFA is constructed from the content model.
757
758 SGML restricts the allowed content models in such a way that it is
759 easy to directly construct a DFA.
760
761 To be able to determine when a start-tag can be omitted the DFA need to
762 contain some more information than the traditional DFA. In PSGML a DFA
763 has a set of states and two sets of edges. The edges are associated
764 with tokens (corresponding to SGML's primitive content tokens). I call
765 these moves. One set of moves, the @dfn{optional moves}, represents
766 optional tokens. I call the other set @dfn{required moves}. The
767 correspondence to SGML definitions are: if there is precisely one
768 required move from one state, then the associated token is required.
769 A state is final if there is not required move from that state.
770
771 The SGML construct @samp{(...&...&...)} (@dfn{AND-group}) is another
772 problem. There is a simple translation to sequence- and or-connectors.
773 For example @samp{(a & b & c)} is can be translated to:
774
775 @example
776 ((a, ((c, b) | (b, c))) |
777 (b, ((a, c) | (c, a))) |
778 (c, ((a, b) | (b, a))) )
779 @end example
780
781 But this grows too fast to be of direct practical use. PSGML represents
782 an AND-group with one DFA for every (SGML) token in the group. During
783 parsing of an AND-group there is a pointer to a state in one of the
784 group's DFAs, and a list of the DFAs for the tokens not yet satisfied.
785 Most of this is hidden by the primitives for the state type. The parser
786 only sees states in a DFA and moves.
787
788
789 @section Entity manager
790
791 @defun sgml-push-to-entity entity &optional ref-start type
792 Set current buffer to a buffer containing the entity @var{entity}.
793 @var{entity} can also be a file name. Optional argument @var{ref-start}
794 should be the start point of the entity reference. Optional argument
795 @var{type}, overrides the entity type in entity look up.
796 @end defun
797
798
799 @defun sgml-pop-entity
800 Should be called after a @code{sgml-push-to-entity} (or similar).
801 Restore the current buffer to the buffer that was current when the push
802 to this buffer was made.
803 @end defun
804
805 @defun sgml-push-to-string string
806 Create an entity from @var{string} and push it on the top of the entity
807 stack. After this the current buffer will be a scratch buffer containing
808 the text of the new entity with point at the first character.
809
810 Use @code{sgml-pop-entity} to exit from this buffer.
811 @end defun
812
813
814 @c @section Lexical
815
816 @section Parser functions
817
818 @defun sgml-need-dtd
819 This makes sure that the buffer has a DTD and set global variables
820 needed by parsing routines. One global variable is @code{sgml-dtd-info}
821 which contain the DTD (type dtd).
822 @end defun
823
824
825 @defun sgml-parse-to goal &optional extra-cond quiet
826 This is the low level interface to the parser.
827
828 Parse until (at least) @var{goal}, a buffer position. Optional argument
829 @var{extra-cond} should be a function. This function is called in the
830 parser loop, and the loop is exited if the function returns t. If third
831 argument @var{quit} is non-@code{nil}, no "@samp{Parsing...}" message
832 will be displayed.
833 @end defun
834
835
836 @defun sgml-reparse-buffer shortref-fun
837 Reparse the buffer and let @var{shortref-fun} take care of short
838 references. @var{shortref-fun} is called with the entity as
839 argument and @code{sgml-markup-start} pointing to start of short
840 reference and point pointing to the end.
841 @end defun
842
843
844 @section Saved DTD Format
845 @format
846 File = Comment,
847 File version,
848 S-expression --dependencies--,
849 Parameter entites,
850 Document type name,
851 Elements,
852 General entities,
853 S-expression --shortref maps--,
854 S-expression --notations--
855
856 Elements = Counted Sequence of S-expression --element type name--,
857 Counted Sequence of Element type description
858
859 File version = "(sgml-saved-dtd-version 5)
860 "
861
862 Comment = (";",
863 (CASE
864 OF [0-9]
865 OF [11-255])*,
866 [10] --end of line marker--)*
867
868 Element type description = S-expression --Misc info--,
869 CASE
870 OF [0-7] --Flags 1:stag-opt, 2:etag-opt, 4:mixed--,
871 Content specification,
872 Token list --includes--,
873 Token list --excludes--
874 OF [128] --Flag undefined element--
875
876 Content specification = CASE
877 OF [0] --cdata--
878 OF [1] --rcdata--
879 OF [2] --empty--
880 OF [3] --any--
881 OF [4] --undefined--
882 OF [128] --model follows--,
883 Model --nodes in the finite state automaton--
884
885 Model = Counted Sequence of Node
886
887 Node = CASE
888 OF Normal State
889 OF And Node
890
891 Normal State = Moves --moves for optional tokens--,
892 Moves --moves for required tokens--
893
894 Moves = Counted Sequence of (Token,
895 OCTET --state #--)
896
897 And Node = [255] --signals an AND node--,
898 Number --next state (node number)--,
899 Counted Sequence of Model --set of models--
900
901 Token = Number --index in list of elements--
902
903 Number = CASE
904 OF [0-250] --Small number 0--250--
905 OF [251-255] --Big number, first octet--,
906 OCTET --Big number, second octet--
907
908 Token list = Counted Sequence of Token
909
910 Parameter entites = S-expression --internal representation of parameter entities--
911
912 General entities = S-expression --internal representation of general entities--
913
914 Document type name = S-expression --name of document type as a string--
915
916 S-expression = OTHER
917
918 Counted Sequence = Number_a --length of sequence--,
919 (ARG_1)^a
920
921
922 @end format
923
924
925
926 @c ------------------------------------------------------------------
927 @node Index, , Implementation, Top
928 @comment node-name, next, previous, up
929 @chapter Index
930
931 Types
932 @printindex tp
933
934 @bye