2 * ----------------------------------------------------------------------
11 #insert open_pxp_lex_aux_*.src
12 #insert pxp_lex_aux.src
16 #insert pxp_lex_defs_*.def
18 (* The remaining, smaller lexers *)
20 rule scan_characters = parse
26 { raise Netconversion.Malformed_code }
29 and scan_xml_pi = parse
31 { let s = Lexing.lexeme lexbuf in
32 let j = get_name_end s 0 in
33 Pro_name (String.sub s 0 j)
37 | "'" character_except_apos* "'" ws+
38 { let s = Lexing.lexeme lexbuf in
39 let j = String.index_from s 1 '\'' in
40 Pro_string (String.sub s 1 (j-1))
43 { raise (WF_error ("Cannot find the second quotation mark"))
45 | '"' character_except_quot* '"' ws+
46 { let s = Lexing.lexeme lexbuf in
47 let j = String.index_from s 1 '"' in
48 Pro_string (String.sub s 1 (j-1))
51 { raise (WF_error ("Cannot find the second quotation mark"))
56 { (* prerr_endline (Lexing.lexeme lexbuf); *)
57 raise (WF_error("Illegal token or character"))
60 { raise Netconversion.Malformed_code }
62 and scan_only_xml_decl = parse
63 "<?xml" ws+ pi_string "?>"
64 { scan_pi (Lexing.lexeme lexbuf) scan_xml_pi }
68 and scan_for_crlf = parse
76 { CharData (Lexing.lexeme lexbuf) }
80 and scan_content_comment = parse
82 { Comment_end, Content }
84 { raise (WF_error "Double hyphens are illegal inside comments") }
86 { Comment_material "-", Content_comment }
87 | character_except_minus+
88 { Comment_material(Lexing.lexeme lexbuf), Content_comment }
90 { Eof, Content_comment }
92 { raise Netconversion.Malformed_code }
95 (* In declarations, comments are always thrown away. *)
97 and scan_decl_comment = parse
99 { Comment_end, Declaration }
101 { raise (WF_error "Double hyphens are illegal inside comments") }
103 { Comment_material "", Decl_comment }
104 | character_except_minus+
105 { Comment_material "", Decl_comment }
107 { Eof, Decl_comment }
109 { raise Netconversion.Malformed_code }
112 and scan_document_comment = parse
114 { Comment_end, Document }
116 { raise (WF_error "Double hyphens are illegal inside comments") }
118 { Comment_material "-", Document_comment }
119 | character_except_minus+
120 { Comment_material(Lexing.lexeme lexbuf), Document_comment }
122 { Eof, Document_comment }
124 { raise Netconversion.Malformed_code }
126 (* ======================================================================
130 * Revision 1.1 2000/11/17 09:57:32 lpadovan
133 * Revision 1.4 2000/08/18 20:19:59 gerd
134 * Comments return different comment tokens.
136 * Revision 1.3 2000/08/14 22:18:34 gerd
137 * Bad_character_stream -> Netconversion.Malformed_code
139 * Revision 1.2 2000/05/29 23:53:12 gerd
140 * Updated because Markup_* modules have been renamed to Pxp_*.
142 * Revision 1.1 2000/05/20 20:33:25 gerd