All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.joern.fuzzyc2cpg.parser.functions.builder.ContentBuilderStack Maven / Gradle / Ivy

There is a newer version: 1.1.911
Show newest version
package io.joern.fuzzyc2cpg.parser.functions.builder;

import io.joern.fuzzyc2cpg.ast.AstNode;
import io.joern.fuzzyc2cpg.ast.langc.statements.blockstarters.IfStatement;
import io.joern.fuzzyc2cpg.ast.statements.blockstarters.DoStatement;
import io.joern.fuzzyc2cpg.ast.statements.blockstarters.TryStatement;
import java.util.Stack;

public class ContentBuilderStack {

  private Stack itemStack = new Stack<>();
  private ShadowStack shadowStack = new ShadowStack(itemStack);

  public void push(AstNode statementItem) {
    shadowStack.push(statementItem);
    itemStack.push(statementItem);
  }

  public AstNode pop() {
    shadowStack.pop();
    return itemStack.pop();
  }

  public int size() {
    return itemStack.size();
  }

  public AstNode peek() {
    return itemStack.peek();
  }

  public IfStatement getIfInElseCase() {
    return shadowStack.getIfInElseCase();
  }

  public IfStatement getIf() {
    return shadowStack.getIf();
  }

  public DoStatement getDo() {
    return shadowStack.getDo();
  }

  public TryStatement getTry() {
    return shadowStack.getTry();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy