Example #1
0
        JsAstNode ParseStatementLevelConditionalComment(bool fSourceElement)
        {
            JsContext context = m_currentToken.Clone();
            JsConditionalCompilationComment conditionalComment = new JsConditionalCompilationComment(context, this);

            GetNextToken();
            while(m_currentToken.Token != JsToken.ConditionalCommentEnd && m_currentToken.Token != JsToken.EndOfFile)
            {
                // if we get ANOTHER start token, it's superfluous and we should ignore it.
                // otherwise parse another statement and keep going
                if (m_currentToken.Token == JsToken.ConditionalCommentStart)
                {
                    GetNextToken();
                }
                else
                {
                    conditionalComment.Append(ParseStatement(fSourceElement));
                }
            }

            GetNextToken();

            // if the conditional comment is empty (for whatever reason), then
            // we don't want to return anything -- we found nothing.
            return conditionalComment.Statements.Count > 0 ? conditionalComment : null;
        }