1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 - 2019 Joakim Strandberg <joakim@mequinox.se>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Characters.Latin_1;
-- Known unsupported issues: Escaping of text (for example &)
-- The stack roof may be hit if the comments and texts in the XML are HUGE.
-- It should not be an issue in general.
procedure Aida.XML_SAX_Parse
(Argument : in out Argument_Type;
Contents : String;
Call_Result : in out Aida.Call_Result)
is
package L1 renames Ada.Characters.Latin_1;
type Initial_State_Id is
(Less_Sign,
Question_Mark,
X,
XM,
XML,
XML_S,
XML_S_V,
XML_S_VE,
XML_S_VER,
XML_S_VERS,
XML_S_VERSI,
XML_S_VERSIO,
XML_S_VERSION,
XML_S_VERSION_E,
XML_S_VERSION_E_Q,
XML_S_VERSION_E_Q_1,
XML_S_VERSION_E_Q_1_P,
XML_S_VERSION_E_Q_1_P_0,
XML_S_VERSION_E_Q_1_P_0_Q,
XML_S_VERSION_E_Q_1_P_0_Q_S,
XML_S_VERSION_E_Q_1_P_0_Q_S_E,
XML_S_VERSION_E_Q_1_P_0_Q_S_EN,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCO,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCOD,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODI,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODIN,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_U,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_UT,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q,
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q_QM,
-- QM is short for Question Mark
End_State);
type State_Id_Type is
(Expecting_NL_Sign_Or_Space_Or_Less_Sign, -- NL = New Line
Init_Found_Less_Sign,
-- First start tag has not yet been found
Init_Found_Less_Followed_By_Exclamation_Sign,
-- First start tag has not yet been found
Init_Found_Less_Followed_By_Exclamation_And_Dash_Sign,
-- First start tag has not yet been found
Extracting_Start_Tag_Name,
Expecting_G_Sign_Or_Attributes,
Expecting_G_Sign_Or_Attributes_And_Found_Slash,
Extracting_Attribute_Name,
Expecting_Attribute_Value_Quotation_Mark,
Extracting_Attribute_Value,
Expecting_New_Tag_Or_Extracting_Tag_Value,
-- Or start of comment or start- tag or end-tag
Expecting_New_Tag_Or_Tag_Value_And_Found_L,
Expecting_Only_Trailing_Spaces, Extracting_End_Tag_Name,
New_Tag_Or_Tag_Value_And_L_And_Excl_And_Dash,
-- ED is short for Exclamation and Dash
--
-- Enumeration values introduced to handle <!CDATA[--]]>
New_Tag_Or_Tag_Value_And_Found_L_And_Exclamation,
New_Tag_Or_Tag_Value_But_Expecting_C,
New_Tag_Or_Tag_Value_But_Expecting_CD,
New_Tag_Or_Tag_Value_But_Expecting_CDA,
New_Tag_Or_Tag_Value_But_Expecting_CDAT,
New_Tag_Or_Tag_Value_But_Expecting_CDATA,
New_Tag_Or_Tag_Value_But_Expecting_CDATA_And_SB,
-- SB is short for Square bracket
Extracting_CDATA, Extracting_CDATA_Found_Square_Bracket,
Extracting_CDATA_Found_Two_Square_Brackets, Init_Extracting_Comment,
-- First start tag has not yet been found
Init_Extracting_Comment_And_Found_Dash,
-- First start tag has not yet been found
Init_Extracting_Comment_And_Found_Dash_Dash,
-- First start tag has not yet been found
Extracting_Comment,
Extracting_Comment_And_Found_Dash,
Extracting_Comment_And_Found_Dash_Dash);
type Expected_Quotation_Symbol_T is
(Single_Quotes, -- Example: 'hello'
Double_Quotes -- Example: "hello"
);
function Is_Special_Symbol (CP : Character) return Boolean is
(CP in '<' | '>' | '/' | '"');
XML_IDENTIFIER_ERROR_1 : constant Integer := -1913564897;
XML_IDENTIFIER_ERROR_2 : constant Integer := -0537097086;
subtype P_T is Integer range Contents'First .. Contents'Last + 4;
subtype Prev_P_T is Integer range Contents'First + 1 .. Contents'Last;
procedure Analyze_XML (P : in out P_T) with
Global => (In_Out => (Call_Result, Argument),
Input => Contents),
Pre =>
(not Call_Result.Has_Failed and P > Contents'First and
P <= Contents'Last and Contents'Last < Integer'Last - 4);
procedure Analyze_XML (P : in out P_T) is
Depth : Natural := 0;
State_Id : State_Id_Type := Expecting_NL_Sign_Or_Space_Or_Less_Sign;
subtype Prev_Prev_P_T is Integer range
Contents'First + 0 .. Contents'Last;
subtype Contents_Index_T is Integer range
Contents'First .. Contents'Last;
CP : Character;
Prev_P : Prev_P_T := P;
Prev_Prev_P : Prev_Prev_P_T; -- := Prev_P;
Start_Tag_Name_First_Index : Contents_Index_T := Prev_P;
Start_Tag_Name_Last_Index : Contents_Index_T := Prev_P;
Tag_Value_First_Index : Contents_Index_T := Contents'First;
Tag_Value_Last_Index : Contents_Index_T := Contents'First;
End_Tag_Name_First_Index : Contents_Index_T := Contents'First;
End_Tag_Name_Last_Index : Contents_Index_T;
Attribute_First_Index : Contents_Index_T := Prev_P;
Attribute_Last_Index : Contents_Index_T := Prev_P;
Attribute_Value_First_Index : Contents_Index_T := Prev_P;
Attribute_Value_Last_Index : Contents_Index_T;
Comment_First_Index : Contents_Index_T := Prev_P;
-- Shall_Ignore_Tag_Value : Boolean := False;
-- Shall_Ignore_Tag_Value : Boolean;
-- Shall_Ignore_Until_Next_Quotation_Mark : Boolean := False;
Expected_Quotation_Symbol : Expected_Quotation_Symbol_T := Double_Quotes;
begin
if P in Contents'Range
then
CP := Contents (P);
P := P + 1;
if CP = '>' then
while P <= Contents'Last loop
Prev_Prev_P := Prev_P;
Prev_P := P;
if P not in Contents'Range then
Call_Result.Initialize (1434797854, -0068724898);
exit;
end if;
CP := Contents (P);
P := P + 1;
pragma Loop_Variant (Increases => P);
pragma Loop_Invariant (not Call_Result.Has_Failed);
pragma Loop_Invariant (P <= Contents'Last + 4);
pragma Loop_Invariant (Prev_Prev_P < Prev_P and Prev_P < P);
pragma Loop_Invariant
(State_Id /= Extracting_Attribute_Name or
(State_Id = Extracting_Attribute_Name
and then (Attribute_First_Index < P)));
-- Aida.Text_IO.Put ("Extracted:");
-- Aida.Text_IO.Put (Image (CP));
-- Aida.Text_IO.Put (", state ");
-- Aida.Text_IO.Put_Line
-- (String_T (State_Id_Type'Image (State_Id)));
-- Aida.Text_IO.Put (Image (CP));
case State_Id is
when Expecting_NL_Sign_Or_Space_Or_Less_Sign =>
if CP in ' ' | L1.LF | L1.CR | L1.HT then
null; -- Normal
elsif CP = '<' then
State_Id := Init_Found_Less_Sign;
else
Call_Result.Initialize (1003548980, 1714289304);
exit;
end if;
when Init_Found_Less_Sign =>
if CP = '!' then
State_Id :=
Init_Found_Less_Followed_By_Exclamation_Sign;
elsif CP = '/' then
if Depth = 0 then
Call_Result.Initialize (-1797161339, -1801650669);
exit;
end if;
if P > Contents'Last then
Call_Result.Initialize (0386434633, -1112825058);
exit;
end if;
Text (Argument, "", Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
State_Id := Extracting_End_Tag_Name;
End_Tag_Name_First_Index := P;
elsif not Is_Special_Symbol (CP) then
State_Id := Extracting_Start_Tag_Name;
Start_Tag_Name_First_Index := Prev_P;
pragma Assert (Start_Tag_Name_First_Index < P);
else
Call_Result.Initialize (1448645964, 0183871387);
exit;
end if;
when Init_Found_Less_Followed_By_Exclamation_Sign =>
if CP = '-' then
State_Id :=
Init_Found_Less_Followed_By_Exclamation_And_Dash_Sign;
else
Call_Result.Initialize (1915807131, 1377704704);
exit;
end if;
when Init_Found_Less_Followed_By_Exclamation_And_Dash_Sign =>
if CP = '-' then
State_Id := Init_Extracting_Comment;
Comment_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
else
Call_Result.Initialize (-1302785225, -0551230956);
exit;
end if;
when Extracting_Start_Tag_Name =>
if CP = ' ' then
Start_Tag_Name_Last_Index := Prev_Prev_P;
Start_Tag
(Argument,
Contents
(Start_Tag_Name_First_Index ..
Start_Tag_Name_Last_Index),
Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
if Depth < Integer'Last then
Depth := Depth + 1;
else
Call_Result.Initialize (-0197127393, -1788002976);
exit;
end if;
State_Id := Expecting_G_Sign_Or_Attributes;
elsif CP = '>' then
Start_Tag_Name_Last_Index := Prev_Prev_P;
Start_Tag
(Argument,
Contents
(Start_Tag_Name_First_Index ..
Start_Tag_Name_Last_Index),
Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
if Depth < Integer'Last then
Depth := Depth + 1;
else
Call_Result.Initialize (0133265230, -0905163379);
exit;
end if;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
elsif Is_Special_Symbol (CP) then
Call_Result.Initialize (-0192291225, -1709997324);
exit;
end if;
when Expecting_G_Sign_Or_Attributes =>
if CP in ' ' | L1.LF | L1.CR | L1.HT then
null; -- Normal
elsif CP = '>' then
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
if P > Contents'Last then
Call_Result.Initialize (-1521899768, -0725554341);
exit;
end if;
Tag_Value_First_Index := P;
elsif CP = '/' then
State_Id :=
Expecting_G_Sign_Or_Attributes_And_Found_Slash;
elsif not Is_Special_Symbol (CP) then
Attribute_First_Index := Prev_P;
State_Id := Extracting_Attribute_Name;
else
Call_Result.Initialize (-0429878843, 1344381718);
exit;
end if;
when Expecting_G_Sign_Or_Attributes_And_Found_Slash =>
if CP = '>' then
State_Id := Expecting_NL_Sign_Or_Space_Or_Less_Sign;
Text (Argument, "", Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
-- End_Tag_Name_Last_Index := Prev_Prev_P;
End_Tag
(Argument,
Contents
(Start_Tag_Name_First_Index ..
Start_Tag_Name_Last_Index),
Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
if Depth > 0 then
Depth := Depth - 1;
else
Call_Result.Initialize (0766893447, -0197942014);
exit;
end if;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
else
Call_Result.Initialize (1180086532, 1745903660);
exit;
end if;
when Extracting_Attribute_Name =>
if CP = '=' then
Attribute_Last_Index := Prev_Prev_P;
State_Id := Expecting_Attribute_Value_Quotation_Mark;
elsif CP = L1.LF or CP = L1.CR then
Call_Result.Initialize (-0986469701, -0000005525);
exit;
elsif not Is_Special_Symbol (CP) then
null; -- Normal
else
Call_Result.Initialize (0819713752, 1428867079);
exit;
end if;
when Expecting_Attribute_Value_Quotation_Mark =>
if CP = '"' then
Expected_Quotation_Symbol := Double_Quotes;
Attribute_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Extracting_Attribute_Value;
elsif CP = ''' then
Expected_Quotation_Symbol := Single_Quotes;
Attribute_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Extracting_Attribute_Value;
else
Call_Result.Initialize (0240833721, 0455771309);
exit;
end if;
when Extracting_Attribute_Value =>
if
(CP = '"' and
Expected_Quotation_Symbol = Double_Quotes) or
(CP = ''' and
Expected_Quotation_Symbol = Single_Quotes)
then
Attribute_Value_Last_Index := Prev_Prev_P;
State_Id := Expecting_G_Sign_Or_Attributes;
declare
Name : constant String :=
Contents
(Attribute_First_Index .. Attribute_Last_Index);
Value : constant String :=
Contents
(Attribute_Value_First_Index ..
Attribute_Value_Last_Index);
begin
Attribute
(Argument, Name, Value,
Call_Result);
end;
if Call_Result.Has_Failed then
exit;
end if;
elsif CP = '<' or CP = '&' then
-- https://www.w3.org/TR/REC-xml/#NT-AttValue
Call_Result.Initialize (0587945467, 1683764896);
exit;
end if;
when Expecting_New_Tag_Or_Extracting_Tag_Value =>
-- if CP = Character'Pos ('"') then
-- Shall_Ignore_Until_Next_Quotation_Mark :=
-- not Shall_Ignore_Until_Next_Quotation_Mark;
if CP = '<' then
-- if not Shall_Ignore_Until_Next_Quotation_Mark then
State_Id :=
Expecting_New_Tag_Or_Tag_Value_And_Found_L;
Tag_Value_Last_Index := Prev_Prev_P;
Text
(Argument,
Contents
(Tag_Value_First_Index .. Tag_Value_Last_Index),
Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
-- end if;
end if;
when Expecting_New_Tag_Or_Tag_Value_And_Found_L =>
if CP = '/' then
if P > Contents'Last then
Call_Result.Initialize (-1635958681, 2091153567);
exit;
end if;
State_Id := Extracting_End_Tag_Name;
End_Tag_Name_First_Index := P;
elsif CP = '!' then
State_Id :=
New_Tag_Or_Tag_Value_And_Found_L_And_Exclamation;
elsif Is_Special_Symbol (CP) then
Call_Result.Initialize (-0115323975, -1084437773);
exit;
else
-- Will start parsing child tag!
State_Id := Extracting_Start_Tag_Name;
Start_Tag_Name_First_Index := Prev_P;
end if;
when New_Tag_Or_Tag_Value_And_Found_L_And_Exclamation =>
if CP = '[' then
State_Id :=
New_Tag_Or_Tag_Value_But_Expecting_C;
elsif CP = '-' then
State_Id :=
New_Tag_Or_Tag_Value_And_L_And_Excl_And_Dash;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when New_Tag_Or_Tag_Value_But_Expecting_C =>
if CP = 'C' then
State_Id :=
New_Tag_Or_Tag_Value_But_Expecting_CD;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when New_Tag_Or_Tag_Value_But_Expecting_CD =>
if CP = 'D' then
State_Id :=
New_Tag_Or_Tag_Value_But_Expecting_CDA;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when New_Tag_Or_Tag_Value_But_Expecting_CDA =>
if CP = 'A' then
State_Id :=
New_Tag_Or_Tag_Value_But_Expecting_CDAT;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when New_Tag_Or_Tag_Value_But_Expecting_CDAT =>
if CP = 'T' then
State_Id :=
New_Tag_Or_Tag_Value_But_Expecting_CDATA;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when New_Tag_Or_Tag_Value_But_Expecting_CDATA =>
if CP = 'A' then
State_Id :=
New_Tag_Or_Tag_Value_But_Expecting_CDATA_And_SB;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when New_Tag_Or_Tag_Value_But_Expecting_CDATA_And_SB =>
if CP = '[' then
State_Id := Extracting_CDATA;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when Extracting_CDATA =>
if CP = ']' then
Tag_Value_Last_Index := Prev_Prev_P;
State_Id := Extracting_CDATA_Found_Square_Bracket;
end if;
when Extracting_CDATA_Found_Square_Bracket =>
if CP = ']' then
State_Id := Extracting_CDATA_Found_Two_Square_Brackets;
else
State_Id := Extracting_CDATA;
end if;
when Extracting_CDATA_Found_Two_Square_Brackets =>
if CP = '>' then
CDATA
(Argument,
Contents
(Tag_Value_First_Index .. Tag_Value_Last_Index),
Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
else
State_Id := Extracting_CDATA;
end if;
when Extracting_End_Tag_Name =>
if CP = '>' then
End_Tag_Name_Last_Index := Prev_Prev_P;
End_Tag
(Argument,
Contents
(End_Tag_Name_First_Index ..
End_Tag_Name_Last_Index),
Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
if Depth > 0 then
Depth := Depth - 1;
else
Call_Result.Initialize (-0534201701, -0614895498);
exit;
end if;
if Depth = 0 then
State_Id := Expecting_Only_Trailing_Spaces;
else
State_Id :=
Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
elsif CP = L1.LF or CP = L1.CR then
Call_Result.Initialize (-1658791000, 1638125646);
exit;
elsif Is_Special_Symbol (CP) then
Call_Result.Initialize (1726646144, -0779212513);
exit;
end if;
when New_Tag_Or_Tag_Value_And_L_And_Excl_And_Dash =>
if CP = '-' then
Comment_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Extracting_Comment;
else
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
end if;
when Init_Extracting_Comment =>
if CP = '-' then
State_Id := Init_Extracting_Comment_And_Found_Dash;
end if;
when Init_Extracting_Comment_And_Found_Dash =>
if CP = '-' then
State_Id :=
Init_Extracting_Comment_And_Found_Dash_Dash;
else
State_Id := Init_Extracting_Comment;
end if;
when Init_Extracting_Comment_And_Found_Dash_Dash =>
if CP = '>' then
Comment
(Argument,
Value => Contents (Comment_First_Index .. (P - 4)),
Call_Result => Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Expecting_NL_Sign_Or_Space_Or_Less_Sign;
else
State_Id := Init_Extracting_Comment;
end if;
when Extracting_Comment =>
if CP = '-' then
State_Id := Extracting_Comment_And_Found_Dash;
end if;
when Extracting_Comment_And_Found_Dash =>
if CP = '-' then
State_Id := Extracting_Comment_And_Found_Dash_Dash;
else
State_Id := Extracting_Comment;
end if;
when Extracting_Comment_And_Found_Dash_Dash =>
if CP = '>' then
Comment
(Argument,
Value => Contents (Comment_First_Index .. (P - 4)),
Call_Result => Call_Result);
if Call_Result.Has_Failed then
exit;
end if;
Tag_Value_First_Index :=
(if P <= Contents'Last then P else Contents'Last);
State_Id := Expecting_New_Tag_Or_Extracting_Tag_Value;
else
State_Id := Init_Extracting_Comment;
end if;
when Expecting_Only_Trailing_Spaces =>
if CP = ' ' or CP = L1.LF or CP = L1.CR then
null; -- Trailing spaces are OK
else
Call_Result.Initialize (1777504526, -1635825641);
exit;
end if;
end case;
end loop;
if not Call_Result.Has_Failed
and then State_Id /= Expecting_Only_Trailing_Spaces
then
Call_Result.Initialize (-1968500370, -1627762655);
end if;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
end if;
else
Call_Result.Initialize (-1672429119, -1233854200);
end if;
end Analyze_XML;
State_Id : Initial_State_Id := Less_Sign;
P : P_T := Contents'First;
CP : Character;
begin
while P <= Contents'Last loop
exit when State_Id = End_State;
if P not in Contents'Range then
Call_Result.Initialize (-0356399774, -0280059910);
exit;
end if;
CP := Contents (P);
P := P + 1;
pragma Loop_Variant (Increases => P);
pragma Loop_Invariant (not Call_Result.Has_Failed);
pragma Loop_Invariant
(State_Id /= Less_Sign or
(State_Id = Less_Sign
and then (P > Contents'First and
Contents'Last >= Contents'First)));
pragma Loop_Invariant
(State_Id /= Question_Mark or
(State_Id = Question_Mark
and then
(P > Contents'First + 1 and
Contents'Last >= Contents'First + 1)));
pragma Loop_Invariant
(State_Id /= X or
(State_Id = X
and then
(P > Contents'First + 2 and
Contents'Last >= Contents'First + 2)));
pragma Loop_Invariant
(State_Id /= XM or
(State_Id = XM
and then
(P > Contents'First + 3 and
Contents'Last >= Contents'First + 3)));
pragma Loop_Invariant
(State_Id /= XML or
(State_Id = XML
and then
(P > Contents'First + 4 and
Contents'Last >= Contents'First + 4)));
pragma Loop_Invariant
(State_Id /= XML_S or
(State_Id = XML_S
and then
(P > Contents'First + 5 and
Contents'Last >= Contents'First + 5)));
pragma Loop_Invariant
(State_Id /= XML_S_V or
(State_Id = XML_S_V
and then
(P > Contents'First + 6 and
Contents'Last >= Contents'First + 6)));
pragma Loop_Invariant
(State_Id /= XML_S_VE or
(State_Id = XML_S_VE
and then
(P > Contents'First + 7 and
Contents'Last >= Contents'First + 7)));
pragma Loop_Invariant
(State_Id /= XML_S_VER or
(State_Id = XML_S_VER
and then
(P > Contents'First + 8 and
Contents'Last >= Contents'First + 8)));
pragma Loop_Invariant
(State_Id /= XML_S_VERS or
(State_Id = XML_S_VERS
and then
(P > Contents'First + 9 and
Contents'Last >= Contents'First + 9)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSI or
(State_Id = XML_S_VERSI
and then
(P > Contents'First + 10 and
Contents'Last >= Contents'First + 10)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSIO or
(State_Id = XML_S_VERSIO
and then
(P > Contents'First + 11 and
Contents'Last >= Contents'First + 11)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSION or
(State_Id = XML_S_VERSION
and then
(P > Contents'First + 12 and
Contents'Last >= Contents'First + 12)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSION_E or
(State_Id = XML_S_VERSION_E
and then
(P > Contents'First + 13 and
Contents'Last >= Contents'First + 13)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSION_E_Q or
(State_Id = XML_S_VERSION_E_Q
and then
(P > Contents'First + 14 and
Contents'Last >= Contents'First + 14)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSION_E_Q_1 or
(State_Id = XML_S_VERSION_E_Q_1
and then
(P > Contents'First + 15 and
Contents'Last >= Contents'First + 15)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSION_E_Q_1_P or
(State_Id = XML_S_VERSION_E_Q_1_P
and then
(P > Contents'First + 16 and
Contents'Last >= Contents'First + 16)));
pragma Loop_Invariant
(State_Id /= XML_S_VERSION_E_Q_1_P_0 or
(State_Id = XML_S_VERSION_E_Q_1_P_0
and then
(P > Contents'First + 17 and
Contents'Last >= Contents'First + 17)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q or
(State_Id = XML_S_VERSION_E_Q_1_P_0_Q
and then
(P > Contents'First + 18 and
Contents'Last >= Contents'First + 18)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S
and then
(P > Contents'First + 19 and
Contents'Last >= Contents'First + 19)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_E or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_E
and then
(P > Contents'First + 20 and
Contents'Last >= Contents'First + 20)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_EN or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_EN
and then
(P > Contents'First + 21 and
Contents'Last >= Contents'First + 21)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC
and then
(P > Contents'First + 22 and
Contents'Last >= Contents'First + 22)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCO or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCO
and then
(P > Contents'First + 23 and
Contents'Last >= Contents'First + 23)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCOD or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCOD
and then
(P > Contents'First + 24 and
Contents'Last >= Contents'First + 24)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODI or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODI
and then
(P > Contents'First + 25 and
Contents'Last >= Contents'First + 25)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODIN or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODIN
and then
(P > Contents'First + 26 and
Contents'Last >= Contents'First + 26)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING
and then
(P > Contents'First + 27 and
Contents'Last >= Contents'First + 27)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E
and then
(P > Contents'First + 28 and
Contents'Last >= Contents'First + 28)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q
and then
(P > Contents'First + 29 and
Contents'Last >= Contents'First + 29)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_U or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_U
and then
(P > Contents'First + 30 and
Contents'Last >= Contents'First + 30)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_UT or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_UT
and then
(P > Contents'First + 31 and
Contents'Last >= Contents'First + 31)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF
and then
(P > Contents'First + 32 and
Contents'Last >= Contents'First + 32)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D
and then
(P > Contents'First + 33 and
Contents'Last >= Contents'First + 33)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8 or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8
and then
(P > Contents'First + 34 and
Contents'Last >= Contents'First + 34)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q
and then
(P > Contents'First + 35 and
Contents'Last >= Contents'First + 35)));
pragma Loop_Invariant
(State_Id /=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q_QM or
(State_Id =
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q_QM
and then
(P > Contents'First + 36 and
Contents'Last >= Contents'First + 36)));
-- Aida.Text_IO.Put ("Extracted:");
-- Aida.Text_IO.Put (Image (CP));
-- Aida.Text_IO.Put (", state ");
-- Aida.Text_IO.Put_Line (State_Id_T'Image (State_Id));
-- Aida.Text_IO.Put (Image (CP));
case State_Id is
when End_State =>
null;
when Less_Sign =>
if CP = ' ' then
null;
elsif CP = '<' then
State_Id := Question_Mark;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when Question_Mark =>
if CP = '?' then
State_Id := X;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when X =>
if CP = 'x' then
State_Id := XM;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XM =>
if CP = 'm' then
State_Id := XML;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML =>
if CP = 'l' then
State_Id := XML_S;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S =>
if CP = ' ' then
State_Id := XML_S_V;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_V =>
if CP = 'v' then
State_Id := XML_S_VE;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VE =>
if CP = 'e' then
State_Id := XML_S_VER;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VER =>
if CP = 'r' then
State_Id := XML_S_VERS;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERS =>
if CP = 's' then
State_Id := XML_S_VERSI;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSI =>
if CP = 'i' then
State_Id := XML_S_VERSIO;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSIO =>
if CP = 'o' then
State_Id := XML_S_VERSION;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION =>
if CP = 'n' then
State_Id := XML_S_VERSION_E;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E =>
if CP = '=' then
State_Id := XML_S_VERSION_E_Q;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q =>
if CP = '"' then
State_Id := XML_S_VERSION_E_Q_1;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1 =>
if CP = '1' then
State_Id :=
XML_S_VERSION_E_Q_1_P;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P =>
if CP = '.' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0 =>
if CP = '0' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q =>
if CP = '"' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S =>
if CP = ' ' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_E;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_E =>
if CP = 'e' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_EN;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_EN =>
if CP = 'n' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENC =>
if CP = 'c' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCO;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCO =>
if CP = 'o' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCOD;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCOD =>
if CP = 'd' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODI;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODI =>
if CP = 'i' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODIN;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODIN =>
if CP = 'n' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING =>
if CP = 'g' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E =>
if CP = '=' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q =>
if CP = '"' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_U;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_U =>
if CP = 'u' or CP = 'U' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_UT;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENCODING_E_Q_UT =>
if CP = 't' or CP = 'T' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF =>
if CP = 'f' or CP = 'F' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D =>
if CP = '-' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8 =>
if CP = '8' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q =>
if CP = '"' then
State_Id :=
XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q_QM;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
when XML_S_VERSION_E_Q_1_P_0_Q_S_ENC_E_Q_UTF_D_8_Q_QM =>
if CP = '?' then
if P <= Contents'Last then
State_Id := End_State;
pragma Assert (P > Contents'First + 36);
Analyze_XML (P);
else
Call_Result.Initialize (-0645831530, 1132432555);
exit;
end if;
else
Call_Result.Initialize
(XML_IDENTIFIER_ERROR_1, XML_IDENTIFIER_ERROR_2);
exit;
end if;
end case;
end loop;
end Aida.XML_SAX_Parse;
|