src/parser.cpp

changeset 259
c27612f0eac0
parent 242
16855456992d
child 264
76a025db4948
equal deleted inserted replaced
258:fe094d0687ad 259:c27612f0eac0
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #include <QRegExp>
20 #include <QIODevice>
19 #include "model.h" 21 #include "model.h"
20 #include "parser.h" 22 #include "parser.h"
21 #include "ldrawalgorithm.h" 23 #include "ldrawalgorithm.h"
22 24
23 struct BodyParseError 25 struct BodyParseError
199 ModelElement parseLDrawLine(QString line) 201 ModelElement parseLDrawLine(QString line)
200 { 202 {
201 line = line.trimmed(); 203 line = line.trimmed();
202 try 204 try
203 { 205 {
204 const QStringList tokens = line.split(QRegExp{R"(\s+)"}); 206 const QStringList tokens = line.simplified().split(" ");
205 if (tokens.empty() or tokens == QStringList{{""}}) 207 if (tokens.empty() or tokens == QStringList{{""}})
206 { 208 {
207 return Empty{}; 209 return Empty{};
208 } 210 }
209 bool ok_code; 211 bool ok_code;

mercurial