| 126 | } |
| 127 | |
| 128 | size_t IfcSpfLexer::skipComment() const { |
| 129 | if (stream->eof()) { |
| 130 | return 0; |
| 131 | } |
| 132 | char character = stream->peek(); |
| 133 | if (character != '/') { |
| 134 | return 0; |
| 135 | } |
| 136 | stream->increment(); |
| 137 | character = stream->peek(); |
| 138 | if (character != '*') { |
| 139 | stream->seek(stream->tell() - 1); |
| 140 | return 0; |
| 141 | } |
| 142 | size_t index = 2; |
| 143 | char intermediate = 0; |
| 144 | while (!stream->eof()) { |
| 145 | character = stream->peek(); |
| 146 | stream->increment(); |
| 147 | ++index; |
| 148 | if (character == '/' && intermediate == '*') { |
| 149 | break; |
| 150 | } |
| 151 | intermediate = character; |
| 152 | } |
| 153 | return index; |
| 154 | } |
| 155 | |
| 156 | // |
| 157 | // Returns the offset of the current Token and moves cursor to next |