#include "xml.h"
/*
-group: 0=data 1=whitespace 2='"' 3='<' 4='>' 5='&' 6=';' 7='?' 8='/' 9='=' 10=EOF
+group: 0=data 1=whitespace 2='"' 3='<' 4='>' 5='&' 6=';' 7='?' 8='/' 9='=' 10='!' 11=EOF
*/
static int group[256] =
{
// 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
// \t \n \r
- 10, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
+ 13, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
// 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
//
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
// ! " # $ % & ' ( ) * + , - . /
- 1, 0, 2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 8,
+ 1,10, 2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 8,
// 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
// 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 9, 4, 7,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
// P Q R S T U V W X Y Z [ \ ] ^ _
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11, 0,12, 0, 0,
// 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
// ` a b c d e f g h i j k l m n o
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static int new_state[][16]=
-{ /* dt ws " < > & ; ? / = EOB*/
- /* 0 */{ E1, 0,E1, 1,E1,E1,E1,E1,E1,E1,-63}, // .<
- /* 1 */{ E1,E1,E1,E1,E1,E1,E1, 9,E1,E1,-63}, // <.?
- /* 2 */{ -3, 2,E3,E2,E2,E2,E2,E2,12,E2,-63}, // <.
- /* 3 */{ E3,E3,E3,E3,-1,E3,E3,E3,E3,E1,-63}, // < /.>
- /* 4 */{ E3,E3,E3,E3,-2,E3,E3,E3,E3,E1,-63}, // < .>
- /* 5 */{ 5, 5, 5,-4, 5, 5, 5, 5, 5, 5,-63}, // da.ta
- /* 6 */{ 6,-7,E3,E2,-6,E2,E2,E3,-9,E3,-63}, // <na.me
- /* 7 */{ -8, 7,E3,E2,-2,E2,E2, 7, 3,E3,-63}, // <name .
- /* 8 */{ 8,E3,E3,E2,E3,E2,E2,E3,E3,-10,-63}, // att.r
- /* 9 */{ 9, 7,E3,E3,E3,E3,E3,E3,E3,E3,-63}, // <?x.ml
- /* 10 */{ E5,E5,-11,E5,E5,E5,E5,E5,E5,E5,-63},// attr=."
- /* 11 */{ 11,11,-5 ,11,11,11,11,11,11,11,-63},// attr="va.l
- /* 12 */{ -13,12,E3,E3,E3,E3,E3,E3,E3,E3,-63}, // </ . >
- /* 13 */{ 13,-14,E3,E3,-16,E3,E3,E3,E3,E3,-63}, // </ na.me>
- /* 14 */{ E3,14,E3,E3,-15,E3,E3,E3,E3,E3,-63}, // </ name. >
- /* 15 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 16 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 17 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 18 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 19 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 20 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 21 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 22 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 23 */{0,0,0,0,0,0,0,0,0,0,-63},
- /* 24 */{0,0,0,0,0,0,0,0,0,0,-63},
+{ /* dt ws " < > & ; ? / = ! [ ] - EOB*/
+ /* 0 */{ E1, 0,E1, 1,E1,E1,E1,E1,E1,E1,E3,E1,E1,-63}, // .<
+ /* 1 */{ E1,E1,E1,E1,E1,E1,E1, 9,E1,E1,E3,E1,E1,-63}, // <.?
+ /* 2 */{ -3, 2,E3,E2,E2,E2,E2,E2,12,E2,16,E2,E2,-63}, // <.
+ /* 3 */{ E3,E3,E3,E3,-1,E3,E3,E3,E3,E1,E3,E3,E3,-63}, // < /.>
+ /* 4 */{ E3,E3,E3,E3,-2,E3,E3,E3,E3,E1,E1,E3,E3,-63}, // < .>
+ /* 5 */{ 5, 5, 5,-4, 5, 5, 5, 5, 5, 5, 5,E3,E3,-63}, // da.ta
+ /* 6 */{ 6,-7,E3,E2,-6,E2,E2,E3,-9,E3,E3,E3,E3,-63}, // <na.me
+ /* 7 */{ -8, 7,E3,E2,-2,E2,E2, 7, 3,E3,E3,E3,E3,-63}, // <name .
+ /* 8 */{ 8,-12,E3,E2,E3,E2,E2,E3,E3,-10,E3,E3,E3,-63}, // att.r
+ /* 9 */{ 9, 7,E3,E3,E3,E3,E3,E3,E3,E3,E3,E3,E3,-63}, // <?x.ml
+ /* 10 */{ E5,10,-11,E5,E5,E5,E5,E5,E5,E5,E3,E3,E3,-63},// attr=."
+ /* 11 */{ 11,11,-5 ,11,11,11,11,11,11,11,E3,E3,E3,-63},// attr="va.l
+ /* 12 */{ -13,12,E3,E3,E3,E3,E3,E3,E3,E3,E3,E3,E3,-63}, // </ . >
+ /* 13 */{ 13,-14,E3,E3,-16,E3,E3,E3,E3,E3,E3,E3,E3,-63},// </ na.me>
+ /* 14 */{ E3,14,E3,E3,-15,E3,E3,E3,E3,E3,E3,E3,E3,-63},// </ name. >
+ /* 15 */{ E3,15,E3,E2,E3,E3,E3,E3,E3,10,E3,E3,E3,-63}, // attr .=
+ /* 16 */{ E3,E3,E3,E2,E3,E3,E3,E3,E3,E3,E3,17,E3,-63}, // <!.[CDATA[ ]]>
+ /* 17 */{ 17,E3,E3,E3,E3,E3,E3,E3,E3,E3,E3,18,E3,-63}, // <![C.DATA[ ]]>
+ /* 18 */{ 18,18,18,18,18,18,18,18,18,18,18,18,19,-63}, // <![CDATA[ . ]]>
+ /* 19 */{ 18,18,18,18,-20,18,18,18,18,18,18,18,19,-63}, // <![CDATA[ ].]>
+ /* 20 */{0,0,0,0,0,0,0,0,0,0,0,-63},
+ /* 21 */{0,0,0,0,0,0,0,0,0,0,0,-63},
+ /* 22 */{0,0,0,0,0,0,0,0,0,0,0,-63},
+ /* 23 */{0,0,0,0,0,0,0,0,0,0,0,-63},
+ /* 24 */{0,0,0,0,0,0,0,0,0,0,0,-63},
};
typedef struct _tag_stack {
stringstate_finish(&tagname, buffer, pos-1);
state = 3;
break;
- case -10: // end of attribute name
+ case -12: // end of attribute name, at ws
+ stringstate_finish(&attr_name, buffer, pos-1);
+ state = 15;
+ break;
+ case -10: // end of attribute name, at =
stringstate_finish(&attr_name, buffer, pos-1);
state = 10;
break;
attributes = a;
state = 7;
break;
+ case -20:
+ state = 5;
+ break;
default:
if(-state&0x40) {
- fprintf(stderr, "%s\n", errors[(-state)&0x3f]);
+ fprintf(stderr, "%s (state %d, char '%c')\n", errors[(-state)&0x3f], old, buffer[pos-1]);
return 0;
} else {
fprintf(stderr, "internal error: no action %d\n", state);