Liest ein while Statement ein. <br />
EBNF:<br />
<code>spaces condition spaces ")" spaces block;</code>

@return while Statement
@throws TemplateException
485930
private final While whileStatement(Data data) throws TemplateException {
	int pos = data.srcCode.getPos();

	// id
	String id = variableDec(data, false);
	if (id == null) {
	    data.srcCode.setPos(pos);
	    return null;
	}
	if (id.equalsIgnoreCase("while")) {
	    id = null;
	    data.srcCode.removeSpace();
	    if (!data.srcCode.forwardIfCurrent('(')) {
		data.srcCode.setPos(pos);
		return null;
	    }
	}
	else {
	    data.srcCode.removeSpace();
	    if (!data.srcCode.forwardIfCurrent(':')) {
		data.srcCode.setPos(pos);
		return null;
	    }
	    data.srcCode.removeSpace();

	    if (!data.srcCode.forwardIfCurrent("while", '(')) {
		data.srcCode.setPos(pos);
		return null;
	    }
	}

	Position line = data.srcCode.getPosition();
	Body body = new BodyBase(data.factory);
	While whil = new While(condition(data), body, line, null, id);

	if (!data.srcCode.forwardIfCurrent(')')) throw new TemplateException(data.srcCode, "while statement must end with a [)]");

	Body prior = data.setParent(body);
	statement(data, body, CTX_WHILE);
	data.setParent(prior);

	whil.setEnd(data.srcCode.getPosition());
	return whil;
    }
558807
private Expression concatOp(Data data) throws TemplateException {
	Expression expr = plusMinusOp(data);

	while (data.srcCode.isCurrent('&') && !data.srcCode.isCurrent("&&")) {
	    data.srcCode.next();

	    // &=
	    if (data.srcCode.isCurrent('=') && expr instanceof Variable) {
		data.srcCode.next();
		comments(data);
		Expression value = assignOp(data);

		expr = data.factory.opUnary((Variable) expr, value, Factory.OP_UNARY_PRE, Factory.OP_UNARY_CONCAT, expr.getStart(), data.srcCode.getPosition());

		// ExprString res = OpString.toExprString(expr, right);
		// expr=new OpVariable((Variable)expr,res,data.cfml.getPosition());
	    }
	    else {
		comments(data);
		expr = data.factory.opString(expr, plusMinusOp(data));
	    }

	}
	return expr;
    }
169807
public function setTemplatesStatus(string $templates_status = "D") : CNabuDataObject
    {
        if ($templates_status === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$templates_status")
            );
        }
        $this->setValue('nb_messaging_lang_templates_status', $templates_status);
        
        return $this;
    }
449107
public final void block() throws RecognitionException {
		int block_StartIndex = input.index();


		            increaseLevel();
		        
		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 80) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:5: ( '{' ( blockStatement )* '}' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:7: '{' ( blockStatement )* '}'
			{
			match(input,121,FOLLOW_121_in_block2769); if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:11: ( blockStatement )*
			loop104:
			while (true) {
				int alt104=2;
				int LA104_0 = input.LA(1);
				if ( ((LA104_0 >= CharacterLiteral && LA104_0 <= DecimalLiteral)||LA104_0==ENUM||LA104_0==FloatingPointLiteral||(LA104_0 >= HexLiteral && LA104_0 <= Identifier)||(LA104_0 >= OctalLiteral && LA104_0 <= StringLiteral)||LA104_0==29||LA104_0==36||(LA104_0 >= 40 && LA104_0 <= 41)||(LA104_0 >= 44 && LA104_0 <= 45)||(LA104_0 >= 52 && LA104_0 <= 53)||LA104_0==58||(LA104_0 >= 63 && LA104_0 <= 67)||(LA104_0 >= 70 && LA104_0 <= 73)||(LA104_0 >= 75 && LA104_0 <= 77)||(LA104_0 >= 79 && LA104_0 <= 80)||(LA104_0 >= 82 && LA104_0 <= 83)||(LA104_0 >= 85 && LA104_0 <= 87)||LA104_0==90||(LA104_0 >= 92 && LA104_0 <= 98)||(LA104_0 >= 100 && LA104_0 <= 112)||(LA104_0 >= 114 && LA104_0 <= 121)||LA104_0==126) ) {
					alt104=1;
				}

				switch (alt104) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:693:11: blockStatement
					{
					pushFollow(FOLLOW_blockStatement_in_block2771);
					blockStatement();
					state._fsp--;
					if (state.failed) return;
					}
					break;

				default :
					break loop104;
				}
			}

			match(input,125,FOLLOW_125_in_block2774); if (state.failed) return;
			}

			if ( state.backtracking==0 ) {
			            if( localVariableLevel <= 1 ) {
			                // this is the top level block, so set the top level declarations
			                rootBlockDescr.setInScopeLocalVars( getLocalDeclarations() );
			            }
			            decreaseLevel();
			        }
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 80, block_StartIndex); }

		}
	}
