コード例 #1
0
        private static ReadOnlySpan <char> ParseJsConditionalExpression(this ReadOnlySpan <char> 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);
        }
コード例 #2
0
 protected bool Equals(JsConditionalExpression other)
 {
     return(Equals(Test, other.Test) &&
            Equals(Consequent, other.Consequent) &&
            Equals(Alternate, other.Alternate));
 }