| 784 | ((c == ' ') || (c == '\n') || (c == '\r') || (c == '\t')) |
| 785 | |
| 786 | void PiuDebugMachineParse(PiuDebugMachine self, char* theString, int theLength) |
| 787 | { |
| 788 | char c; |
| 789 | while (theLength) { |
| 790 | c = *theString++; |
| 791 | switch (self->state) { |
| 792 | case XS_BODY_STATE: |
| 793 | if (c == '<') |
| 794 | self->state = XS_TAG_STATE; |
| 795 | break; |
| 796 | |
| 797 | case XS_DATA_STATE: |
| 798 | if (c == '<') { |
| 799 | self->data[self->dataIndex] = 0; |
| 800 | PiuDebugMachineParseDataEnd(self); |
| 801 | self->dataIndex = 0; |
| 802 | self->state = XS_TAG_STATE; |
| 803 | } |
| 804 | else if (c == '&') { |
| 805 | self->entityState = XS_DATA_STATE; |
| 806 | self->state = XS_ENTITY_STATE; |
| 807 | } |
| 808 | else { |
| 809 | if (self->dataIndex == XS_BUFFER_COUNT) { |
| 810 | self->data[self->dataIndex] = 0; |
| 811 | PiuDebugMachineParseDataContinue(self); |
| 812 | self->dataIndex = 0; |
| 813 | } |
| 814 | self->data[self->dataIndex] = c; |
| 815 | self->dataIndex++; |
| 816 | } |
| 817 | break; |
| 818 | |
| 819 | case XS_TAG_STATE: |
| 820 | if (c == '/') |
| 821 | self->state = XS_END_TAG_STATE; |
| 822 | else if (c == '?') { |
| 823 | self->state = XS_PROCESSING_INSTRUCTION_STATE; |
| 824 | self->tagIndex = 0; |
| 825 | } |
| 826 | else if (mxIsFirstLetter(c)) { |
| 827 | self->state = XS_START_TAG_NAME_STATE; |
| 828 | self->tag[0] = c; |
| 829 | self->tagIndex = 1; |
| 830 | } |
| 831 | else |
| 832 | self->state = XS_ERROR_STATE; |
| 833 | break; |
| 834 | |
| 835 | case XS_START_TAG_NAME_STATE: |
| 836 | if (mxIsNextLetter(c) && (self->tagIndex < XS_BUFFER_COUNT)) { |
| 837 | self->tag[self->tagIndex] = c; |
| 838 | self->tagIndex++; |
| 839 | break; |
| 840 | } |
| 841 | else { |
| 842 | self->tag[self->tagIndex] = 0; |
| 843 | PiuDebugMachinePushTag(self, self->tag); |
no test coverage detected