get next semantically valid character
| 2992 | |
| 2993 | // get next semantically valid character |
| 2994 | int vtkFoamFile::NextTokenHead() |
| 2995 | { |
| 2996 | while (true) |
| 2997 | { |
| 2998 | int c; |
| 2999 | while (isspace(c = this->Getc())) // isspace() accepts -1 as EOF |
| 3000 | { |
| 3001 | if (c == '\n') |
| 3002 | { |
| 3003 | ++this->Superclass::LineNumber; |
| 3004 | #if VTK_FOAMFILE_RECOGNIZE_LINEHEAD |
| 3005 | this->Superclass::WasNewline = true; |
| 3006 | #endif |
| 3007 | } |
| 3008 | } |
| 3009 | if (c == '/') |
| 3010 | { |
| 3011 | if ((c = this->Getc()) == '/') |
| 3012 | { |
| 3013 | while ((c = this->Getc()) != EOF && c != '\n') |
| 3014 | ; |
| 3015 | if (c == EOF) |
| 3016 | { |
| 3017 | return c; |
| 3018 | } |
| 3019 | ++this->Superclass::LineNumber; |
| 3020 | #if VTK_FOAMFILE_RECOGNIZE_LINEHEAD |
| 3021 | this->Superclass::WasNewline = true; |
| 3022 | #endif |
| 3023 | } |
| 3024 | else if (c == '*') |
| 3025 | { |
| 3026 | while (true) |
| 3027 | { |
| 3028 | while ((c = this->Getc()) != EOF && c != '*') |
| 3029 | { |
| 3030 | if (c == '\n') |
| 3031 | { |
| 3032 | ++this->Superclass::LineNumber; |
| 3033 | } |
| 3034 | } |
| 3035 | if (c == EOF) |
| 3036 | { |
| 3037 | return c; |
| 3038 | } |
| 3039 | else if ((c = this->Getc()) == '/') |
| 3040 | { |
| 3041 | break; |
| 3042 | } |
| 3043 | this->PutBack(c); |
| 3044 | } |
| 3045 | } |
| 3046 | else |
| 3047 | { |
| 3048 | this->PutBack(c); // may be an EOF |
| 3049 | return '/'; |
| 3050 | } |
| 3051 | } |
no test coverage detected