while_statement : WHILE LPAREN cond RPAREN whilecontent_statement
197120
def p_while_statement(self, p):
        ''
        p[0] = WhileStatement(p[3], p[5], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
1308184
def p_statements(self, p):
        
        n = len(p)
        if n == 3:
            p[0] = p[1] + [p[2]]
        elif n == 2:
            p[0] = ['statements', p[1]]
120686
def main():
    

    DATABASE.load_contents()

    continue_flag = False

    while not continue_flag:
        DATABASE.print_contents()
        try:
            command = raw_input(">>> ")
            for stmnt_unformated in sqlparse.parse(command):
                statement = sqlparse.parse(
                    sqlparse.format(
                        str(
                            stmnt_unformated
                        ),
                        reindent=True
                    )
                )[0]
                type = statement.tokens[0]

                if str(type).lower() == "drop":
                    if str(statement.tokens[2]).lower() == "table":
                        tablename = str(statement.tokens[4])
                        table = DATABASE.get_table(tablename)
                        table.rows = []
                        table.store_contents()
                        DATABASE.delete_table(tablename)
                        DATABASE.store_contents()
                    else:
                        raise Exception(
                            "Invalid Syntax of DROP TABLE t"
                        )
                elif str(type).lower() == "truncate":
                    if str(statement.tokens[2]).lower() == "table":
                        tablename = str(statement.tokens[4])
                        table = DATABASE.get_table(tablename)
                        table.rows = []
                        table.store_contents()
                    else:
                        raise Exception(
                            "Invalid Syntax of TRUNCATE TABLE t"
                        )
                elif str(type).lower() == "delete":
                    if str(statement.tokens[2]).lower() == "from":
                        tablename = str(statement.tokens[4])
                        table = DATABASE.get_table(tablename)
                        whereclause = statement.tokens[6]
                        if str(whereclause.tokens[0]).lower() == "where":
                            comparison = whereclause.tokens[2]
                            key = str(comparison.tokens[0])
                            value = int(str(comparison.tokens[4]))
                            table.delete_row(key, value)
                            table.store_contents()
                        else:
                            raise Exception(
                                "Invalid Syntax of DELETE FROM t where k = v"
                            )

                    else:
                        raise Exception(
                            "Invalid Syntax of DELETE FROM t WHERE k = v"
                        )
                elif str(type).lower() == "insert":
                    if str(statement.tokens[2]).lower() == "into":
                        tablename = str(statement.tokens[4])
                        table = DATABASE.get_table(tablename)
                        if str(statement.tokens[6]).lower() == "values":
                            parenthesis = statement.tokens[8]
                            idlist = parenthesis.tokens[1]
                            values_list = map(
                                lambda x: int(str(x)),
                                idlist.get_identifiers()
                            )
                            table.put_row_raw(values_list)
                            table.store_contents()
                        else:
                            raise Exception(
                                "Invalid Syntax of INSERT INTO t VALUES (v...)"
                            )
                    else:
                        raise Exception(
                            "Invalid Syntax of INSERT INTO t VALUES (v...)"
                        )
                elif str(type).lower() == "create":
                    if str(statement.tokens[2]).lower() == "table":
                        sublist = list(statement.tokens[4].get_sublists())
                        tablename = str(sublist[0])
                        garbage = str(sublist[1])
                        column_list = map(
                            lambda x: x.strip(" ()",).split()[0],
                            garbage.split(",")
                        )
                        DATABASE.create_table_raw(
                            tablename=tablename,
                            columns=column_list[:],
                        )
                        DATABASE.store_contents()
                elif str(type).lower() == "select":
                    col_list_or_single = statement.tokens[2]
                    if "," not in str(col_list_or_single):
                        if str(col_list_or_single) == "*":
                            column_list = ['*']
                        else:
                            column_list = [str(col_list_or_single)]
                    else:
                        column_list = map(
                            lambda x: str(x),
                            col_list_or_single.get_identifiers()
                        )
                    if str(statement.tokens[4]).lower() == "from":
                        tab_list_or_single = statement.tokens[6]
                        if "," not in str(tab_list_or_single):
                            table_list = [str(tab_list_or_single)]
                        else:
                            table_list = map(
                                lambda x: str(x),
                                tab_list_or_single.get_identifiers()
                            )
                        cross_columns = reduce(
                            lambda x, y: x + y,
                            map(
                                lambda x: DATABASE.get_table(
                                    x
                                ).get_column_list_prefixed(),
                                table_list
                            )
                        )
                        cross_table = parthsql.Table(
                            name="temp",
                            columns=cross_columns,
                            rows=[]
                        )
                        for i in itertools.product(
                            *map(
                                lambda x: DATABASE.get_table(x).get_all_rows(),
                                table_list
                            )
                        ):
                            cross_table.put_row_raw(
                                reduce(
                                    lambda x, y: x + y,
                                    i
                                )
                            )

                        if len(statement.tokens) >= 9:
                            whereclause = statement.tokens[8]
                            if str(whereclause.tokens[0]).lower() == "where":
                                comparison = whereclause.tokens[2]
                                key = str(comparison.tokens[0])
                                try:
                                    value = int(str(comparison.tokens[4]))
                                    cross_table.invert_delete_row(key, value)
                                except:
                                    value = str(comparison.tokens[4])
                                    cross_table.invert_delete_row2(key, value)
                            else:
                                raise Exception(
                                    "Invalid Syntax of DELETE FROM t where k = v"
                                )

                        if "*" in column_list:
                            cross_table.print_contents()
                        else:
                            temp_list = []
                            for i in column_list:
                                temp_list.append(cross_table.get_column(i))
                            print "\t\t\t".join(column_list)
                            for i in zip(*(temp_list)):
                                print "\t\t\t".join(map(str, i))
                    else:
                        raise Exception(
                            "Invalid Syntax of SELECT c... FROM t... WHERE k = v"
                        )
                else:
                    raise Exception(
                        "Unsupported Operation"
                    )
        except ValueError:
            print("¯\_(ツ)_/¯")
        except IOError:
            print("¯\_(ツ)_/¯")
        except IndexError:
            print("¯\_(ツ)_/¯")
        except AttributeError:
            print("¯\_(ツ)_/¯")
        except Exception, e:
            print e.message
1274530
def p_if_statement_woelse(self, p):
        ''
        p[0] = IfStatement(p[3], p[5], None, lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
872039
def take_while(&predicate)
      filter("take_while") do |yielder, all_done|
        each do |element|
          throw all_done unless yield(element)
          yielder.call(element)
        end
      end
    end
1296728
function WhileStatement(node, print) {
  this.keyword("while");
  this.push("(");
  print.plain(node.test);
  this.push(")");
  print.block(node.body);
}
847485
def repl():
    
    while True:
        try:
            sys.stdout.write("Type in next query: \n> ")
            import locale
            query_str = raw_input().decode(sys.stdin.encoding or locale.getpreferredencoding(True))
        except KeyboardInterrupt:
            break

        if u'quit' in query_str:
            break

        print_query_and_parse_tree(query_str)
522444
private void check_Min_Value(long l, int cIdx, int rowNumber, ParseWriter dout) {
    if (l <= Long.MIN_VALUE) {
      String warning = "Orc Parser: Long.MIN_VALUE: " + l + " is found in column "+cIdx+" row "+rowNumber +
          " of stripe "+_cidx +".  This value is used for sentinel and will not be parsed correctly.";
      dout.addError(new ParseWriter.ParseErr(warning, _cidx, rowNumber, -2L));
    }
  }
1163741
def _at_while(self, calculator, rule, scope, block):
        
        first_condition = condition = calculator.calculate(block.argument)
        while condition:
            inner_rule = rule.copy()
            inner_rule.unparsed_contents = block.unparsed_contents
            if not self.should_scope_loop_in_rule(inner_rule):
                # DEVIATION: Allow not creating a new namespace
                inner_rule.namespace = rule.namespace
            self.manage_children(inner_rule, scope)
            condition = calculator.calculate(block.argument)
        rule.options['@if'] = first_condition
1209781
def lpop(self, key, *, encoding=_NOTSET):
        """"""
        return self.execute(b'LPOP', key, encoding=encoding)
990010
def p_if_statement_woelse_delay(self, p):
        ''
        p[0] = IfStatement(p[4], p[6], None, lineno=p.lineno(2))
        p.set_lineno(0, p.lineno(2))
459253
function parseStatements(lex, endTokens, isRoot) {
    endTokens = Array.isArray(endTokens) ? endTokens : [endTokens];
    var statements = [];
    var temp = lex.peek();
    while (endTokens.indexOf(temp) === -1 &&
           (temp.type && endTokens.indexOf(temp.type) === -1)) {
        var statement = parseStatement(lex, isRoot);
        if (!statement) {
            throw new Error('Invalid statement');
        }
        temp = lex.peek();
        statements.push(statement);
    }
    return statements;
}
1218398
private void countCoordinateStatement(Statement statement,
			ItemDocument itemDocument) {
		Value value = statement.getValue();
		if (!(value instanceof GlobeCoordinatesValue)) {
			return;
		}

		GlobeCoordinatesValue coordsValue = (GlobeCoordinatesValue) value;
		if (!this.globe.equals((coordsValue.getGlobe()))) {
			return;
		}

		int xCoord = (int) (((coordsValue.getLongitude() + 180.0) / 360.0) * this.width)
				% this.width;
		int yCoord = (int) (((coordsValue.getLatitude() + 90.0) / 180.0) * this.height)
				% this.height;

		if (xCoord < 0 || yCoord < 0 || xCoord >= this.width
				|| yCoord >= this.height) {
			System.out.println("Dropping out-of-range coordinate: "
					+ coordsValue);
			return;
		}

		countCoordinates(xCoord, yCoord, itemDocument);
		this.count += 1;

		if (this.count % 100000 == 0) {
			reportProgress();
			writeImages();
		}
	}
252173
def wait_until(predicate, timeout=30):
    
    not_expired = Timeout(timeout)
    while not_expired():
        r = predicate()
        if r:
            break
1110401
def p_event_statement(self, p):
        ''
        p[0] = EventStatement(p[1], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
249043
def p_while_start(p):
    
    p[0] = p[2]
    gl.LOOPS.append(('WHILE',))
    if is_number(p[2]) and not p[2].value:
        api.errmsg.warning_condition_is_always(p.lineno(1))
893770
def statement(self,phrase):
        
        t = datetime.now()
        s = str(t) + ' ' + str(phrase) + '\n'
        if self.echo:
            print(s,end='')
        if self.filename:
            self.f.write(s)
            self.f.flush()