Beispiel #1
0
        private static StringSegment ParseJsConditionalExpression(this StringSegment literal, JsToken test, out JsConditionalExpression expression)
        {
            literal = literal.Advance(1);

            literal = literal.ParseJsExpression(out var consequent);
            literal = literal.AdvancePastWhitespace();

            if (!literal.FirstCharEquals(':'))
            {
                throw new SyntaxErrorException($"Expected Conditional ':' but was {literal.DebugFirstChar()}");
            }

            literal = literal.Advance(1);

            literal = literal.ParseJsExpression(out var alternate);

            expression = new JsConditionalExpression(test, consequent, alternate);
            return(literal);
        }
 protected bool Equals(JsConditionalExpression other)
 {
     return(Equals(Test, other.Test) &&
            Equals(Consequent, other.Consequent) &&
            Equals(Alternate, other.Alternate));
 }