org.projectnessie.nessie.cli.grammar.ast.CreateNamespaceStatement Maven / Gradle / Ivy
/* Generated by: CongoCC Parser Generator. Do not edit.
* Generated Code for CreateNamespaceStatement AST Node type
* by the ASTNode.java.ftl template
*/
package org.projectnessie.nessie.cli.grammar.ast;
import org.projectnessie.nessie.cli.cmdspec.*;
import org.projectnessie.nessie.cli.grammar.*;
import java.util.*;
import org.projectnessie.nessie.cli.grammar.Token.TokenType;
import static org.projectnessie.nessie.cli.grammar.Token.TokenType.*;
public class CreateNamespaceStatement extends BaseNode implements CreateNamespaceCommandSpec {
public static final List LEADING_TOKENS = List.of(TokenType.CREATE);
@Override
public String getInCatalog() {
return stringValueOf("inCatalog");
}
@Override
public String getRef() {
return stringValueOf("ref");
}
@Override
public String getNamespace() {
return stringValueOf("namespace");
}
@Override
public Map setProperties() {
Map params = new HashMap<>();
List children = children();
for (int i = 0; i < children.size(); i++) {
Node child = children.get(i);
if (child.getType() == SET) {
for (i++; i < children.size();) {
Node key = children.get(i++);
if (children.get(i++).getType() != EQUAL) {
throw new IllegalArgumentException("Syntax error, missing '='");
}
Node value = children.get(i++);
params.put(((IdentifierOrLiteral) key).getStringValue(), ((IdentifierOrLiteral) value).getStringValue());
if (children.size() == i || children.get(i++).getType() != AND) {
break;
}
}
break;
}
}
return params;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy