Skip to content
Permalink
Browse files

fix @template parsing

  • Loading branch information
adamdruppe committed Jul 16, 2019
1 parent 24c9525 commit 733a19fa1d12af16eb795fbb2832b9f29fdc596e
Showing with 29 additions and 2 deletions.
  1. +13 −1 Dscanner/libdparse/src/dparse/parser.d
  2. +13 −0 comment.d
  3. +3 −1 doc2.d
@@ -931,6 +931,11 @@ class Parser
return null;
}
node.startLocation = start.index;

mixin(nullCheck!`node.argumentList = parseArgumentList()`);

// I don't think any of this following spam is necessary and I know it isn't correct, let's just use this one thing and see how it goes
version(none)
switch (current.type)
{
case tok!"identifier":
@@ -941,7 +946,14 @@ class Parser
if (!currentIs(tok!")"))
mixin(nullCheck!`node.argumentList = parseArgumentList()`);
expect(tok!")");
}
} else if(currentIs(tok!("!")))
{
advance(); // !
advance();
mixin(nullCheck!`node.argumentList = parseArgumentList()`);
expect(tok!")");

}
break;
case tok!"(":
advance();
@@ -2430,6 +2430,19 @@ class MyFormatter(Sink) : Formatter!Sink {
sink.put(s);
}

override void format(const AtAttribute atAttribute) {
if(atAttribute is null || atAttribute.argumentList is null)
super.format(atAttribute);
else {
sink.put("@");
if(atAttribute.argumentList.items.length == 1) {
format(atAttribute.argumentList.items[0]);
} else {
format(atAttribute.argumentList);
}
}
}

override void format(const TemplateParameterList templateParameterList)
{
putTag("<div class=\"parameters-list\">");
4 doc2.d
@@ -2403,7 +2403,9 @@ class VariableDecl : Decl {
}

override void getAggregatePrototype(MyOutputRange output) {
getSimplifiedPrototype(output);
auto f = new MyFormatter!(typeof(output))(output);
writeAttributes(f, output, attributes);
getSimplifiedPrototypeInternal(output, false);
}

override string declarationType() {

0 comments on commit 733a19f

Please sign in to comment.
You can’t perform that action at this time.