631855
def tryStatement(self, block):
        
        currentBlock = self._prevNonEmptyBlock(block)

        if not currentBlock.isValid():
            return None

        indentation = None

        currentBlockText = currentBlock.text()
        if currentBlockText.endswith('('):
            # increase indent level
            dbg("tryStatement: success 1 in line %d" % block.blockNumber())
            return self._increaseIndent(self._lineIndent(currentBlockText))

        alignOnSingleQuote = self._qpart.language() in ('PHP/PHP', 'JavaScript')
        # align on strings "..."\n => below the opening quote
        # multi-language support: [\.+] for javascript or php
        pattern =  '^(.*)'                   # any                                                  group 1
        pattern += '([,"\'\\)])'             # one of [ , " ' )                                     group 2
        pattern += '(;?)'                    # optional ;                                           group 3
        pattern += '\s*[\.+]?\s*'            # optional spaces  optional . or +   optional spaces
        pattern += '(//.*|/\\*.*\\*/\s*)?$'  # optional(//any  or  /*any*/spaces)                   group 4
        match = re.match(pattern, currentBlockText)
        if match is not None:
            alignOnAnchor = len(match.group(3)) == 0 and match.group(2) != ')'
            # search for opening ", ' or (
            if match.group(2) == '"' or (alignOnSingleQuote and match.group(2) == "'"):
                startIndex = len(match.group(1))
                while True:
                    # start from matched closing ' or "
                    # find string opener
                    for i in range(startIndex - 1, 0, -1):
                        # make sure it's not commented out
                        if currentBlockText[i] == match.group(2) and (i == 0 or currentBlockText[i - 1] != '\\'):
                            # also make sure that this is not a line like '#include "..."' <-- we don't want to indent here
                            if re.match(r'^#include', currentBlockText):
                                dbg("tryStatement: success 2 in line %d" % block.blockNumber())
                                return indentation

                            break

                    if not alignOnAnchor and currentBlock.previous().isValid():
                        # when we finished the statement (;) we need to get the first line and use it's indentation
                        # i.e.: $foo = "asdf"; -> align on $
                        i -= 1 # skip " or '
                        # skip whitespaces and stuff like + or . (for PHP, JavaScript, ...)
                        for i in range(i, 0, -1):
                            if currentBlockText[i] in (' ', '\t', '.', '+'):
                                continue
                            else:
                                break

                        if i > 0:
                            # there's something in this line, use it's indentation
                            break
                        else:
                            # go to previous line
                            currentBlock = currentBlock.previous()
                            currentBlockText = currentBlock.text()
                            startIndex = len(currentBlockText)
                    else:
                        break

            elif match.group(2) == ',' and not '(' in currentBlockText:
                # assume a function call: check for '(' brace
                # - if not found, use previous indentation
                # - if found, compare the indentation depth of current line and open brace line
                #   - if current indentation depth is smaller, use that
                #   - otherwise, use the '(' indentation + following white spaces
                currentIndentation = self._blockIndent(currentBlock)
                try:
                    foundBlock, foundColumn = self.findBracketBackward(currentBlock, len(match.group(1)), '(')
                except ValueError:
                    indentation = currentIndentation
                else:
                    indentWidth = foundColumn + 1
                    text = foundBlock.text()
                    while indentWidth < len(text) and text[indentWidth].isspace():
                        indentWidth += 1
                    indentation = self._makeIndentAsColumn(foundBlock, indentWidth)

            else:
                try:
                    foundBlock, foundColumn = self.findBracketBackward(currentBlock, len(match.group(1)), '(')
                except ValueError:
                    pass
                else:
                    if alignOnAnchor:
                        if not match.group(2) in ('"', "'"):
                            foundColumn += 1
                        foundBlockText = foundBlock.text()
                        while foundColumn < len(foundBlockText) and \
                              foundBlockText[foundColumn].isspace():
                            foundColumn += 1
                        indentation = self._makeIndentAsColumn(foundBlock, foundColumn)
                    else:
                        currentBlock = foundBlock
                        indentation = self._blockIndent(currentBlock)
        elif currentBlockText.rstrip().endswith(';'):
            indentation = self._blockIndent(currentBlock)

        if indentation is not None:
            dbg("tryStatement: success in line %d" % currentBlock.blockNumber())
        return indentation
