- Timestamp:
- Jan 21, 2018, 5:59:24 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c
r40291 r40315 186 186 got_two_op: 187 187 if (!status) { 188 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", stack[i-1].name, stack[i-2].name); 188 // we are guaranteed to have stack[i-1] and stack[i-2] since i >= 2 (above) 189 char tmpvector[] = "Temporary Vector"; 190 char tmpmatrix[] = "Temporary Matrix"; 191 192 char *name1 = NULL; 193 if (stack[i-1].name) { 194 name1 = stack[i-1].name; 195 } else { 196 if (stack[i-1].type == ST_VECTOR_TMP) name1 = tmpvector; 197 if (stack[i-1].type == ST_MATRIX_TMP) name1 = tmpmatrix; 198 } 199 char *name2 = NULL; 200 if (stack[i-2].name) { 201 name2 = stack[i-2].name; 202 } else { 203 if (stack[i-2].type == ST_VECTOR_TMP) name2 = tmpvector; 204 if (stack[i-2].type == ST_MATRIX_TMP) name2 = tmpmatrix; 205 } 206 207 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", name1, name2); 189 208 push_error (line); 190 if (strchr(stack[i-1].name, ':') || strchr(stack[i-2].name, ':')) { 209 210 // we need to verify that .name exists for both 211 if ((stack[i-1].name && strchr(stack[i-1].name, ':')) || (stack[i-2].name && strchr(stack[i-2].name, ':'))) { 191 212 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n(Note that the : in a trinary operation must be protected by spaces)\n", stack[i-1].name, stack[i-2].name); 192 213 push_error (line);
Note:
See TracChangeset
for help on using the changeset viewer.
