[vala/wip/dbusgen: 365/390] now parses properties and doc tags correctly




commit e47753c66f7688c8ef5ad3c6d0254d29f6a0f4b6
Author: Chris Daley <chebizarro gmail com>
Date:   Thu Nov 23 06:41:38 2017 -0800

    now parses properties and doc tags correctly

 dbusgen/valadbusgen.vala    |  4 ++--
 dbusgen/valadbusparser.vala | 41 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/dbusgen/valadbusgen.vala b/dbusgen/valadbusgen.vala
index 68049f3d4..ad65f8697 100644
--- a/dbusgen/valadbusgen.vala
+++ b/dbusgen/valadbusgen.vala
@@ -185,7 +185,7 @@ public class Vala.DBusGen {
                        return 1;
                }
 
-               var DBusGen = new DBusGen ();
-               return DBusGen.run ();
+               var dbusgen = new DBusGen ();
+               return dbusgen.run ();
        }
 }
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index b1649bd5d..b7dc93293 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -79,15 +79,14 @@ public class Vala.DBusParser : CodeVisitor {
 
                current_source_file.add_node (context.root);
 
-               next ();
-               next ();
-               next ();
+               while (current_token != MarkupTokenType.START_ELEMENT && reader.name != "node") {
+                       next ();
+               }
 
                parse_node ();
                this.current_source_file = null;
 
                this.reader = null;
-
        }
 
        private void parse_node () {
@@ -102,6 +101,9 @@ public class Vala.DBusParser : CodeVisitor {
                                        parse_namespace ();
                                        parse_interface ();
                                        break;
+                               case "doc:doc":
+                                       parse_doc ();
+                                       break;
                                //case "node":
                                //      parse_node ();
                                        //break;
@@ -177,6 +179,9 @@ public class Vala.DBusParser : CodeVisitor {
                                case "property":
                                        parse_property ();
                                        break;
+                               case "doc:doc":
+                                       parse_doc ();
+                                       break;
                                default:
                                        parse_extension ();
                                        break;
@@ -277,6 +282,7 @@ public class Vala.DBusParser : CodeVisitor {
 
                current_node = current_property = new Property (attribs["name"], type, get_access, 
set_access, get_current_src ());
                current_property.is_abstract = true;
+               current_property.access = SymbolAccessibility.PUBLIC;
                current_iface.add_property (current_property);
 
                next ();
@@ -284,6 +290,8 @@ public class Vala.DBusParser : CodeVisitor {
                while (current_token == MarkupTokenType.START_ELEMENT) {
                        if (reader.name == "annotation") {
                                parse_annotation ();
+                       } else if (reader.name == "doc:doc") {
+                               parse_doc ();
                        }
                }
 
@@ -302,6 +310,9 @@ public class Vala.DBusParser : CodeVisitor {
                                case "arg":
                                        parse_arg ();
                                        break;
+                               case "doc:doc":
+                                       parse_doc ();
+                                       break;
                                default:
                                        parse_extension ();
                                        break;
@@ -334,6 +345,15 @@ public class Vala.DBusParser : CodeVisitor {
                }
 
                next ();
+
+               while (current_token == MarkupTokenType.START_ELEMENT) {
+                       if (reader.name == "annotation") {
+                               parse_annotation ();
+                       } else if (reader.name == "doc:doc") {
+                               parse_doc ();
+                       }
+               }
+
                end_element ("arg");
        }
 
@@ -341,6 +361,18 @@ public class Vala.DBusParser : CodeVisitor {
                next ();
        }
 
+       private void parse_doc () {
+               start_element ("doc:doc");
+
+               while (true) {
+                       next ();
+                       if (current_token == MarkupTokenType.END_ELEMENT && reader.name == "doc:doc") {
+                               break;
+                       }
+               }
+               end_element ("doc:doc");
+       }
+
        private void parse_signal () {
                start_element ("signal");
 
@@ -402,5 +434,4 @@ public class Vala.DBusParser : CodeVisitor {
                        next ();
                }
        }
-
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]