Translate a DoWhile statement.

@param stmt
@param context
@return
486702
private Context translateDoWhile(WyilFile.Stmt.DoWhile stmt, Context context) {
		WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
				.getParent().enclosingDeclaration;
		// Translate the loop invariant and generate appropriate macro
		translateLoopInvariantMacros(stmt, declaration, context.wyalFile);
		// Rule 1. Check loop invariant after first iteration
		LoopScope firstScope = new LoopScope();
		Context beforeFirstBodyContext = context.newLoopScope(firstScope);
		Context afterFirstBodyContext = translateStatementBlock(stmt.getBody(), beforeFirstBodyContext);
		// Join continue contexts together since they must also preserve the
		// loop invariant
		afterFirstBodyContext = joinDescendants(beforeFirstBodyContext, afterFirstBodyContext,
				firstScope.continueContexts);
		//
		checkLoopInvariant("loop invariant may not be established by first iteration", stmt, afterFirstBodyContext);
		// Rule 2. Check loop invariant preserved on subsequence iterations. On
		// entry to the loop body we must havoc all modified variables. This is
		// necessary as such variables should retain their values from before
		// the loop.
		LoopScope arbitraryScope = new LoopScope();
		Context beforeArbitraryBodyContext = context.newLoopScope(arbitraryScope).havoc(stmt.getModified());
		beforeArbitraryBodyContext = assumeLoopInvariant(stmt, beforeArbitraryBodyContext);
		Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, beforeArbitraryBodyContext);
		Expr trueCondition = p.first();
		beforeArbitraryBodyContext = p.second().assume(trueCondition);
		Context afterArbitraryBodyContext = translateStatementBlock(stmt.getBody(), beforeArbitraryBodyContext);
		// Join continue contexts together since they must also preserve the
		// loop invariant
		afterArbitraryBodyContext = joinDescendants(beforeArbitraryBodyContext, afterArbitraryBodyContext,
				arbitraryScope.continueContexts);
		//
		checkLoopInvariant("loop invariant may not be restored", stmt, afterArbitraryBodyContext);
		// Rule 3. Assume loop invariant holds.
		Context exitContext = context.havoc(stmt.getModified());
		exitContext = assumeLoopInvariant(stmt, exitContext);
		Expr falseCondition = invertCondition(
				translateExpression(stmt.getCondition(), null, exitContext.getEnvironment()), stmt.getCondition());
		exitContext = exitContext.assume(falseCondition);
		//
		// Finally, need to join any break contexts from either first iteration
		// or arbitrary iteration
		exitContext = joinDescendants(context, exitContext, firstScope.breakContexts, arbitraryScope.breakContexts);
		//
		return exitContext;
	}
1122707
def translate(context, hash)
      # makes sure that the context is a hash
      raise ArgumentError.new('did not pass a hash for the context') unless context.is_a?(Hash)
      raise ArgumentError.new('cannot provide include hash in context') if context[:hash]
      # create the context instance for instance variables
      struct = StructContext.new(context, hash)

      # instantiate MapMethods to perform translations and define lambda
      # for how to tranlate a field
      #

      translate = lambda { |t|
        MapMethods.send(t[:name], struct, t[:field], t[:block])
      }

      # determine the version of the incoming hash
      #
      struct_version = struct.instance_exec(&@migrations.version)

      raise StandardError.new('calculated version is not valid') unless Gem::Version.correct?(struct_version)

      # gets a list of the potential versions 
      #
      migration_versions = @migrations.translations.keys
      migration_versions.delete(:first)
      migration_versions.delete(:last)

      # get the first and last translations
      #
      firsts = @migrations.translations[:first]
      lasts = @migrations.translations[:last]

      # sorts the versions
      #
      migration_versions.sort! do |x,y|
        Gem::Version.new(x) <=> Gem::Version.new(y)
      end

      # reverse order if descending was specified
      #
      migration_versions = @migrations.order == :descending ? migration_versions.reverse : migration_versions
      # run the first translations if they exist
      #
      firsts.each(&translate) if firsts

      # determine the first version to run translations
      #
      first_index = @migrations.order == :ascending ? migration_versions.find_index(struct_version) : nil
      last_index = @migrations.order == :descending ? migration_versions.find_index(struct_version) : nil

      # run all subsequent version translations
      #
      migration_versions.each_with_index do |version, index|
        next unless !first_index || index >= first_index
        next unless !last_index || index <= last_index
        @migrations.translations[version].each(&translate)
      end

      # run the first translations if they exist
      #
      lasts.each(&translate) if lasts

      # return hash
      #
      struct.hash
    end
1110765
@Override
    public <T extends JCTree> T translate(T tree) {
        TranslationContext<?> newContext = contextMap.get(tree);
        return translate(tree, newContext != null ? newContext : context);
    }
116126
def type_stmt(self, stmt, p_elem, pset):
        
        typedef = stmt.i_typedef
        if typedef and not stmt.i_is_derived: # just ref
            uname, dic = self.unique_def_name(typedef)
            if uname not in dic:
                self.install_def(uname, typedef, dic)
            SchemaNode("ref", p_elem).set_attr("name", uname)
            defst = typedef.search_one("default")
            if defst:
                dic[uname].default = defst.arg
                occur = 1
            else:
                occur = dic[uname].occur
            if occur > 0: self.propagate_occur(p_elem, occur)
            return
        chain = [stmt]
        tdefault = None
        while typedef:
            type_ = typedef.search_one("type")
            chain.insert(0, type_)
            if tdefault is None:
                tdef = typedef.search_one("default")
                if tdef:
                    tdefault = tdef.arg
            typedef = type_.i_typedef
        if tdefault and p_elem.occur == 0:
            p_elem.default = tdefault
            self.propagate_occur(p_elem, 1)
        self.type_handler[chain[0].arg](chain, p_elem)
