[developers] doc-strings in TDL for DELPH-IN

goodman.m.w at gmail.com goodman.m.w at gmail.com
Tue Aug 7 19:59:46 CEST 2018


Thanks, Dan,

I'll do my part to update the wiki with the preferred syntax and add
support into PyDelphin. Regarding the syntax description, it would be
rather complicated to enforce one docstring per type in the production
rules if it's not in a fixed position, so I'll let it accept multiple per
type and just make a note for implementers that only the first one must be
preserved (with the action for additional docstrings left undefined).

And, Woodley, good catch on the regex bug. Those patterns should be
negative lookahead assertions. I think the following works:

    DocString := /"""([^"\\]|\\.|"(?!")|""(?!"))*"""/

Lookahead assertions can slow down regex searches, so this pattern is
intended to be illustrative; a non-regex parser is fine as long as it also
allows escaped characters (including quotes) and up to two unescaped quotes
not followed by a third quote. Also, if it's not clear from the pattern,
newlines are acceptable within the triple-quoted strings.

On Tue, Aug 7, 2018 at 12:28 AM Woodley Packard <sweaglesw at sweaglesw.org>
wrote:

> Hello docstringers,
>
> I have added to ACE the ability to detect and ignore triple-quoted strings
> anywhere within a TDL statement.  I will leave it to others to determine
> and police legal placement.  The (very lightly tested) update is available
> in the ACE SVN trunk for those who wish to test it.  I will be happy to
> make a binary release soon if bugs are not uncovered.
>
> I have one nit to pick with the proposed regular expression for doc
> strings.  The following docstring would be treated as terminating early,
> since the backslash is gobbled up without being interpreted:
>
> """hello"\"""not done yet"""
>
> This one is legal in python (and handled properly by ACE :-)).
>
> Best,
> -Woodley
>
> On Aug 3, 2018, at 8:57 PM, Francis Bond <bond at ieee.org> wrote:
>
>
> DocString    := /"""([^"\\]|\\.|"[^"]|""[^"])*"""/ Spacing
>
>
>

-- 
-Michael Wayne Goodman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.delph-in.net/archives/developers/attachments/20180807/5e7fb238/attachment.html>


More information about the developers mailing list