Liest ein default Statement ein

@return default Statement
@throws TemplateException
350705
private final boolean defaultStatement(Data data, Switch swit) throws TemplateException {
	if (!data.srcCode.forwardIfCurrent("default", ':')) return false;

	// int line=data.srcCode.getLine();

	Body body = new BodyBase(data.factory);
	swit.setDefaultCase(body);
	switchBlock(data, body);
	return true;
    }
740629
public function getDefaultValue()
    {
        if (!$this->hasDefaultValue) {
            throw new \LogicException(sprintf('Argument $%s does not have a default value. Use %s::hasDefaultValue() to avoid this exception.', $this->name, __CLASS__));
        }

        return $this->defaultValue;
    }
292096
@CheckReturnValue
  protected Statement generateFunctionBody(TemplateNode node, String alias) {
    ImmutableList.Builder<Statement> bodyStatements = ImmutableList.builder();
    bodyStatements.add(
        Statement.assign(
            JsRuntime.OPT_IJ_DATA,
            id("opt_ijData_deprecated")
                .or(JsRuntime.OPT_IJ_DATA, templateTranslationContext.codeGenerator())
                .castAs("!soy.IjData")));
    if (node instanceof TemplateElementNode) {
      TemplateElementNode elementNode = (TemplateElementNode) node;
      for (TemplateStateVar stateVar : elementNode.getStateVars()) {
        Expression expr = getExprTranslator().exec(stateVar.defaultValue());
        // A  state variable can be something like ns.foo.FooProto|null. Without
        // this cast, access to this variable can trigger JS conformance errors
        // due to unknown type.
        if (!stateVar.type().equals(stateVar.defaultValue().getType())) {
          expr = expr.castAs(JsType.forJsSrc(stateVar.type()).typeExpr());
        }
        bodyStatements.add(VariableDeclaration.builder(stateVar.name()).setRhs(expr).build());
      }
    }
    // Generate statement to ensure data is defined, if necessary.
    if (new ShouldEnsureDataIsDefinedVisitor().exec(node)) {
      bodyStatements.add(
          assign(
              OPT_DATA,
              OPT_DATA.or(EMPTY_OBJECT_LITERAL, templateTranslationContext.codeGenerator())));
    }

    // Type check parameters.
    bodyStatements.add(genParamTypeChecks(node, alias));

    SanitizedContentKind kind = node.getContentKind();
    if (isComputableAsJsExprsVisitor.exec(node)) {
      // Case 1: The code style is 'concat' and the whole template body can be represented as JS
      // expressions. We specially handle this case because we don't want to generate the variable
      // 'output' at all. We simply concatenate the JS expressions and return the result.

      List<Expression> templateBodyChunks = genJsExprsVisitor.exec(node);
      if (kind == null) {
        // The template is not strict. Thus, it may not apply an escaping directive to *every* print
        // command, which means that some of its print commands could produce a number. Thus, there
        // is a danger that a plus operator between two expressions in the list will do numeric
        // addition instead of string concatenation. Furthermore, a non-strict template always needs
        // to return a string, but if there is just one expression in the list, and we return it as
        // is, we may not always produce a string (since an escaping directive may not be getting
        // applied in that expression at all, or a directive might be getting applied that produces
        // SanitizedContent). We thus call a method that makes sure to return an expression that
        // produces a string and is in no danger of using numeric addition when concatenating the
        // expressions in the list.
        bodyStatements.add(returnValue(CodeChunkUtils.concatChunksForceString(templateBodyChunks)));
      } else {
        // The template is strict. Thus, it applies an escaping directive to *every* print command,
        // which means that no print command produces a number, which means that there is no danger
        // of a plus operator between two print commands doing numeric addition instead of string
        // concatenation. And since a strict template needs to return SanitizedContent, it is ok to
        // get an expression that produces SanitizedContent, which is indeed possible with an
        // escaping directive that produces SanitizedContent. Thus, we do not have to be extra
        // careful when concatenating the expressions in the list.
        bodyStatements.add(
            returnValue(sanitize(CodeChunkUtils.concatChunks(templateBodyChunks), kind)));
      }
    } else {
      // Case 2: Normal case.

      jsCodeBuilder.pushOutputVar("output");
      Statement codeChunk = visitChildrenReturningCodeChunk(node);
      jsCodeBuilder.popOutputVar();
      bodyStatements.add(Statement.of(codeChunk, returnValue(sanitize(id("output"), kind))));
    }
    return Statement.of(bodyStatements.build());
  }
417607
function (out, tree) {
            var rootStatement = tree.content[0];
            if (tree.content.length != 1 || (rootStatement.name != this._rootStatement)) {
                return out.logError(tree, this.TEMPLATE_STATEMENT_EXPECTED, [this._rootStatement]);
            }
            if (rootStatement.content == null) {
                return out.logError(rootStatement, this.EXPECTED_CONTAINER, [this._rootStatement]);
            }
            var param;
            try {
                // The parameter should be a JSON object
                param = Aria["eval"]("return (" + rootStatement.paramBlock + ");");
            } catch (e) {
                return out.logError(rootStatement, this.ERROR_IN_TEMPLATE_PARAMETER, [this._rootStatement], e);
            }

            if (!ariaCoreJsonValidator.normalize({
                json : param,
                beanName : this._templateParamBean
            })) {
                return out.logError(rootStatement, this.CHECK_ERROR_IN_TEMPLATE_PARAMETER, [this._rootStatement]);
            }
            out.templateParam = param;
            rootStatement.properties = param;

            this._processTemplateContent({
                out : out,
                statement : rootStatement
            });
        }
885240
@Override
    boolean valuesAreTheSameAsDefault()
    {
        if (getDefaultValues() == null || getDefaultValues().size() == 0)
            return false;
        if (getValues() == null || getValues().size() == 0)
            return false;
        if (getDefaultValues().size() != getValues().size())
            return false;
        for (int v = 0; v < getDefaultValues().size(); v++)
        {
            if (isCaseSensitive() && !getDefaultValues().get(v).equals(getValues().get(v)))
                return false;
            if (!isCaseSensitive() && !getDefaultValues().get(v).equalsIgnoreCase(getValues().get(v)))
                return false;
        }
        return true;
    }
180381
public int doStartTag()
            throws JspException {

        Tag parent = getParent();
        if (parent != null) {
            String s = Bundle.getString("TempExcp_ContainedTemplate");
            registerTagError(s,null);
            reportErrors();
            _fatalError = true;
            return SKIP_BODY;
        }

        ServletRequest req = pageContext.getRequest();
        _savedContext = (TemplateContext) req.getAttribute(TEMPLATE_SECTIONS);
        TemplateContext ctxt = new TemplateContext();
        req.setAttribute(TEMPLATE_SECTIONS,ctxt);

        return EVAL_BODY_INCLUDE;
    }
526574
public function getDefaultClause($xmldb_field) {

        $defaultvalue = $this->getDefaultValue ($xmldb_field);

        if ($defaultvalue !== null) {
            return ' DEFAULT ' . $defaultvalue;
        } else {
            return null;
        }
    }
871957
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlArtifact == null) {
			this.sarlArtifact = SarlFactory.eINSTANCE.createSarlArtifact();
			script.getXtendTypes().add(this.sarlArtifact);
			this.sarlArtifact.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration());
			if (!Strings.isEmpty(name)) {
				this.sarlArtifact.setName(name);
			}
		}
	}
735486
private ThymeleafTemplater getOrCreateTemplater()
	{
		ThymeleafTemplater templater = this.templater.get();

		// Lazy-create a ThymeleafTemplater
		if (templater == null)
		{
			final TemplateEngine engine = getOrCreateEngine();

			templater = new ThymeleafTemplater(engine, configuration, metrics, userProvider);

			templater.set("coreRestPrefix", coreRestPrefix);
			templater.set("coreRestEndpoint", coreRestEndpoint.toString());
			templater.set("coreServices", services);
			templater.set("currentUser", new ThymeleafCurrentUserUtils(userProvider));

			this.templater = new WeakReference<>(templater);
		}

		return templater;
	}
416660
static function isTemplatesUsageStatisticsEnabled()
    {
        if ( !isset( $GLOBALS['eZTemplateDebugTemplatesUsageStatisticsEnabled'] ) )
        {
            $ini = eZINI::instance();
            $GLOBALS['eZTemplateDebugTemplatesUsageStatisticsEnabled'] = $ini->variable( 'TemplateSettings', 'ShowUsedTemplates' ) == 'enabled';
        }
        return ( $GLOBALS['eZTemplateDebugTemplatesUsageStatisticsEnabled'] );
    }
885117
public function setDefault($default)
    {
        if ($default !== null && !$this->getDataType()->doesAllowDefault()) {
            throw new LogicException(
                sprintf(
                    'Unable to set default value for the column. The data-type "%s" does not support a default.',
                    $this->getDataType()->getType()
                )
            );
        }

        if (is_array($default)) {
            foreach ($default as $k => $v) {
                $default[$k] = $this->getDataType()->cast($v);
            }
        } elseif ($default !== null) {
            if (!($this->getDataType() instanceof TimeTypeInterface)) {
                $default = $this->getDataType()->cast($default);
            }
        }

        $this->default = $default;
    }