1131353
@Override
    @GwtIncompatible("incompatible method")
    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
        for (final CharSequenceTranslator translator : translators) {
            final int consumed = translator.translate(input, index, out);
            if(consumed != 0) {
                return consumed;
            }
        }
        return 0;
    }
518127
def _augment_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        if not sctx.schema_data.if_features(stmt, sctx.text_mid):
            return
        path = sctx.schema_data.sni2route(stmt.argument, sctx)
        target = self.get_schema_descendant(path)
        if stmt.find1("when"):
            gr = GroupNode()
            target._add_child(gr)
            target = gr
        target._handle_substatements(stmt, sctx)
1303175
Set<NFAState<T>> nfaTransitsFor(CharRange condition)
    {
        Set<NFAState<T>> nset = new NumSet<>();
        for (NFAState<T> nfa : nfaSet)
        {
            nset.addAll(nfa.transit(condition));
        }
        return nset;
    }
1289925
def _leaf_list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        node = LeafListNode()
        node.type = DataType._resolve_type(
            stmt.find1("type", required=True), sctx)
        self._handle_child(node, stmt, sctx)
925988
public static void addStmt(BlockStmt block, Statement stmt) {
        List<Statement> stmts = block.getStmts();
        if (stmts == null) {
            stmts = new ArrayList<Statement>();
            block.setStmts(stmts);
        }
        stmts.add(stmt);
    }
1029771
public static Statement of(Iterable<Statement> stmts) {
    ImmutableList<Statement> copy = ImmutableList.copyOf(stmts);
    return copy.size() == 1 ? copy.get(0) : StatementList.create(copy);
  }
793363
public function translateContext($context, $message)
    {
        $key = $context . chr(4) . $message;
        if (isset($this->translations[$key])) {
            return $this->translations[$key];
        } else {
            return $message;
        }
    }
580191
@SuppressWarnings("unchecked")
    public <T extends JCTree> T translate(T tree) {
        if (tree == null) {
            return null;
        } else {
            tree.accept(this);
            JCTree tmpResult = this.result;
            this.result = null;
            return (T)tmpResult; // XXX cast
        }
    }
626785
private Context translateDereference(WyilFile.Expr.Dereference lval, Expr rval, Context context) {
		Expr e = translateDereference(lval, context.getEnvironment());
		return context.assume(new Expr.Equal(e, rval));
	}
25676
public static AbstractStmt getStatement(final CharSequence _stmt)
    {
        AbstractStmt ret = null;
        final IStatement<?> stmt = parse(_stmt);
        if (stmt instanceof IPrintStatement) {
            ret = PrintStmt.get((IPrintStatement<?>) stmt);
        } else if (stmt instanceof IDeleteStatement) {
            ret = DeleteStmt.get((IDeleteStatement<?>) stmt);
        } else if (stmt instanceof IInsertStatement) {
            ret = InsertStmt.get((IInsertStatement) stmt);
        } else if (stmt instanceof IUpdateStatement) {
            ret = UpdateStmt.get((IUpdateStatement<?>) stmt);
        }
        return ret;
    }
1215042
def fixup_simple_stmt(parent, i, stmt_node):
    
    for semi_ind, node in enumerate(stmt_node.children):
        if node.type == token.SEMI: # *sigh*
            break
    else:
        return

    node.remove() # kill the semicolon
    new_expr = Node(syms.expr_stmt, [])
    new_stmt = Node(syms.simple_stmt, [new_expr])
    while stmt_node.children[semi_ind:]:
        move_node = stmt_node.children[semi_ind]
        new_expr.append_child(move_node.clone())
        move_node.remove()
    parent.insert_child(i, new_stmt)
    new_leaf1 = new_stmt.children[0].children[0]
    old_leaf1 = stmt_node.children[0].children[0]
    new_leaf1.prefix = old_leaf1.prefix
297839
protected function checkWithViewClass(Context $context, array $stmts)
    {
        $pseudo_method_stmts = [];

        foreach ($stmts as $stmt) {
            if ($stmt instanceof PhpParser\Node\Stmt\Use_) {
                $this->visitUse($stmt);
            } else {
                $pseudo_method_stmts[] = $stmt;
            }
        }

        $pseudo_method_name = preg_replace('/[^a-zA-Z0-9_]+/', '_', $this->file_name);

        $class_method = new PhpParser\Node\Stmt\ClassMethod($pseudo_method_name, ['stmts' => []]);

        $class = new PhpParser\Node\Stmt\Class_(self::VIEW_CLASS);

        $class_analyzer = new ClassAnalyzer($class, $this, self::VIEW_CLASS);

        $view_method_analyzer = new MethodAnalyzer($class_method, $class_analyzer);

        if (!$context->check_variables) {
            $view_method_analyzer->addSuppressedIssue('UndefinedVariable');
        }

        $statements_source = new StatementsAnalyzer($view_method_analyzer);

        $statements_source->analyze($pseudo_method_stmts, $context);
    }
513893
private static Level translateLevel(final int level) {
		if (level <= TRACE_INT) {
			return Level.TRACE;
		} else if (level <= DEBUG_INT) {
			return Level.DEBUG;
		} else if (level <= INFO_INT) {
			return Level.INFO;
		} else if (level <= WARN_INT) {
			return Level.WARN;
		} else {
			return Level.ERROR;
		}
	}