]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/pxp/pxp/lexers/pxp_lex_document.src
Initial revision
[helm.git] / helm / DEVEL / pxp / pxp / lexers / pxp_lex_document.src
1 (* $Id$
2  * ----------------------------------------------------------------------
3  *
4  *)
5
6
7 {
8   open Pxp_types
9   open Pxp_lexer_types
10
11 #insert pxp_lex_aux.src
12
13 #insert open_pxp_lex_aux_*.src
14 #insert open_pxp_lex_misc_*.src
15
16 }
17
18 #insert pxp_lex_defs_*.def
19
20
21 (* scan_document: Lexer for the outermost structures *)
22
23 rule scan_document = parse
24     "<?" pi_string "?>"
25       { scan_pi (Lexing.lexeme lexbuf) scan_xml_pi, Document }
26   | "<?"
27       { raise (WF_error ("Illegal processing instruction")) }
28   | "<!DOCTYPE"
29       { tok_Doctype__Document_type }
30   | "<!--" 
31       { Comment_begin, Document_comment }
32   | "<!"
33       { raise (WF_error "Declaration either malformed or not allowed in this context") 
34       }
35   | "<" name
36       { let s = Lexing.lexeme lexbuf in
37         Tag_beg (String.sub s 1 (String.length s - 1), dummy_entity), Within_tag
38       }
39   | '<'
40       { raise (WF_error ("Illegal token")) }
41   | ws+
42       { tok_Ignore__Document }
43   | eof
44       { tok_Eof__Document }
45   | character
46       { raise (WF_error ("Content not allowed here")) }
47   | _
48       { raise Netconversion.Malformed_code }
49
50 (* ======================================================================
51  * History:
52  * 
53  * $Log$
54  * Revision 1.1  2000/11/17 09:57:32  lpadovan
55  * Initial revision
56  *
57  * Revision 1.4  2000/08/18 20:19:59  gerd
58  *      Comments return different comment tokens.
59  *
60  * Revision 1.3  2000/08/14 22:18:34  gerd
61  *      Bad_character_stream -> Netconversion.Malformed_code
62  *
63  * Revision 1.2  2000/05/29 23:53:12  gerd
64  *      Updated because Markup_* modules have been renamed to Pxp_*.
65  *
66  * Revision 1.1  2000/05/20 20:33:25  gerd
67  *      Initial revision.
68  *
69  * 
70  *)