------------------------------------------------------------------------------
| 1875 | |
| 1876 | //------------------------------------------------------------------------------ |
| 1877 | void vtkFunctionParser::CheckExpression(int& pos, char** error) |
| 1878 | { |
| 1879 | if (this->FunctionMTime.GetMTime() > this->CheckMTime.GetMTime()) |
| 1880 | { |
| 1881 | // Need to parse again. |
| 1882 | |
| 1883 | // Reset previous error cache. |
| 1884 | this->ParseErrorPositon = -1; |
| 1885 | this->SetParseError(nullptr); |
| 1886 | |
| 1887 | this->CopyParseError(pos, error); |
| 1888 | } |
| 1889 | else |
| 1890 | { |
| 1891 | this->CopyParseError(pos, error); |
| 1892 | return; |
| 1893 | } |
| 1894 | |
| 1895 | this->CheckMTime.Modified(); |
| 1896 | |
| 1897 | this->RemoveSpaces(); |
| 1898 | |
| 1899 | int index = 0, parenthesisCount = 0, currentChar; |
| 1900 | int functionNumber, constantNumber; |
| 1901 | int* expectCommaOnParenthesisCount = new int[this->FunctionLength]; |
| 1902 | int* expectTwoCommasOnParenthesisCount = new int[this->FunctionLength]; |
| 1903 | int i; |
| 1904 | |
| 1905 | for (i = 0; i < this->FunctionLength; i++) |
| 1906 | { |
| 1907 | expectCommaOnParenthesisCount[i] = 0; |
| 1908 | expectTwoCommasOnParenthesisCount[i] = 0; |
| 1909 | } |
| 1910 | |
| 1911 | while (true) |
| 1912 | { |
| 1913 | currentChar = this->Function[index]; |
| 1914 | bool breakToOuterLoop = false; |
| 1915 | |
| 1916 | // Check for valid operand (must appear) |
| 1917 | |
| 1918 | // Check for leading - |
| 1919 | if (currentChar == '-') |
| 1920 | { |
| 1921 | currentChar = this->Function[++index]; |
| 1922 | if (index == this->FunctionLength) |
| 1923 | { |
| 1924 | this->ParseErrorPositon = this->FindPositionInOriginalFunction(index); |
| 1925 | this->SetParseError("Syntax error: unary minus with no operand"); |
| 1926 | this->CopyParseError(pos, error); |
| 1927 | delete[] expectCommaOnParenthesisCount; |
| 1928 | delete[] expectTwoCommasOnParenthesisCount; |
| 1929 | return; |
| 1930 | } |
| 1931 | } |
| 1932 | |
| 1933 | // Check for leading + |
| 1934 | if (currentChar == '+') |
no test coverage detected