Code Monkey home page Code Monkey logo

Comments (4)

Hackerpilot avatar Hackerpilot commented on May 28, 2024

I have a fix coded up for your alias example.

The docs for your variable declaration example are not lost, but they're not where you expect them either. dscanner --ast test.d | xmllint --format gives output like this:

<?xml version="1.0"?>
<module>
  <declaration>
    <variableDeclaration>
      <ddoc>/** documentation for g */</ddoc>
      <type pretty="int">
        <type2>int</type2>
      </type>
      <declarator line="2">
        <name>g</name>
        <ddoc>/// more documentation for g</ddoc>
      </declarator>
    </variableDeclaration>
  </declaration>
</module>

The first comment is attached to the variable declaration, but the second is attached to the declarator. I think that I wrote it this way so that you can have different trailing doc comments for each declarator, though I can tell that I didn't test this well enough.

Check this out:

/// doc1
int a, /// doc2
    b, /// doc3
    c; /// doc4

Build with dmd -c -D test.d and look at the html file. You'll get something like this:

int a;
    doc1
    doc2

int b;
    doc1
    doc3

int c;
    doc1
    doc4

The ddoc spec doesn't really say that this should happen, but it doesn't say that it shouldn't either.

from libdparse.

Hackerpilot avatar Hackerpilot commented on May 28, 2024

I started a thread to get some input on this: http://forum.dlang.org/post/[email protected]

from libdparse.

adamdruppe avatar adamdruppe commented on May 28, 2024

On Wed, Jan 06, 2016 at 06:11:10PM -0800, Brian Schott wrote:

The docs for your variable declaration example are not lost, but they're not where you expect them either. dscanner --ast test.d | xmllint --format gives output like this:

Aye, I realized this earlier today too, it makes sense when I think about it.

from libdparse.

Hackerpilot avatar Hackerpilot commented on May 28, 2024

With my most recent change the AST will look like this:

<?xml version="1.0"?>
<module>
  <declaration>
    <variableDeclaration>
      <ddoc>/// doc1</ddoc>
      <type pretty="int">
        <type2>int</type2>
      </type>
      <declarator line="9">
        <name>a</name>
        <ddoc>/// doc1
/// doc2</ddoc>
      </declarator>
      <declarator line="10">
        <name>b</name>
        <ddoc>/// doc1
/// doc3</ddoc>
      </declarator>
      <declarator line="11">
        <name>c</name>
        <ddoc>/// doc1
/// doc4</ddoc>
      </declarator>
    </variableDeclaration>
  </declaration>
</module>

from libdparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.