| 2662 | } |
| 2663 | |
| 2664 | static const char* CheckAssignment(const char* p) |
| 2665 | { |
| 2666 | // Check for `private _identifier = value` shorthand (modern-SQF style). |
| 2667 | // strncmp (not memcmp) so a buffer shorter than 7 bytes stops at the NUL |
| 2668 | // instead of reading past it. |
| 2669 | if (strncmp(p, "private", 7) == 0 && !isalnumext(p[7])) |
| 2670 | { |
| 2671 | const char* q = p + 7; |
| 2672 | while (*q && isspace(*q)) |
| 2673 | q++; |
| 2674 | if (*q == '_') |
| 2675 | { |
| 2676 | const char* r = q; |
| 2677 | while (*r && isalnumext(*r)) |
| 2678 | r++; |
| 2679 | while (*r && isspace(*r)) |
| 2680 | r++; |
| 2681 | if (r[0] == '=' && r[1] != '=') |
| 2682 | return r; |
| 2683 | } |
| 2684 | } |
| 2685 | // Standard `identifier = value` assignment. |
| 2686 | while (*p && isalnumext(*p)) |
| 2687 | { |
| 2688 | p++; |
| 2689 | } |
| 2690 | while (*p && isspace(*p)) |
| 2691 | { |
| 2692 | p++; |
| 2693 | } |
| 2694 | if (p[0] == '=' && p[1] != '=') |
| 2695 | { |
| 2696 | return p; |
| 2697 | } |
| 2698 | return nullptr; |
| 2699 | } |
| 2700 | |
| 2701 | // localOnly restricts assignments to local variables. |
| 2702 | GameValue GameState::EvaluateMultiple(const char* expression, bool localOnly) const |
no test coverage detected