783186
public function getDefaultValue()
    {
        if ($this->isDefaultValueAvailable()) {
            $prettyPrinter = new PrettyPrinter\Standard;
            return $prettyPrinter->prettyPrintExpr($this->node->default);
        }
        throw new ModelException(
            sprintf(
                'Parameter #%d [$%s] is not optional.',
                $this->getPosition(),
                $this->getName()
            )
        );
    }
1088698
public function setTemplateValues(EntityInterface $templateValues = null)
    {
        if (!$templateValues instanceof TemplateValues) {
            $templateValues = new TemplateValues($templateValues);
        }
        $this->templateValues = $templateValues;
        return $this;
    }
968716
public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) {
		setTypeResolutionContext(typeContext);
		this.context = context;
			this.parameter = SarlFactory.eINSTANCE.createSarlFormalParameter();
			this.parameter.setName(name);
			this.parameter.setParameterType(newTypeRef(this.context, Object.class.getName()));
			this.context.getParameters().add(this.parameter);
	}
841488
private final DoWhile doStatement(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("do")) {
	    id = null;
	    if (!data.srcCode.isCurrent('{') && !data.srcCode.isCurrent(' ') && !data.srcCode.isCurrent('/')) {
		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("do", '{') && !data.srcCode.forwardIfCurrent("do ") && !data.srcCode.forwardIfCurrent("do", '/')) {
		data.srcCode.setPos(pos);
		return null;
	    }
	    data.srcCode.previous();
	}

	// if(!data.srcCode.forwardIfCurrent("do",'{') && !data.srcCode.forwardIfCurrent("do ") &&
	// !data.srcCode.forwardIfCurrent("do",'/'))
	// return null;

	Position line = data.srcCode.getPosition();
	Body body = new BodyBase(data.factory);

	// data.srcCode.previous();

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

	comments(data);
	if (!data.srcCode.forwardIfCurrent("while", '(')) throw new TemplateException(data.srcCode, "do statement must have a while at the end");

	DoWhile doWhile = new DoWhile(condition(data), body, line, data.srcCode.getPosition(), id);

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

	return doWhile;
    }
250718
private Expression expoOp(Data data) throws TemplateException {
	Expression expr = unaryOp(data);

	// Modulus Operation
	while (data.srcCode.forwardIfCurrent('^') || data.srcCode.forwardIfCurrentAndNoWordAfter("exp")) {
	    comments(data);
	    expr = data.factory.opDouble(expr, unaryOp(data), Factory.OP_DBL_EXP);
	}
	return expr;
    }
426853
protected Expression string(Data data) throws TemplateException {

	// check starting character for a string literal
	if (!data.srcCode.isCurrent('"') && !data.srcCode.isCurrent('\'')) return null;
	Position line = data.srcCode.getPosition();

	// Init Parameter
	char quoter = data.srcCode.getCurrentLower();
	StringBuilder str = new StringBuilder();
	Expression expr = null;

	while (data.srcCode.hasNext()) {
	    data.srcCode.next();
	    // check sharp
	    if (data.srcCode.isCurrent('#')) {

		// Ecaped sharp
		if (data.srcCode.isNext('#')) {
		    data.srcCode.next();
		    str.append('#');
		}
		// get Content of sharp
		else {
		    data.srcCode.next();
		    comments(data);
		    Expression inner = assignOp(data);
		    comments(data);
		    if (!data.srcCode.isCurrent('#')) throw new TemplateException(data.srcCode, "Invalid Syntax Closing [#] not found");

		    ExprString exprStr = null;
		    if (str.length() != 0) {
			exprStr = data.factory.createLitString(str.toString(), line, data.srcCode.getPosition());
			if (expr != null) {
			    expr = data.factory.opString(expr, exprStr);
			}
			else expr = exprStr;
			str = new StringBuilder();
		    }
		    if (expr == null) {
			expr = inner;
		    }
		    else {
			expr = data.factory.opString(expr, inner);
		    }
		}
	    }
	    // check quoter
	    else if (data.srcCode.isCurrent(quoter)) {
		// Ecaped sharp
		if (data.srcCode.isNext(quoter)) {
		    data.srcCode.next();
		    str.append(quoter);
		}
		// finsish
		else {
		    break;
		}
	    }
	    // all other character
	    else {
		str.append(data.srcCode.getCurrent());
	    }
	}
	if (!data.srcCode.forwardIfCurrent(quoter)) throw new TemplateException(data.srcCode, "Invalid Syntax Closing [" + quoter + "] not found");

	if (expr == null) expr = data.factory.createLitString(str.toString(), line, data.srcCode.getPosition());
	else if (str.length() != 0) {
	    expr = data.factory.opString(expr, data.factory.createLitString(str.toString(), line, data.srcCode.getPosition()));
	}
	comments(data);

	if (expr instanceof Variable) {
	    Variable var = (Variable) expr;
	    var.fromHash(true);
	}

	return expr;

    }