1303761
public final BaseDescr conditionalAndExpression() throws RecognitionException {
		BaseDescr result = null;


		BaseDescr left =null;
		AnnotationDescr args =null;
		BaseDescr right =null;

		try {
			// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:231:3: (left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )* )
			// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:231:5: left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )*
			{
			pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression1182);
			left=inclusiveOrExpression();
			state._fsp--;
			if (state.failed) return result;
			if ( state.backtracking==0 ) { if( buildDescr  ) { result = left; } }
			// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:232:3: ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )*
			loop27:
			while (true) {
				int alt27=2;
				int LA27_0 = input.LA(1);
				if ( (LA27_0==DOUBLE_AMPER) ) {
					alt27=1;
				}

				switch (alt27) {
				case 1 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:232:5: DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression
					{
					match(input,DOUBLE_AMPER,FOLLOW_DOUBLE_AMPER_in_conditionalAndExpression1190); if (state.failed) return result;
					if ( state.backtracking==0 ) { if ( isNotEOF() ) helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR ); }
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:234:13: (args= fullAnnotation[null] )?
					int alt26=2;
					int LA26_0 = input.LA(1);
					if ( (LA26_0==AT) ) {
						alt26=1;
					}
					switch (alt26) {
						case 1 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:234:13: args= fullAnnotation[null]
							{
							pushFollow(FOLLOW_fullAnnotation_in_conditionalAndExpression1213);
							args=fullAnnotation(null);
							state._fsp--;
							if (state.failed) return result;
							}
							break;

					}

					pushFollow(FOLLOW_inclusiveOrExpression_in_conditionalAndExpression1219);
					right=inclusiveOrExpression();
					state._fsp--;
					if (state.failed) return result;
					if ( state.backtracking==0 ) { if( buildDescr  ) {
					               ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newAnd();
					               descr.addOrMerge( result );
					               descr.addOrMerge( right );
					               if ( args != null ) { descr.addAnnotation( args ); }
					               result = descr;
					           }
					         }
					}
					break;

				default :
					break loop27;
				}
			}

			}

		}

		catch (RecognitionException re) {
		    throw re;
		}

		finally {
			// do for sure before leaving
		}
		return result;
	}
1072024
public LinkedList<UriTemplateComponent> scan(String templateString) throws MalformedUriTemplateException
    {
        char[] template = templateString.toCharArray();
        startTemplate();
        int i;
        for (i = 0; i < template.length; i++)
        {
            char c = template[i];

            if (c == EXPR_START)
            {
                if (literalCaptureOn)
                {
                    endLiteral(i);
                }
                startExpression(i);
            }

            if (c != EXPR_START)
            {
                startLiteral(i);
            }


            if (expressionCaptureOn || literalCaptureOn)
            {
                capture(c);
            }

            if (c == EXPR_END)
            {
                endExpression(i);
                startLiteral(i);
            }
        }
        if (literalCaptureOn)
        {
            endLiteral(i);
        }
        endTemplate(i);
        return components;
    }
