summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/main.cpp14
-rw-r--r--utils/themeeditor/parsetreemodel.cpp1
-rw-r--r--utils/themeeditor/parsetreenode.cpp30
-rw-r--r--utils/themeeditor/parsetreenode.h4
-rw-r--r--utils/themeeditor/skin_debug.c19
-rw-r--r--utils/themeeditor/skin_parser.c14
-rw-r--r--utils/themeeditor/skin_parser.h3
7 files changed, 58 insertions, 27 deletions
diff --git a/utils/themeeditor/main.cpp b/utils/themeeditor/main.cpp
index b43b419143..49e870c369 100644
--- a/utils/themeeditor/main.cpp
+++ b/utils/themeeditor/main.cpp
@@ -19,13 +19,10 @@
*
****************************************************************************/
-namespace wps
+extern "C"
{
- extern "C"
- {
#include "skin_parser.h"
#include "skin_debug.h"
- }
}
#include <cstdlib>
@@ -39,13 +36,14 @@ namespace wps
int main(int argc, char* argv[])
{
- char* doc = "%Vd(U)\n\n%?bl(test,3,5,2,1)<param2|param3>";
+ char doc[] = "%Vd(U);Hey\n%?bl(test,3,5,2,1)<param2|param3>";
- struct wps::skin_element* test = wps::skin_parse(doc);
+ struct skin_element* test = skin_parse(doc);
- wps::skin_debug_tree(test);
+ skin_debug_tree(test);
+
+ skin_free_tree(test);
- wps::skin_free_tree(test);
QApplication app(argc, argv);
diff --git a/utils/themeeditor/parsetreemodel.cpp b/utils/themeeditor/parsetreemodel.cpp
index cf6af14a5e..aa5fb5cdb8 100644
--- a/utils/themeeditor/parsetreemodel.cpp
+++ b/utils/themeeditor/parsetreemodel.cpp
@@ -27,7 +27,6 @@ ParseTreeModel::ParseTreeModel(char* wps, QObject* parent):
QAbstractItemModel(parent)
{
this->wps = skin_parse(wps);
- skin_debug_tree(this->wps);
this->root = new ParseTreeNode(this->wps, 0, true);
}
diff --git a/utils/themeeditor/parsetreenode.cpp b/utils/themeeditor/parsetreenode.cpp
index 97cb559906..77ec897dd7 100644
--- a/utils/themeeditor/parsetreenode.cpp
+++ b/utils/themeeditor/parsetreenode.cpp
@@ -1,16 +1,34 @@
#include "parsetreenode.h"
ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent,
- bool stop):
- parentLink(parent), element(data)
+ bool tree)
{
- if(stop)
- return;
- for(int i = 0; i < 5; i++)
- appendChild(new ParseTreeNode(data, this, true));
+ if(tree)
+ {
+ while(data)
+ {
+ appendChild(new ParseTreeNode(data, this, false));
+ data = data->next;
+ }
+ parentLink = 0;
+ }
+ else
+ {
+ element = data;
+ parentLink = parent;
+ }
+
}
+ParseTreeNode::ParseTreeNode(struct skin_tag_parameter* param,
+ ParseTreeNode* parent)
+ :parentLink(parent), element(0), param(param)
+{
+
+}
+
+
ParseTreeNode::~ParseTreeNode()
{
qDeleteAll(children);
diff --git a/utils/themeeditor/parsetreenode.h b/utils/themeeditor/parsetreenode.h
index bc091b9aa4..c3372e0a20 100644
--- a/utils/themeeditor/parsetreenode.h
+++ b/utils/themeeditor/parsetreenode.h
@@ -13,7 +13,8 @@ extern "C"
class ParseTreeNode
{
public:
- ParseTreeNode(struct skin_element* data, ParseTreeNode* parent, bool stop = false);
+ ParseTreeNode(struct skin_element* data, ParseTreeNode* parent, bool tree);
+ ParseTreeNode(struct skin_tag_parameter* param, ParseTreeNode* parent);
virtual ~ParseTreeNode();
void appendChild(ParseTreeNode* child);
@@ -29,6 +30,7 @@ private:
ParseTreeNode* parentLink;
QList<ParseTreeNode*> children;
struct skin_element* element;
+ struct skin_tag_parameter* param;
};
diff --git a/utils/themeeditor/skin_debug.c b/utils/themeeditor/skin_debug.c
index f275b0403d..5d37f64a11 100644
--- a/utils/themeeditor/skin_debug.c
+++ b/utils/themeeditor/skin_debug.c
@@ -129,17 +129,10 @@ void skin_debug_tree(struct skin_element* root)
debug_indent_level++;
for(i = 0; i < current->children_count; i++)
{
- skin_debug_indent();
- printf("[ Subline %d\n", i);
-
- debug_indent_level++;
skin_debug_tree(current->children[i]);
- debug_indent_level--;
-
- skin_debug_indent();
- printf("]\n");
}
debug_indent_level--;
+
skin_debug_indent();
printf("]\n");
break;
@@ -175,6 +168,16 @@ void skin_debug_tree(struct skin_element* root)
break;
+ case LINE:
+ printf("[ Logical line on line %d\n", current->line);
+
+ debug_indent_level++;
+ skin_debug_tree(current->children[0]);
+ debug_indent_level--;
+
+ skin_debug_indent();
+ printf("]\n");
+ break;
}
current = current->next;
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index dd061a1ac9..a6c5ea41a2 100644
--- a/utils/themeeditor/skin_parser.c
+++ b/utils/themeeditor/skin_parser.c
@@ -151,6 +151,14 @@ struct skin_element* skin_parse_line_optional(char** document, int conditional)
struct skin_element* root = NULL;
struct skin_element* current = NULL;
+ struct skin_element* retval = NULL;
+
+ /* A wrapper for the line */
+ retval = skin_alloc_element();
+ retval->type = LINE;
+ retval->line = skin_line;
+ retval->children_count = 1;
+ retval->children = skin_alloc_children(1);
while(*cursor != '\n' && *cursor != '\0' && *cursor != MULTILINESYM
&& !((*cursor == ARGLISTSEPERATESYM
@@ -214,7 +222,8 @@ struct skin_element* skin_parse_line_optional(char** document, int conditional)
/* Moving up the calling function's pointer */
*document = cursor;
- return root;
+ retval->children[0] = root;
+ return retval;
}
struct skin_element* skin_parse_sublines(char** document)
@@ -233,6 +242,7 @@ struct skin_element* skin_parse_sublines_optional(char** document,
retval = skin_alloc_element();
retval->type = SUBLINES;
retval->next = NULL;
+ retval->line = skin_line;
/* First we count the sublines */
while(*cursor != '\0' && *cursor != '\n'
@@ -276,7 +286,7 @@ struct skin_element* skin_parse_sublines_optional(char** document,
skin_error(MULTILINE_EXPECTED);
return NULL;
}
- else
+ else if(i != sublines - 1)
{
cursor++;
}
diff --git a/utils/themeeditor/skin_parser.h b/utils/themeeditor/skin_parser.h
index 50980023b5..7de726bbfc 100644
--- a/utils/themeeditor/skin_parser.h
+++ b/utils/themeeditor/skin_parser.h
@@ -41,7 +41,8 @@ enum skin_element_type
COMMENT,
TAG,
CONDITIONAL,
- SUBLINES
+ SUBLINES,
+ LINE
};
enum skin_errorcode