]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/pxp/pxp/lexers/pxp_lex_content_string.src
Initial revision
[helm.git] / helm / DEVEL / pxp / pxp / lexers / pxp_lex_content_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
18 (* This lexer is used to expand and normalize attribute values: *)
19
20 rule scan_content_string = parse
21     '&' name ';'
22       { let s = Lexing.lexeme lexbuf in
23         ERef (String.sub s 1 (String.length s - 2)) }
24   | "&#" ascii_digit+ ";"
25       { let s = Lexing.lexeme lexbuf in
26         CRef (int_of_string (String.sub s 2 (String.length s - 3))) }
27   | "&#x" ascii_hexdigit+ ";"
28       { let s = Lexing.lexeme lexbuf in
29         CRef (int_of_string ("0x" ^ String.sub s 3 (String.length s - 4))) }
30   | '&'
31       { raise(WF_error("The character '&' must be written as '&'")) }
32   | printable_character_except_amp_lt+
33       { CharData (Lexing.lexeme lexbuf) }
34   | '\009'
35       { CRef 32 }
36   | '\013' '\010'
37       { CRef(-1)   (* A special case *)
38       }
39   | '\013'
40       { CRef 32 }
41   | '\010'
42       { CRef 32 }
43   | '<'
44       { 
45         (* Depending on the situation, '<' may be legal or not: *)
46         CharData "<" 
47       }
48   | eof
49       { Eof }
50   | _
51       { raise Netconversion.Malformed_code }
52
53
54 (* ======================================================================
55  * History:
56  * 
57  * $Log$
58  * Revision 1.1  2000/11/17 09:57:32  lpadovan
59  * Initial revision
60  *
61  * Revision 1.3  2000/08/14 22:18:34  gerd
62  *      Bad_character_stream -> Netconversion.Malformed_code
63  *
64  * Revision 1.2  2000/05/29 23:53:12  gerd
65  *      Updated because Markup_* modules have been renamed to Pxp_*.
66  *
67  * Revision 1.1  2000/05/20 20:33:25  gerd
68  *      Initial revision.
69  *
70  * 
71  *)