Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
import pt.up.fe.specs.clava.ast.decl.data.templates.TemplateArgumentTemplate;
import pt.up.fe.specs.clava.ast.decl.data.templates.TemplateArgumentTemplateExpansion;
import pt.up.fe.specs.clava.ast.decl.data.templates.TemplateArgumentType;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.DependentTemplate;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.QualifiedTemplate;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.SubstTemplateTemplateParm;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.Template;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.UsingTemplate;
import pt.up.fe.specs.clava.ast.decl.enums.ExplicitSpecKind;
import pt.up.fe.specs.clava.ast.decl.enums.NestedNameSpecifierKind;
import pt.up.fe.specs.clava.ast.expr.data.designator.ArrayDesignator;
Expand Down Expand Up @@ -356,6 +358,13 @@ public static TemplateArgumentTemplate templateArgumentTemplate(LineStream lines
parserData.getClavaNodes().queueSetNode(template, SubstTemplateTemplateParm.PARAMETER, lines.nextLine());
template.set(SubstTemplateTemplateParm.REPLACEMENT, templateArgumentTemplate(lines, parserData));
break;
case UsingTemplate:
parserData.getClavaNodes().queueSetNode(template, UsingTemplate.USING_SHADOW_DECL, lines.nextLine());
break;
case DependentTemplate:
template.set(DependentTemplate.QUALIFIER, lines.nextLine());
template.set(DependentTemplate.NAME, lines.nextLine());
break;
default:
throw new RuntimeException("Case not implemented: " + nameKind);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import org.suikasoft.jOptions.Datakey.DataKey;
import org.suikasoft.jOptions.Datakey.KeyFactory;

import pt.up.fe.specs.clava.ast.decl.data.templates.template.DependentTemplate;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.QualifiedTemplate;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.SubstTemplateTemplateParm;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.Template;
import pt.up.fe.specs.clava.ast.decl.data.templates.template.UsingTemplate;
import pt.up.fe.specs.clava.ast.type.enums.TemplateNameKind;
import pt.up.fe.specs.util.exceptions.NotImplementedException;

Expand Down Expand Up @@ -52,6 +54,10 @@ public static TemplateArgumentTemplate newInstance(TemplateNameKind nameKind) {
return new QualifiedTemplate();
case SubstTemplateTemplateParm:
return new SubstTemplateTemplateParm();
case UsingTemplate:
return new UsingTemplate();
case DependentTemplate:
return new DependentTemplate();
default:
throw new NotImplementedException(nameKind);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright 2026 SPeCS.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package pt.up.fe.specs.clava.ast.decl.data.templates.template;

import org.suikasoft.jOptions.Datakey.DataKey;
import org.suikasoft.jOptions.Datakey.KeyFactory;

import pt.up.fe.specs.clava.ClavaNode;
import pt.up.fe.specs.clava.ast.decl.data.templates.TemplateArgumentTemplate;
import pt.up.fe.specs.clava.ast.type.enums.TemplateNameKind;

public class DependentTemplate extends TemplateArgumentTemplate {

/// DATAKEYS BEGIN

public final static DataKey<String> QUALIFIER = KeyFactory.string("qualifier");

public final static DataKey<String> NAME = KeyFactory.string("name");

/// DATAKEYS END

public DependentTemplate() {
super(TemplateNameKind.DependentTemplate);
}

@Override
public String getCode(ClavaNode node) {
String qualifier = get(QUALIFIER);
String templateKeyword = qualifier.isEmpty() ? "" : "template ";
return qualifier + templateKeyword + get(NAME);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright 2026 SPeCS.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package pt.up.fe.specs.clava.ast.decl.data.templates.template;

import org.suikasoft.jOptions.Datakey.DataKey;
import org.suikasoft.jOptions.Datakey.KeyFactory;

import pt.up.fe.specs.clava.ClavaNode;
import pt.up.fe.specs.clava.ast.decl.UsingShadowDecl;
import pt.up.fe.specs.clava.ast.decl.data.templates.TemplateArgumentTemplate;
import pt.up.fe.specs.clava.ast.type.enums.TemplateNameKind;

public class UsingTemplate extends TemplateArgumentTemplate {

/// DATAKEYS BEGIN

public final static DataKey<UsingShadowDecl> USING_SHADOW_DECL = KeyFactory.object("usingShadowDecl",
UsingShadowDecl.class);

/// DATAKEYS END

public UsingTemplate() {
super(TemplateNameKind.UsingTemplate);
}

@Override
public String getCode(ClavaNode node) {
return get(USING_SHADOW_DECL).getDeclName();
}
}
Loading