GNOME Bugzilla – Bug 699856
Fixes and features for the section parser
Last modified: 2015-02-07 16:58:03 UTC
This will be used in upcoming doc work.
Created attachment 243515 [details] [review] sectionparser: Construct Subsections, not Sections Whoops!
Created attachment 243516 [details] [review] sectionparser: Fix regex matching
Created attachment 243517 [details] [review] sectionparser: Fix subsection regex
Created attachment 243518 [details] [review] sectionparser: Allow subsections with no name
Created attachment 243519 [details] [review] sectionparser: Rename It's called a sections file, not a section file.
Created attachment 243520 [details] [review] sectionparser: Add support for <INCLUDE>
Created attachment 243521 [details] [review] sectionparser: Remove the main subsection This isn't how subsections work
Created attachment 243522 [details] [review] sectionparser: Ignore other directives to gtk-doc
Created attachment 243524 [details] [review] giscanner: Add a simple automatic sections file generator This is a very basic sections file generator, and isn't too smart. It's simply intended to be a base to build docs on, and will be used if the user doesn't provide a sections file when calling g-ir-doc-tool, for convenience purposes.
Review of attachment 243515 [details] [review]: Makes sense.
Review of attachment 243516 [details] [review]: Ouch, they were really inverted? It's probably worth precompiling these; compiling regexps in a loop makes one look silly.
Review of attachment 243517 [details] [review]: ::: giscanner/sectionparser.py @@ +67,3 @@ continue + match = re.match(r"<SUBSECTION (?P<name>.*)>", line) As a general rule I'd use non-greedy here, i.e. ".*?".
Review of attachment 243518 [details] [review]: Ok.
Review of attachment 243519 [details] [review]: Sure.
Review of attachment 243520 [details] [review]: Ok.
Review of attachment 243521 [details] [review]: Sounds plausible.
Review of attachment 243522 [details] [review]: I'll trust you on this.
Review of attachment 243524 [details] [review]: One comment. ::: giscanner/sectionparser.py @@ +116,3 @@ + write(symbol) + + return '\n' + '\n'.join(lines).strip() + '\n' Building up a potentially large string in memory is lame. Why doesn't this function take a stream?
(In reply to comment #11) > Review of attachment 243516 [details] [review]: > > Ouch, they were really inverted? It's probably worth precompiling these; > compiling regexps in a loop makes one look silly. Python caches compiled regexes at first use. re.compile isn't really a thing to use anymore. (In reply to comment #12) > Review of attachment 243517 [details] [review]: > > ::: giscanner/sectionparser.py > @@ +67,3 @@ > continue > > + match = re.match(r"<SUBSECTION (?P<name>.*)>", line) > > As a general rule I'd use non-greedy here, i.e. ".*?". From how I understand it, that's not what the Perl script does. See gtkdoc-mkdb.in. (In reply to comment #18) > Review of attachment 243524 [details] [review]: > > One comment. > > ::: giscanner/sectionparser.py > @@ +116,3 @@ > + write(symbol) > + > + return '\n' + '\n'.join(lines).strip() + '\n' > > Building up a potentially large string in memory is lame. Why doesn't this > function take a stream? So I could verify the output simply by printing the entire thing to stdout. I'll fix it.
Created attachment 243526 [details] [review] giscanner: Add a simple automatic sections file generator This is a very basic sections file generator, and isn't too smart. It's simply intended to be a base to build docs on, and will be used if the user doesn't provide a sections file when calling g-ir-doc-tool, for convenience purposes.
Attachment 243515 [details] pushed as 88c747c - sectionparser: Construct Subsections, not Sections Attachment 243516 [details] pushed as 4062357 - sectionparser: Fix regex matching Attachment 243517 [details] pushed as a1a513a - sectionparser: Fix subsection regex Attachment 243518 [details] pushed as af0158e - sectionparser: Allow subsections with no name Attachment 243519 [details] pushed as 6c6b787 - sectionparser: Rename Attachment 243520 [details] pushed as 95b18d1 - sectionparser: Add support for <INCLUDE> Attachment 243521 [details] pushed as 190d9a5 - sectionparser: Remove the main subsection Attachment 243522 [details] pushed as 348c72a - sectionparser: Ignore other directives to gtk-doc Pushing the fixes for now.
Review of attachment 243526 [details] [review]: One minor thing, otherwise looks fine. ::: giscanner/docmain.py @@ +41,3 @@ + parser.add_option("", "--write-sections-file", + action="store_true", dest="write_sections", + help="Write the loaded or generation sections file") s/generation/generated/?
Attachment 243526 [details] pushed as 3ec52d6 - giscanner: Add a simple automatic sections file generator It seems I forgot to push this one.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]