Function that places string on stack, using list of NodeNumber in NodeExpressionList
| 713 | |
| 714 | // Function that places string on stack, using list of NodeNumber in NodeExpressionList |
| 715 | void AddStringNode(const char* s, const char* e, bool unescaped) |
| 716 | { |
| 717 | CodeInfo::lastKnownStartPos = s; |
| 718 | |
| 719 | const char *curr = s + 1, *end = e - 1; |
| 720 | unsigned int len = 0; |
| 721 | // Find the length of the string with collapsed escape-sequences |
| 722 | for(; curr < end; curr++, len++) |
| 723 | { |
| 724 | if(*curr == '\\' && !unescaped) |
| 725 | curr++; |
| 726 | } |
| 727 | curr = s + 1; |
| 728 | end = e - 1; |
| 729 | |
| 730 | CodeInfo::nodeList.push_back(new NodeZeroOP()); |
| 731 | TypeInfo *targetType = CodeInfo::GetArrayType(typeChar, len + 1); |
| 732 | CodeInfo::nodeList.push_back(new NodeExpressionList(targetType)); |
| 733 | |
| 734 | NodeZeroOP* temp = CodeInfo::nodeList.back(); |
| 735 | CodeInfo::nodeList.pop_back(); |
| 736 | |
| 737 | NodeExpressionList *arrayList = static_cast<NodeExpressionList*>(temp); |
| 738 | |
| 739 | while(end-curr > 0) |
| 740 | { |
| 741 | char clean[4]; |
| 742 | *(int*)clean = 0; |
| 743 | |
| 744 | for(int i = 0; i < 4 && curr < end; i++, curr++) |
| 745 | { |
| 746 | clean[i] = *curr; |
| 747 | if(*curr == '\\' && !unescaped) |
| 748 | { |
| 749 | curr++; |
| 750 | CodeInfo::lastKnownStartPos = curr; |
| 751 | clean[i] = UnescapeSybmol(*curr); |
| 752 | } |
| 753 | } |
| 754 | CodeInfo::nodeList.push_back(new NodeNumber(*(int*)clean, typeInt)); |
| 755 | arrayList->AddNode(); |
| 756 | } |
| 757 | if(len % 4 == 0) |
| 758 | { |
| 759 | CodeInfo::nodeList.push_back(new NodeNumber(0, typeInt)); |
| 760 | arrayList->AddNode(); |
| 761 | } |
| 762 | CodeInfo::nodeList.push_back(temp); |
| 763 | } |
| 764 | |
| 765 | // Function that creates node that removes value on top of the stack |
| 766 | void AddPopNode(const char* pos) |
no test coverage detected