251988
private final TryCatchFinally tryStatement(Data data) throws TemplateException {
	if (!data.srcCode.forwardIfCurrent("try", '{') && !data.srcCode.forwardIfCurrent("try ") && !data.srcCode.forwardIfCurrent("try", '/')) return null;
	data.srcCode.previous();

	Body body = new BodyBase(data.factory);
	TryCatchFinally tryCatchFinally = new TryCatchFinally(data.factory, body, data.srcCode.getPosition(), null);

	Body prior = data.setParent(body);
	statement(data, body, CTX_TRY);
	data.setParent(prior);
	comments(data);

	// catches
	short catchCount = 0;
	while (data.srcCode.forwardIfCurrent("catch", '(')) {
	    catchCount++;
	    comments(data);

	    // type
	    int pos = data.srcCode.getPos();
	    Position line = data.srcCode.getPosition();
	    Expression name = null, type = null;

	    StringBuffer sbType = new StringBuffer();
	    String id;
	    while (true) {
		id = identifier(data, false);
		if (id == null) break;
		sbType.append(id);
		data.srcCode.removeSpace();
		if (!data.srcCode.forwardIfCurrent('.')) break;
		sbType.append('.');
		data.srcCode.removeSpace();
	    }

	    if (sbType.length() == 0) {
		type = string(data);
		if (type == null) throw new TemplateException(data.srcCode, "a catch statement must begin with the throwing type (query, application ...).");
	    }
	    else {
		type = data.factory.createLitString(sbType.toString());
	    }

	    // name = expression();
	    comments(data);

	    // name
	    if (!data.srcCode.isCurrent(')')) {
		name = expression(data);
	    }
	    else {
		data.srcCode.setPos(pos);
		name = expression(data);
		type = data.factory.createLitString("any");
	    }
	    comments(data);

	    Body b = new BodyBase(data.factory);
	    try {
		tryCatchFinally.addCatch(type, name, b, line);
	    }
	    catch (TransformerException e) {
		throw new TemplateException(data.srcCode, e.getMessage());
	    }
	    comments(data);

	    if (!data.srcCode.forwardIfCurrent(')')) throw new TemplateException(data.srcCode, "invalid catch statement, missing closing )");

	    Body _prior = data.setParent(b);
	    statement(data, b, CTX_CATCH);
	    data.setParent(_prior);
	    comments(data);
	}

	// finally
	if (finallyStatement(data, tryCatchFinally)) {
	    comments(data);
	}
	else if (catchCount == 0) throw new TemplateException(data.srcCode, "a try statement must have at least one catch statement");

	// if(body.isEmpty()) return null;
	tryCatchFinally.setEnd(data.srcCode.getPosition());
	return tryCatchFinally;
    }
299402
function process( $tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace )
    {
        if ( count( $functionParameters ) == 0 )
        {
            eZDebug::writeError( "Not enough arguments passed to 'while' function." );
            return;
        }

        $loop = new eZTemplateLoop( eZTemplateWhileFunction::FUNCTION_NAME,
                                    $functionParameters, $functionChildren, $functionPlacement,
                                    $tpl, $textElements, $rootNamespace, $currentNamespace );

        if ( !$loop->initialized() )
            return;

        while ( $tpl->elementValue( $functionParameters['condition'], $rootNamespace, $currentNamespace, $functionPlacement ) )
        {
            $loop->setSequenceVar(); // set sequence variable (if specified)
            $loop->processDelimiter();
            $loop->resetIteration();

            if ( $loop->processChildren() )
                break;

            $loop->incrementSequence();
        }

        $loop->cleanup();
    }
883508
protected Expression assignOp(Data data) throws TemplateException {

	Expression expr = conditionalOp(data);
	if (data.srcCode.forwardIfCurrent('=')) {

	    comments(data);
	    if (data.mode == STATIC) expr = new DynAssign(expr, assignOp(data));
	    else {
		if (expr instanceof Variable) {
		    Expression value = assignOp(data);
		    expr = new Assign((Variable) expr, value, data.srcCode.getPosition());
		}
		else if (expr instanceof Null) {
		    Variable var = ((Null) expr).toVariable();
		    Expression value = assignOp(data);
		    expr = new Assign(var, value, data.srcCode.getPosition());
		}
		else if (expr instanceof NullConstant) {
		    Variable var = ((NullConstant) expr).toVariable();
		    Expression value = assignOp(data);
		    expr = new Assign(var, value, data.srcCode.getPosition());
		}
		else throw new TemplateException(data.srcCode, "invalid assignment left-hand side (" + expr.getClass().getName() + ")");
	    }
	}

	// patch for test()(); only works at the end of an expression!
	comments(data);
	while (data.srcCode.isCurrent('(')) {
	    comments(data);
	    Call call = new Call(expr);
	    getFunctionMemberAttrs(data, null, false, call, null);
	    call.setEnd(data.srcCode.getPosition());
	    comments(data);
	    expr = call;
	}
	return expr;
    }
