org.projectnessie.nessie.cli.grammar.ast.ConnectStatement Maven / Gradle / Ivy
/* Generated by: CongoCC Parser Generator. Do not edit.
* Generated Code for ConnectStatement 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 static org.projectnessie.nessie.cli.grammar.Token.TokenType.*;
public class ConnectStatement extends BaseNode implements ConnectCommandSpec {
@Override
public String getUri() {
return stringValueOf("uri");
}
@Override
public String getInitialReference() {
return stringValueOf("initialRef");
}
@Override
public Map getParameters() {
Map params = new HashMap<>();
List children = children();
for (int i = 0; i < children.size(); i++) {
Node child = children.get(i);
if (child.getType() == USING) {
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