Comments (4)
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.
I started a thread to get some input on this: http://forum.dlang.org/post/[email protected]
from libdparse.
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.
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)
- bounds violation in `parsePragmaStatement` HOT 1
- `parseModule` overload set should take the parser type as template parameter HOT 1
- Outdated gramar HOT 2
- Add support for bitfields HOT 3
- Support scope for variable declaration in foreach statement HOT 1
- libdparse.dlang.io down HOT 1
- Which documentation generator to use?
- Add support for auto ref lambdas
- wrong version into meson build file HOT 2
- Fix multi-array parsing HOT 1
- Incomplete UnaryExpression for AutoDeclaration HOT 2
- Lidbparse does not implement multiple messages for static assert
- valid syntax isn't parsed correctly
- declaration in scope (exit) causes a parse error, but is valid D code HOT 2
- use structs in callbacks instead of many parameters
- Add support for: `alias this = _base;`
- Support delclarations in switch statements `switch(auto x = expr)`
- AST tests do not correctly report errors HOT 3
- Nested ternary expressions not recognised correctly
- support parsing `alias fn = extern(C) typeof(return) function(params);`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libdparse.