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 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691
|
package urn
import (
"fmt"
)
var (
errPrefix = "expecting the prefix to be the \"urn\" string (whatever case) [col %d]"
errIdentifier = "expecting the identifier to be string (1..31 alnum chars, also containing dashes but not at its start) [col %d]"
errSpecificString = "expecting the specific string to be a string containing alnum, hex, or others ([()+,-.:=@;$_!*']) chars [col %d]"
errNoUrnWithinID = "expecting the identifier to not contain the \"urn\" reserved string [col %d]"
errHex = "expecting the specific string hex chars to be well-formed (%%alnum{2}) [col %d]"
errParse = "parsing error [col %d]"
)
const start int = 1
const firstFinal int = 44
const enFail int = 46
const enMain int = 1
// Machine is the interface representing the FSM
type Machine interface {
Error() error
Parse(input []byte) (*URN, error)
}
type machine struct {
data []byte
cs int
p, pe, eof, pb int
err error
tolower []int
}
// NewMachine creates a new FSM able to parse RFC 2141 strings.
func NewMachine() Machine {
m := &machine{}
return m
}
// Err returns the error that occurred on the last call to Parse.
//
// If the result is nil, then the line was parsed successfully.
func (m *machine) Error() error {
return m.err
}
func (m *machine) text() []byte {
return m.data[m.pb:m.p]
}
// Parse parses the input byte array as a RFC 2141 string.
func (m *machine) Parse(input []byte) (*URN, error) {
m.data = input
m.p = 0
m.pb = 0
m.pe = len(input)
m.eof = len(input)
m.err = nil
m.tolower = []int{}
output := &URN{}
{
m.cs = start
}
{
if (m.p) == (m.pe) {
goto _testEof
}
switch m.cs {
case 1:
goto stCase1
case 0:
goto stCase0
case 2:
goto stCase2
case 3:
goto stCase3
case 4:
goto stCase4
case 5:
goto stCase5
case 6:
goto stCase6
case 7:
goto stCase7
case 8:
goto stCase8
case 9:
goto stCase9
case 10:
goto stCase10
case 11:
goto stCase11
case 12:
goto stCase12
case 13:
goto stCase13
case 14:
goto stCase14
case 15:
goto stCase15
case 16:
goto stCase16
case 17:
goto stCase17
case 18:
goto stCase18
case 19:
goto stCase19
case 20:
goto stCase20
case 21:
goto stCase21
case 22:
goto stCase22
case 23:
goto stCase23
case 24:
goto stCase24
case 25:
goto stCase25
case 26:
goto stCase26
case 27:
goto stCase27
case 28:
goto stCase28
case 29:
goto stCase29
case 30:
goto stCase30
case 31:
goto stCase31
case 32:
goto stCase32
case 33:
goto stCase33
case 34:
goto stCase34
case 35:
goto stCase35
case 36:
goto stCase36
case 37:
goto stCase37
case 38:
goto stCase38
case 44:
goto stCase44
case 39:
goto stCase39
case 40:
goto stCase40
case 45:
goto stCase45
case 41:
goto stCase41
case 42:
goto stCase42
case 43:
goto stCase43
case 46:
goto stCase46
}
goto stOut
stCase1:
switch (m.data)[(m.p)] {
case 85:
goto tr1
case 117:
goto tr1
}
goto tr0
tr0:
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
tr3:
m.err = fmt.Errorf(errPrefix, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
tr6:
m.err = fmt.Errorf(errIdentifier, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
tr41:
m.err = fmt.Errorf(errSpecificString, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
tr44:
m.err = fmt.Errorf(errHex, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errSpecificString, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
tr50:
m.err = fmt.Errorf(errPrefix, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errIdentifier, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
tr52:
m.err = fmt.Errorf(errNoUrnWithinID, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errIdentifier, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
goto st0
stCase0:
st0:
m.cs = 0
goto _out
tr1:
m.pb = m.p
goto st2
st2:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof2
}
stCase2:
switch (m.data)[(m.p)] {
case 82:
goto st3
case 114:
goto st3
}
goto tr0
st3:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof3
}
stCase3:
switch (m.data)[(m.p)] {
case 78:
goto st4
case 110:
goto st4
}
goto tr3
st4:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof4
}
stCase4:
if (m.data)[(m.p)] == 58 {
goto tr5
}
goto tr0
tr5:
output.prefix = string(m.text())
goto st5
st5:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof5
}
stCase5:
switch (m.data)[(m.p)] {
case 85:
goto tr8
case 117:
goto tr8
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto tr7
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto tr7
}
default:
goto tr7
}
goto tr6
tr7:
m.pb = m.p
goto st6
st6:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof6
}
stCase6:
switch (m.data)[(m.p)] {
case 45:
goto st7
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st7
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st7
}
default:
goto st7
}
goto tr6
st7:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof7
}
stCase7:
switch (m.data)[(m.p)] {
case 45:
goto st8
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st8
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st8
}
default:
goto st8
}
goto tr6
st8:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof8
}
stCase8:
switch (m.data)[(m.p)] {
case 45:
goto st9
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st9
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st9
}
default:
goto st9
}
goto tr6
st9:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof9
}
stCase9:
switch (m.data)[(m.p)] {
case 45:
goto st10
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st10
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st10
}
default:
goto st10
}
goto tr6
st10:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof10
}
stCase10:
switch (m.data)[(m.p)] {
case 45:
goto st11
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st11
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st11
}
default:
goto st11
}
goto tr6
st11:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof11
}
stCase11:
switch (m.data)[(m.p)] {
case 45:
goto st12
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st12
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st12
}
default:
goto st12
}
goto tr6
st12:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof12
}
stCase12:
switch (m.data)[(m.p)] {
case 45:
goto st13
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st13
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st13
}
default:
goto st13
}
goto tr6
st13:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof13
}
stCase13:
switch (m.data)[(m.p)] {
case 45:
goto st14
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st14
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st14
}
default:
goto st14
}
goto tr6
st14:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof14
}
stCase14:
switch (m.data)[(m.p)] {
case 45:
goto st15
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st15
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st15
}
default:
goto st15
}
goto tr6
st15:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof15
}
stCase15:
switch (m.data)[(m.p)] {
case 45:
goto st16
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st16
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st16
}
default:
goto st16
}
goto tr6
st16:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof16
}
stCase16:
switch (m.data)[(m.p)] {
case 45:
goto st17
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st17
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st17
}
default:
goto st17
}
goto tr6
st17:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof17
}
stCase17:
switch (m.data)[(m.p)] {
case 45:
goto st18
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st18
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st18
}
default:
goto st18
}
goto tr6
st18:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof18
}
stCase18:
switch (m.data)[(m.p)] {
case 45:
goto st19
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st19
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st19
}
default:
goto st19
}
goto tr6
st19:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof19
}
stCase19:
switch (m.data)[(m.p)] {
case 45:
goto st20
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st20
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st20
}
default:
goto st20
}
goto tr6
st20:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof20
}
stCase20:
switch (m.data)[(m.p)] {
case 45:
goto st21
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st21
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st21
}
default:
goto st21
}
goto tr6
st21:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof21
}
stCase21:
switch (m.data)[(m.p)] {
case 45:
goto st22
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st22
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st22
}
default:
goto st22
}
goto tr6
st22:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof22
}
stCase22:
switch (m.data)[(m.p)] {
case 45:
goto st23
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st23
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st23
}
default:
goto st23
}
goto tr6
st23:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof23
}
stCase23:
switch (m.data)[(m.p)] {
case 45:
goto st24
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st24
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st24
}
default:
goto st24
}
goto tr6
st24:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof24
}
stCase24:
switch (m.data)[(m.p)] {
case 45:
goto st25
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st25
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st25
}
default:
goto st25
}
goto tr6
st25:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof25
}
stCase25:
switch (m.data)[(m.p)] {
case 45:
goto st26
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st26
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st26
}
default:
goto st26
}
goto tr6
st26:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof26
}
stCase26:
switch (m.data)[(m.p)] {
case 45:
goto st27
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st27
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st27
}
default:
goto st27
}
goto tr6
st27:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof27
}
stCase27:
switch (m.data)[(m.p)] {
case 45:
goto st28
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st28
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st28
}
default:
goto st28
}
goto tr6
st28:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof28
}
stCase28:
switch (m.data)[(m.p)] {
case 45:
goto st29
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st29
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st29
}
default:
goto st29
}
goto tr6
st29:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof29
}
stCase29:
switch (m.data)[(m.p)] {
case 45:
goto st30
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st30
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st30
}
default:
goto st30
}
goto tr6
st30:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof30
}
stCase30:
switch (m.data)[(m.p)] {
case 45:
goto st31
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st31
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st31
}
default:
goto st31
}
goto tr6
st31:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof31
}
stCase31:
switch (m.data)[(m.p)] {
case 45:
goto st32
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st32
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st32
}
default:
goto st32
}
goto tr6
st32:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof32
}
stCase32:
switch (m.data)[(m.p)] {
case 45:
goto st33
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st33
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st33
}
default:
goto st33
}
goto tr6
st33:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof33
}
stCase33:
switch (m.data)[(m.p)] {
case 45:
goto st34
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st34
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st34
}
default:
goto st34
}
goto tr6
st34:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof34
}
stCase34:
switch (m.data)[(m.p)] {
case 45:
goto st35
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st35
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st35
}
default:
goto st35
}
goto tr6
st35:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof35
}
stCase35:
switch (m.data)[(m.p)] {
case 45:
goto st36
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st36
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st36
}
default:
goto st36
}
goto tr6
st36:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof36
}
stCase36:
switch (m.data)[(m.p)] {
case 45:
goto st37
case 58:
goto tr10
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st37
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st37
}
default:
goto st37
}
goto tr6
st37:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof37
}
stCase37:
if (m.data)[(m.p)] == 58 {
goto tr10
}
goto tr6
tr10:
output.ID = string(m.text())
goto st38
st38:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof38
}
stCase38:
switch (m.data)[(m.p)] {
case 33:
goto tr42
case 36:
goto tr42
case 37:
goto tr43
case 61:
goto tr42
case 95:
goto tr42
}
switch {
case (m.data)[(m.p)] < 48:
if 39 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 46 {
goto tr42
}
case (m.data)[(m.p)] > 59:
switch {
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto tr42
}
case (m.data)[(m.p)] >= 64:
goto tr42
}
default:
goto tr42
}
goto tr41
tr42:
m.pb = m.p
goto st44
st44:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof44
}
stCase44:
switch (m.data)[(m.p)] {
case 33:
goto st44
case 36:
goto st44
case 37:
goto st39
case 61:
goto st44
case 95:
goto st44
}
switch {
case (m.data)[(m.p)] < 48:
if 39 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 46 {
goto st44
}
case (m.data)[(m.p)] > 59:
switch {
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st44
}
case (m.data)[(m.p)] >= 64:
goto st44
}
default:
goto st44
}
goto tr41
tr43:
m.pb = m.p
goto st39
st39:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof39
}
stCase39:
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st40
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st40
}
default:
goto tr46
}
goto tr44
tr46:
m.tolower = append(m.tolower, m.p-m.pb)
goto st40
st40:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof40
}
stCase40:
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st45
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st45
}
default:
goto tr48
}
goto tr44
tr48:
m.tolower = append(m.tolower, m.p-m.pb)
goto st45
st45:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof45
}
stCase45:
switch (m.data)[(m.p)] {
case 33:
goto st44
case 36:
goto st44
case 37:
goto st39
case 61:
goto st44
case 95:
goto st44
}
switch {
case (m.data)[(m.p)] < 48:
if 39 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 46 {
goto st44
}
case (m.data)[(m.p)] > 59:
switch {
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st44
}
case (m.data)[(m.p)] >= 64:
goto st44
}
default:
goto st44
}
goto tr44
tr8:
m.pb = m.p
goto st41
st41:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof41
}
stCase41:
switch (m.data)[(m.p)] {
case 45:
goto st7
case 58:
goto tr10
case 82:
goto st42
case 114:
goto st42
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st7
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st7
}
default:
goto st7
}
goto tr6
st42:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof42
}
stCase42:
switch (m.data)[(m.p)] {
case 45:
goto st8
case 58:
goto tr10
case 78:
goto st43
case 110:
goto st43
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st8
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st8
}
default:
goto st8
}
goto tr50
st43:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof43
}
stCase43:
if (m.data)[(m.p)] == 45 {
goto st9
}
switch {
case (m.data)[(m.p)] < 65:
if 48 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 57 {
goto st9
}
case (m.data)[(m.p)] > 90:
if 97 <= (m.data)[(m.p)] && (m.data)[(m.p)] <= 122 {
goto st9
}
default:
goto st9
}
goto tr52
st46:
if (m.p)++; (m.p) == (m.pe) {
goto _testEof46
}
stCase46:
switch (m.data)[(m.p)] {
case 10:
goto st0
case 13:
goto st0
}
goto st46
stOut:
_testEof2:
m.cs = 2
goto _testEof
_testEof3:
m.cs = 3
goto _testEof
_testEof4:
m.cs = 4
goto _testEof
_testEof5:
m.cs = 5
goto _testEof
_testEof6:
m.cs = 6
goto _testEof
_testEof7:
m.cs = 7
goto _testEof
_testEof8:
m.cs = 8
goto _testEof
_testEof9:
m.cs = 9
goto _testEof
_testEof10:
m.cs = 10
goto _testEof
_testEof11:
m.cs = 11
goto _testEof
_testEof12:
m.cs = 12
goto _testEof
_testEof13:
m.cs = 13
goto _testEof
_testEof14:
m.cs = 14
goto _testEof
_testEof15:
m.cs = 15
goto _testEof
_testEof16:
m.cs = 16
goto _testEof
_testEof17:
m.cs = 17
goto _testEof
_testEof18:
m.cs = 18
goto _testEof
_testEof19:
m.cs = 19
goto _testEof
_testEof20:
m.cs = 20
goto _testEof
_testEof21:
m.cs = 21
goto _testEof
_testEof22:
m.cs = 22
goto _testEof
_testEof23:
m.cs = 23
goto _testEof
_testEof24:
m.cs = 24
goto _testEof
_testEof25:
m.cs = 25
goto _testEof
_testEof26:
m.cs = 26
goto _testEof
_testEof27:
m.cs = 27
goto _testEof
_testEof28:
m.cs = 28
goto _testEof
_testEof29:
m.cs = 29
goto _testEof
_testEof30:
m.cs = 30
goto _testEof
_testEof31:
m.cs = 31
goto _testEof
_testEof32:
m.cs = 32
goto _testEof
_testEof33:
m.cs = 33
goto _testEof
_testEof34:
m.cs = 34
goto _testEof
_testEof35:
m.cs = 35
goto _testEof
_testEof36:
m.cs = 36
goto _testEof
_testEof37:
m.cs = 37
goto _testEof
_testEof38:
m.cs = 38
goto _testEof
_testEof44:
m.cs = 44
goto _testEof
_testEof39:
m.cs = 39
goto _testEof
_testEof40:
m.cs = 40
goto _testEof
_testEof45:
m.cs = 45
goto _testEof
_testEof41:
m.cs = 41
goto _testEof
_testEof42:
m.cs = 42
goto _testEof
_testEof43:
m.cs = 43
goto _testEof
_testEof46:
m.cs = 46
goto _testEof
_testEof:
{
}
if (m.p) == (m.eof) {
switch m.cs {
case 44, 45:
raw := m.text()
output.SS = string(raw)
// Iterate upper letters lowering them
for _, i := range m.tolower {
raw[i] = raw[i] + 32
}
output.norm = string(raw)
case 1, 2, 4:
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
case 3:
m.err = fmt.Errorf(errPrefix, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
case 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, 41:
m.err = fmt.Errorf(errIdentifier, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
case 38:
m.err = fmt.Errorf(errSpecificString, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
case 42:
m.err = fmt.Errorf(errPrefix, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errIdentifier, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
case 43:
m.err = fmt.Errorf(errNoUrnWithinID, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errIdentifier, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
case 39, 40:
m.err = fmt.Errorf(errHex, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errSpecificString, m.p)
(m.p)--
{
goto st46
}
m.err = fmt.Errorf(errParse, m.p)
(m.p)--
{
goto st46
}
}
}
_out:
{
}
}
if m.cs < firstFinal || m.cs == enFail {
return nil, m.err
}
return output, nil
}
|