1114463
@Nullable
    public static String escape(@CheckForNull String text) {
        if (text==null)     return null;
        StringBuilder buf = new StringBuilder(text.length()+64);
        for( int i=0; i<text.length(); i++ ) {
            char ch = text.charAt(i);
            if(ch=='\n')
                buf.append("<br>");
            else
            if(ch=='<')
                buf.append("&lt;");
            else
            if(ch=='>')
                buf.append("&gt;");
            else
            if(ch=='&')
                buf.append("&amp;");
            else
            if(ch=='"')
                buf.append("&quot;");
            else
            if(ch=='\'')
                buf.append("&#039;");
            else
            if(ch==' ') {
                // All spaces in a block of consecutive spaces are converted to
                // non-breaking space (&nbsp;) except for the last one.  This allows
                // significant whitespace to be retained without prohibiting wrapping.
                char nextCh = i+1 < text.length() ? text.charAt(i+1) : 0;
                buf.append(nextCh==' ' ? "&nbsp;" : " ");
            }
            else
                buf.append(ch);
        }
        return buf.toString();
    }
339939
public static QueryTemplate create(String name,
                                     Iterable<String> values,
                                     Charset charset,
                                     CollectionFormat collectionFormat) {
    if (Util.isBlank(name)) {
      throw new IllegalArgumentException("name is required.");
    }

    if (values == null) {
      throw new IllegalArgumentException("values are required");
    }

    /* remove all empty values from the array */
    Collection<String> remaining = StreamSupport.stream(values.spliterator(), false)
        .filter(Util::isNotBlank)
        .collect(Collectors.toList());

    StringBuilder template = new StringBuilder();
    Iterator<String> iterator = remaining.iterator();
    while (iterator.hasNext()) {
      template.append(iterator.next());
      if (iterator.hasNext()) {
        template.append(COLLECTION_DELIMITER);
      }
    }

    return new QueryTemplate(template.toString(), name, remaining, charset, collectionFormat);
  }
1128696
final public ThenExpressionBuilder<T> ifExp() {
    return new ThenExpressionBuilder<T>(new ExpressionHandler<ThenBuilder<T>>() {
      public ThenBuilder<T> handleExpression(final Expression e) {
        return new ThenBuilder<T>(e, new IfStatementHandler<T>() {
          public T handleStatement(IfStatement ifStatement) {
            return statementHandler().handleStatement(ifStatement);
          }
        }, builder);
      }
    });
  }
405186
public function get() {
    $__html = NULL;
    
    if ($this->validate()) {
    
      /* dies ersetzt variablen die durch das template verändert werden können: $$__varName */
      extract((array)$this->vars);
      
      $tpl = $this;

      /* get as String */
      try {
        ob_start();
        require $this->file;
        $__html = ob_get_contents();
        ob_end_clean();
      } catch (\Psc\Exception $e) {
        $e->setMessage(sprintf('in TPL(%s): %s',$this->getDisplayName(),$e->getMessage()));
        throw $e;
      }
  
      /* testen ob noch variablen übrig sind */
      //if (DEV) {
      //  $__matches = array();
      //  if (preg_match_all('/\{\$([a-zA-Z_0-9]*)\}/',$__html,$__matches,PREG_SET_ORDER) > 0) {
      //    foreach ($__matches as $__match) {
      //    //throw new Exception('in Template: '.$__fileName.' ist Variable "'.$__match[1].'" nicht definiert');
      //      trigger_error('in Template: '.$__fileName.' wird die Variable "'.$__match[1].'" nicht definiert (die von einem anderen Template benötigt wird)',E_USER_WARNING);
      //    }
      //  }
      //}
  
      if ($this->indent !== NULL) {
        $__html = S::indent($__html, $this->indent);
      }
    }

    return $__html;
  }
482297
def while_statement(self):
        
        self._process(Nature.WHILE)
        condition = self.logical_or_expr()
        compound = self.compound()
        return WhileStatement(condition=condition, compound=compound)
1267998
private ParseTree parseWhileStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.WHILE);
    eat(TokenType.OPEN_PAREN);
    ParseTree condition = parseExpression();
    eat(TokenType.CLOSE_PAREN);
    ParseTree body = parseStatement();
    return new WhileStatementTree(getTreeLocation(start), condition, body);
  }
194178
private function innerStatementBlock() {
    $node = new StatementBlockNode();
    $this->mustMatch('{', $node, NULL, FALSE, TRUE);
    $this->innerStatementList($node, '}');
    $this->mustMatch('}', $node, NULL, TRUE, TRUE);
    return $node;
  }