Robert Bieber | a089fcc | 2010-05-25 22:39:07 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2010 Robert Bieber |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | |
Robert Bieber | 8ea056d | 2010-05-27 19:57:15 +0000 | [diff] [blame] | 22 | extern "C" |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 23 | { |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 24 | #include "skin_parser.h" |
| 25 | #include "skin_debug.h" |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | #include <cstdlib> |
| 29 | #include <cstdio> |
Robert Bieber | 6980c1e | 2010-05-29 00:04:04 +0000 | [diff] [blame] | 30 | #include <iostream> |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 31 | |
| 32 | #include <QtGui/QApplication> |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 33 | #include <QTreeView> |
| 34 | |
Robert Bieber | 565cd00 | 2010-05-26 21:13:14 +0000 | [diff] [blame] | 35 | #include "parsetreemodel.h" |
| 36 | |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 37 | int main(int argc, char* argv[]) |
| 38 | { |
Robert Bieber | 9f2e1b1 | 2010-05-30 01:47:35 +0000 | [diff] [blame^] | 39 | QApplication app(argc, argv); |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 40 | |
Robert Bieber | 6980c1e | 2010-05-29 00:04:04 +0000 | [diff] [blame] | 41 | char doc[] = "#Comment\n%Vd(U);Hey\n%?bl(test,3,5,2,1)<param2|param3>"; |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 42 | |
Robert Bieber | 9f2e1b1 | 2010-05-30 01:47:35 +0000 | [diff] [blame^] | 43 | ParseTreeModel tree(doc); |
| 44 | |
| 45 | QTreeView view; |
| 46 | view.setModel(&tree); |
| 47 | view.show(); |
| 48 | |
| 49 | return app.exec(); |
| 50 | |
| 51 | /* |
Robert Bieber | 8ea056d | 2010-05-27 19:57:15 +0000 | [diff] [blame] | 52 | struct skin_element* test = skin_parse(doc); |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 53 | |
Robert Bieber | 9f2e1b1 | 2010-05-30 01:47:35 +0000 | [diff] [blame^] | 54 | ParseTreeModel tree(doc); |
Robert Bieber | 6980c1e | 2010-05-29 00:04:04 +0000 | [diff] [blame] | 55 | std::cout << "----" << std::endl; |
| 56 | if(std::string(doc) == tree.genCode().toStdString()) |
| 57 | std::cout << "Code in/out matches" << std::endl; |
| 58 | else |
| 59 | std::cout << "Match error" << std::endl; |
| 60 | |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 61 | |
Robert Bieber | 8ea056d | 2010-05-27 19:57:15 +0000 | [diff] [blame] | 62 | skin_free_tree(test); |
Robert Bieber | 9f2e1b1 | 2010-05-30 01:47:35 +0000 | [diff] [blame^] | 63 | */ |
Robert Bieber | 8ea056d | 2010-05-27 19:57:15 +0000 | [diff] [blame] | 64 | |
Robert Bieber | 0769fc5 | 2010-05-25 22:24:08 +0000 | [diff] [blame] | 65 | } |
| 66 | |