summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
Commit message (Collapse)AuthorAgeFilesLines
* giscanner: Test fixups for field annotations and documentationStef Walter2013-10-281-7/+12
| | | | Related to: https://bugzilla.gnome.org/show_bug.cgi?id=710561
* giscanner: fix description field storage in .gir filesDieter Verfaillie2013-10-081-4/+16
| | | | | | | | | | | | | | | | | | GTK-Doc description fields for tags can contain multiple lines and even multiple paragraphs. Whitespace cannot be preserved in XML attributes, so we move the "deprecated" description text into a "<doc-deprecated />" element right next to where we already have the "<doc />" element. Keep the "deprecated" attribute around for backwards compatibility though, but set its value to "1" (analogous to the "writable", "contruct", etc attributes) if the annotated symbol is marked as deprecated. While at it, add <doc-version /> and <doc-stability /> which was not yet available in the .gir files... This takes care of the "Since:", "Stability:" and "Deprecated:" GTK-Doc tags. Nothing needs to be done for the "Returns:" tag as as we already write a "<doc />" child element on "<return-value />".
* giscanner: remove dead codeDieter Verfaillie2013-10-081-3/+0
| | | | | Last call sites where removed in 36aa515f1036978ced8d4ffb808260844f7229e0 about 3 years ago.
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-30/+24
| | | | | | | | | | | | | | | | | Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535
* scanner: internals cleanup: Move pkgconfig list to NamespaceColin Walters2013-02-261-6/+1
| | | | Continuation of previous work.
* scanner: internals cleanup: Move c_includes to NamespaceColin Walters2013-02-261-3/+1
| | | | Continuation of previous work.
* scanner: internals cleanup: Move shared libraries to NamespaceColin Walters2013-02-261-7/+1
| | | | Continuing on with previous commit.
* scanner: internals cleanup: Key more things off NamespaceColin Walters2013-02-261-5/+2
| | | | | | | | | | | The .gir format has a weird legacy where stuff like the includes are outside of the <namespace>. But conceptually they're tied together, so let's start reflecting this in the code. This way we can just pass around and look at a Namespace object instead of a 4-tuple of (namespace, includes, c_includes, pkg_config). https://bugzilla.gnome.org/show_bug.cgi?id=694593
* ast: Rename Class.parent to parent_typeJasper St. Pierre2013-02-151-1/+1
| | | | | | | | | The eventual model I want to have is that .parent is the "container" of the node. In all the cases where we don't explicitly set the parent, this is the namespace, but having this under one field name would be a big cleanup for the docwriter. https://bugzilla.gnome.org/show_bug.cgi?id=693876
* girparser: Clean up codeJasper St. Pierre2013-02-151-4/+4
| | | | | | This makes it only use kwargs https://bugzilla.gnome.org/show_bug.cgi?id=693876
* girparser: Serialize and read back the instance_parameterJasper St. Pierre2013-02-011-10/+16
| | | | | | | | g-ir-doc-tool wants to use the instance parameter to read docs and the parameter name, so it needs to be shuttled through the GIR. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* ast: Track enum/bitfield member parentsJasper St. Pierre2013-02-011-2/+4
| | | | | | | We need this for the doctool so that we can link to an enum definition when we reference one of the member values. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* girparser: Remove unused methodJasper St. Pierre2013-02-011-3/+0
| | | | | | | pylint was complaining about the non-existent instance member, self._filename https://bugzilla.gnome.org/show_bug.cgi?id=693040
* Ast: Add parent to FieldsGiovanni Campagna2012-10-281-9/+12
| | | | | | | Properties have it, there is no reason for Field not to, and in this way mallard docs can treat a field almost like a property. https://bugzilla.gnome.org/show_bug.cgi?id=683046
* Namespace: fix appending of nodesGiovanni Campagna2012-10-281-3/+11
| | | | | | | | Traverse appended nodes for methods, so that namespace.symbols contains all known symbols and not just global functions. Also, ensure that all relevant nodes are appended when parsing GIRs. https://bugzilla.gnome.org/show_bug.cgi?id=683046
* girparser: Track methods/constructors by symbolJasper St. Pierre2012-08-291-0/+1
| | | | | | | In order to be able to linkify a constructor/method, we need to first track it by symbol. https://bugzilla.gnome.org/show_bug.cgi?id=682969
* g-ir-doc-tool: More Mallard work, using experimantal api extensionShaun McCance2012-02-171-14/+16
|
* Add constant value annotationJohan Dahlin2011-09-141-2/+3
| | | | | Add an annotation tag "Value:" which can be used on constants to override the value.
* Allow enums and bitfields to have static methodsTorsten Schönfeld2011-08-161-0/+3
| | | | | | | | | | | | | This uses the same backcompat machinery that was introduced for static methods for non-class types, so this change does not break users of the existing presentations. New libgirepository API: g_enum_info_get_n_methods g_enum_info_get_method https://bugzilla.gnome.org/show_bug.cgi?id=656499
* Teach scanner's girparser about fundamentalsPavel Holejsovsky2011-08-161-0/+8
| | | | | | | Make sure that fundamental attribute and associated functions (ref-func, unref-func, set-value-func and get-value-func) are parsed, otherwise we fail reparse-validating girs containing fundamentals.
* Make sure signal works when there isn't one specifiedJohan Dahlin2011-08-131-1/+1
|
* Add signal flagsJohan Dahlin2011-08-131-1/+8
| | | | | | This adds all GSignalFlags into the gir. https://bugzilla.gnome.org/show_bug.cgi?id=656457
* scanner: add a moved_to property to backcompat functionsTorsten Schönfeld2011-08-131-0/+1
| | | | | | | Use it to remove backcompat copies of functions that non introspectable anyway. https://bugzilla.gnome.org/show_bug.cgi?id=572408
* scanner: Don't throw away blank lines in the docsColin Walters2011-08-131-1/+2
| | | | | | For generating documentation, we actually want to preserve these. https://bugzilla.gnome.org/show_bug.cgi?id=656389
* Switch to storing string form of error quarksDan Winship2011-08-121-2/+2
| | | | | | | | | | | | | | | | Instead of storing the name of the function to call to get the error quark, store the string form of the error quark, which we derive from the introspection binary during scanning. Update EnumBlob and GIEnumInfo to include the new information. This will allow determining a back-mapping from error quark to error domain without having to dlsym() and call all the known error quark functions. Based on earlier patches from Owen Taylor and Maxim Ermilov. https://bugzilla.gnome.org/show_bug.cgi?id=602516
* scanner: Fix handling of property transferColin Walters2011-01-051-2/+4
| | | | | | * gdumpparser.py was incorrectly passing the ctype for transfer * Property constructor wasn't actually doing anything with passed transfer * Parse transfer-ownership in girparser
* scanner: Properly parse recursive list type nodesColin Walters2011-01-051-5/+10
| | | | | | | Previously we were just looking for <type> inside a GLib.List, but it may be <array>. See bug 637262 for code that triggered this.
* [girparser] Callbacks and VFunctions can be shadowedJohan Dahlin2010-09-241-2/+3
|
* Add a script to extract gio annotationsJohan Dahlin2010-09-241-0/+3
|
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-0/+1
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* [scanner] Only store types in cache storeJohan Dahlin2010-09-201-16/+28
| | | | | | | | | | | | Only store types that can be referenced in the cache store this reduces the size of the serialized Gtk-3.0.gir in the store from 5.7M to 366k on my system. It also reduces the time it takes to create a gir in gtksourceview by 35% and the time to run the warnings test by more than 50% This also disables the cache for passthrough mode since it needs access to the whole serialized tree.
* Remove leftover, type is set aboveJohan Dahlin2010-09-201-1/+0
|
* scanner: Parse annotations for typedefsColin Walters2010-09-141-0/+1
| | | | | | | | * Explicitly check for ast.Alias in annotation pass * Add "generic" attribs handling for aliases like docs, introspectable=0 etc. https://bugzilla.gnome.org/show_bug.cgi?id=629668
* scanner: Unify parsing of compoundsColin Walters2010-09-091-38/+23
| | | | Avoids duplicate code.
* scanner: Kill glibastColin Walters2010-09-081-57/+39
| | | | | | | | | | | | It was a stupid abstraction split, we only support GObject. * Clean up how we handle c:type - we only set it if we've actually seen a corresponding structure. * Add a warning if we don't see the structure typedef for an interface, since that's pretty bogus. (And fix regress.h to have one) * Rename the "type_name" attribute internally to "gtype_name" for clarity.
* Major rewriteColin Walters2010-08-311-164/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the first big changes in this rewrite is changing the Type object to have separate target_fundamental and target_giname properties, rather than just being strings. Previously in the scanner, it was awful because we used heuristics around strings. The ast.py is refactored so that not everything is a Node - that was a rather useless abstraction. Now, only things which can have a GIName are Node. E.g. Type and Field are no longer Node. More things were merged from glibast.py into ast.py, since it isn't a very useful split. transformer.py gains more intelligence and will e.g. turn GLib.List into a List() object earlier. The namespace processing is a lot cleaner now; since we parse the included .girs, we know the C prefix for each namespace, and have functions to parse both C type names (GtkFooBar) and symbols gtk_foo_bar into their symbols cleanly. Type resolution is much, much saner because we know Type(target_giname=Gtk.Foo) maps to the namespace Gtk. glibtransformer.py now just handles the XML processing from the dump, and a few miscellaneous things. The major heavy lifting now lives in primarytransformer.py, which is a combination of most of annotationparser.py and half of glibtransformer.py. annotationparser.py now literally just parses annotations; it's no longer in the business of e.g. guessing transfer too. finaltransformer.py is a new file which does post-analysis for "introspectability" mainly. girparser.c is fixed for some introspectable=0 processing.
* Move alias target to <type>Colin Walters2010-08-311-1/+2
| | | | | | | This makes type parsing more uniform. Delete the typedef for GSList in foo.h - that's not supported anymore, or at least for now.
* Fix trailing whitespaceColin Walters2010-06-191-1/+1
|
* Better error message for incompatible versionsColin Walters2010-06-171-2/+18
|
* More explicitly document how we'll use the version= attribute on repositoryColin Walters2010-06-171-0/+7
| | | | | | I want to start bumping it on incompatible .gir changes. https://bugzilla.gnome.org/show_bug.cgi?id=621895
* Add support for GArrays: add g_type_info_get_array_type() and properly scan ↵Tomeu Vizoso2010-05-041-2/+14
| | | | | | | | GArray args Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
* Don't assume _pkgconfig_packages is set.Johan Dahlin2009-02-261-0/+4
| | | | | This fixes a cache issue where the pickle in the cache doesn't have self._pkgconfig_packages set in its instance
* Bug 567906 - Put pkg-config dependencies in .gir filesColin Walters2009-02-111-0/+10
| | | | | | | | | | When generating a .gir file, we now first parse all of our .gir includes to pick up their <package> headers. Then, we merge that with the set of --pkg arguments passed to us, run pkg-config to gather the arguments, and finally save the merged pkg-config list to our new .gir file. This is useful for software which needs to map from .gir to pkg-config in a programmatic way.
* Bug 563794 - Redo annotation parsing & applyingJohan Dahlin2009-01-121-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-01-12 Johan Dahlin <jdahlin@async.com.br> Bug 563794 - Redo annotation parsing & applying Thanks to Colin for helping out considerably in landing this. * giscanner/Makefile.am: * giscanner/ast.py: * giscanner/dumper.py: * giscanner/girparser.py: * giscanner/giscannermodule.c (pygi_source_scanner_get_comments), (calc_attrs_length), (pygi_collect_attributes), (init_giscanner): * giscanner/glibtransformer.py: * giscanner/scannerlexer.l: * giscanner/sourcescanner.c (gi_source_symbol_unref), (gi_source_scanner_new), (gi_source_scanner_free), (gi_source_scanner_get_comments): * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/xmlwriter.py: * tests/scanner/annotation-1.0-expected.gir: * tests/scanner/annotation-1.0-expected.tgir: * tests/scanner/annotation.c: * tests/scanner/annotation.h: * tests/scanner/foo-1.0-expected.gir: * tests/scanner/foo-1.0-expected.tgir: * tests/scanner/foo.h: * tools/g-ir-scanner: This commit merges the annotation parser rewrite branch. It'll change the annotation parsing to be done completely in python code which will make it easier to do further annotation parsing easier. svn path=/trunk/; revision=1017
* Fix inconsistencies with PEP8Jürg Billeter2009-01-031-2/+0
| | | | | | | | | | | | | | | | 2009-01-03 Jürg Billeter <j@bitron.ch> * giscanner/ast.py: * giscanner/dumper.py: * giscanner/girparser.py: * giscanner/glibtransformer.py: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/xmlwriter.py: Fix inconsistencies with PEP8 svn path=/trunk/; revision=997
* Parse interface prerequisitesColin Walters2008-11-171-0/+2
| | | | svn path=/trunk/; revision=934
* Bug 560248 – "disguised structures"Owen Taylor2008-11-101-1/+3
| | | | | | | | | | | | | | Certain types like GIConv and GdkAtom are pointers internally but don't look like pointers when referenced. They have the form. typedef struct _X *X; Parse these as structures/records but mark them in the gir with a 'disguised' attribute so that we know that they need special handling. In the typelib treat them like any other structure. svn path=/trunk/; revision=872
* Relicense the giscanner library under LGPLv2+. This has been approved byJohan Dahlin2008-11-041-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-11-04 Johan Dahlin <jdahlin@async.com.br> * giscanner/__init__.py: * giscanner/ast.py: * giscanner/cachestore.py: * giscanner/cgobject.py: * giscanner/girparser.py: * giscanner/girwriter.py: * giscanner/giscannermodule.c: * giscanner/glibast.py: * giscanner/glibtransformer.py: * giscanner/libtoolimporter.py: * giscanner/minixpath.py: * giscanner/odict.py: * giscanner/sourcescanner.c: * giscanner/sourcescanner.h: * giscanner/sourcescanner.py: * giscanner/transformer.py: * giscanner/utils.py: * giscanner/xmlwriter.py: * COPYING: Relicense the giscanner library under LGPLv2+. This has been approved by all contributors. svn path=/trunk/; revision=862
* Bug 558848 giparser.py: shared library should be optionalOwen Taylor2008-11-011-2/+3
| | | | | | | | | | | | 2008-11-01 Owen Taylor <otaylor@redhat.com> Bug 558848 giparser.py: shared library should be optional When parsing a .gir, allow the shared-library attribute of <namespace/> to be missing: this corresponds to the handling in libgirepository and elsewhere. svn path=/trunk/; revision=860
* Remove arguments from the constructor, move them to separate accessors.Johan Dahlin2008-10-301-18/+18
| | | | | | | | | | | | | | | | | | | | 2008-10-30 Johan Dahlin <jdahlin@async.com.br> * giscanner/girparser.py: Remove arguments from the constructor, move them to separate accessors. Add a new parse_tree method which takes an element tree instance. * tools/g-ir-scanner: Update callsite for this * giscanner/Makefile.am: * giscanner/cachestore.py: * giscanner/transformer.py: Cache the include parsing. Saves ~25% time when creating vte (which includes everything up to gtk+). svn path=/trunk/; revision=842