]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/pxp/pxp/lexers/pxp_lex_dtd_string.src
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / DEVEL / pxp / pxp / lexers / pxp_lex_dtd_string.src
1 (* $Id$
2  * ----------------------------------------------------------------------
3  *
4  *)
5
6
7 {
8   open Pxp_types
9   open Pxp_lexer_types
10
11 #insert open_pxp_lex_aux_*.src
12 #insert pxp_lex_aux.src
13
14 }
15
16 #insert pxp_lex_defs_*.def
17 (* The following scanner is used to determine the replacement text of
18  * internal entities:
19  *)
20
21 rule scan_dtd_string = parse
22     '%' name ';'
23       { let s = Lexing.lexeme lexbuf in
24         PERef (String.sub s 1 (String.length s - 2)) }
25   | '%'
26       { raise(WF_error("The character '%' must be written as '%'")) }
27   | '&' name ';'
28       { let s = Lexing.lexeme lexbuf in
29         ERef (String.sub s 1 (String.length s - 2)) }
30   | "&#" ascii_digit+ ";"
31       { let s = Lexing.lexeme lexbuf in
32         CRef (int_of_string (String.sub s 2 (String.length s - 3))) }
33   | "&#x" ascii_hexdigit+ ";"
34       { let s = Lexing.lexeme lexbuf in
35         CRef (int_of_string ("0x" ^ String.sub s 3 (String.length s - 4))) }
36   | '&'
37       { raise(WF_error("The character '&' must be written as '&'")) }
38   | '\013' '\010'
39       { CRef(-1) }
40   | '\013'
41       { CRef(-2) }
42   | '\010'
43       { CRef(-3) }
44   | '\009'
45       { CharData "\009" }
46   | printable_character_except_amp_percent+
47       { CharData (Lexing.lexeme lexbuf) }
48   | eof
49       { Eof }
50   | _
51       { raise Netconversion.Malformed_code }
52
53 (* ======================================================================
54  * History:
55  * 
56  * $Log$
57  * Revision 1.1  2000/11/17 09:57:32  lpadovan
58  * Initial revision
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  *)