summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
Commit message (Collapse)AuthorAgeFilesLines
* giscanner: Allow fields which are callbacksPhilip Chimento2019-04-071-1/+1
| | | | This is apparently used in Gee-0.8 and Folks-0.6.
* Do not bail out when parsing GIR files without doc positionsEmmanuele Bassi2018-12-291-2/+2
| | | | | | | The position attributes on a <doc> element are not mandatory, so we should have some fallback value if they are missing. Fixes: #252
* Drop all Python 2 compat codeChristoph Reiter2018-12-081-5/+0
| | | | We only support 3.4+ now.
* writer: Include documentation and symbol position in source filesThibault Saunier2018-11-281-0/+18
| | | | | | | | | | | Some documentation tool (as hotdoc[0]) need to have information about symbol declaration and documentation positions in the source files to be able to do smart indexing (automatically build the documenation index). [0] https://hotdoc.github.io/ Fixes #175
* giscanner: Remove custom collections implementationNirbheek Chauhan2018-03-101-1/+1
| | | | | | | We already require python 2.7, and it has OrderedDict and Counter. Besides cleaning up unmaintained code, this change found and fixed a Python 3 bug where we were iterating over a dict while changing it.
* giscanner: Mark gpointer nodes as nullable by defaultPhilip Withnall2015-10-041-1/+1
| | | | | | | | | | | | | gpointer parameters and return types should be marked as nullable by default, unless: • also annotated with (type) and not with (nullable); or • explicitly annotated with (not nullable). This introduces the (not nullable) annotation as a direct opposite to (nullable). In future, (not) could be extended to invert other annotations. https://bugzilla.gnome.org/show_bug.cgi?id=729660
* giscanner: Store parent link in AST for TypeContainer instancesPhilip Withnall2015-09-291-0/+3
| | | | | | | | | | It is useful for navigating the AST to have a link from each TypeContainer instance (e.g. each Parameter and Return) to the parent AST node, such as a Function. This will be used in the g-ir-diff tool. https://bugzilla.gnome.org/show_bug.cgi?id=747979
* giscanner: Use unicode literals in all Python filesSimon Feltman2015-09-291-0/+1
| | | | | | | | | | | | Add unicode_literals future import which turns any string literal into a unicode string. Return unicode strings from the Python C extension module. Force writing of annotations (g-ir-annotation-tool) to output utf8 encoded data to stdout. This is an initial pass at following the "unicode sandwich" model of programming (http://nedbatchelder.com/text/unipain.html) needed for supporting Python 3. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use print as a function for Python 3 compatibilitySimon Feltman2015-09-291-0/+1
| | | | | | | Use future import "print_function" and update relevant uses of print as a function call. See: PEP 3105 https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Enable "true division" for all Python filesSimon Feltman2015-09-291-0/+1
| | | | | | | | | | Import Python 3 compatible "true division" from the future (PEP 238). This changes the Python 2 classic division which uses floor division on integers to true division. Verfied we don't actually use the division operator anywhere in the code base so this a safety for supporting both Python 2 and 3. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use absolute_import for all Python filesSimon Feltman2015-09-291-0/+2
| | | | | | Use absolute_import to ensure Python 3 compatibility of the code base. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Convert map() results to listSimon Feltman2015-09-291-3/+3
| | | | | | | | Convert the results map() calls to a list for Python 3 compatibility. In Python 3, map() returns an iterable "map object" which does not allow indexing or iteration more than once. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* scanner: fix broken assert messageDieter Verfaillie2015-06-291-1/+1
| | | | | | | | 288b339edf262f1dba4e87a9faef46cc79749bd5 changed the signature from def _parse_type_second_pass(self, parent, node, typeval): to def _parse_type_array_length(self, siblings, node, typeval) but failed to change the assert statement accordingly.
* giscanner: enable the --reparse-validate option for our test suiteDieter Verfaillie2015-03-041-1/+19
| | | | | | | | | | Doing so reveals GIRParser did not yet support: - the (skip) annotation on parameters and return values - the (attributes) annotation This patch fixes both issues an prevents further similar problems. https://bugzilla.gnome.org/show_bug.cgi?id=738171
* giscanner: support nullable return types tooRyan Lortie2014-05-061-1/+2
| | | | | | | | | | Promote the 'nullable' field to the TypeContainer base class (which is shared by Return and Parameter types). Add .gir support for nullability on return values, both in the writer and in the (scanner's) parser. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: write nullable and optional attributesRyan Lortie2014-05-061-0/+2
| | | | | | | | | | | | | | | | | | | Record our internal 'nullable' and 'optional' attributes into the written .gir file. It is now theoretically possible to express the concept of an out parameter with a nullable type (although presently there is no way to do this). Modify our own internal parser (in the scanner) to understand the newly-written attributes. Update the expected output of the 'Regress-1.0.gir' test to account for the new attributes. Nothing else understands 'nullable' yet, but the girparser in the typelib compiler already understands 'optional' and records a bit for it in the typelib. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* girparser: fix parsing of enum methodsGiovanni Campagna2014-02-261-0/+1
| | | | Make sure to set the parent of the function
* 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