示例#1
0
        private void WriteBegin(ScriptNode node)
        {
            var rawStatement = node as ScriptRawStatement;

            if (!IsBlockOrPage(node))
            {
                if (_isInCode)
                {
                    if (rawStatement != null)
                    {
                        _nextRStrip = GetWhitespaceModeFromTrivia(rawStatement, true);
                        WriteExitCode();
                    }
                }
                else if (rawStatement == null)
                {
                    if (_previousRawStatement != null)
                    {
                        _nextLStrip = GetWhitespaceModeFromTrivia(_previousRawStatement, false);
                    }

                    WriteEnterCode();
                }
            }

            WriteTrivias(node, true);

            HandleEos(node);

            // Add a space if this is required and no trivia are providing it
            if (node.CanHaveLeadingTrivia())
            {
                if (_expectSpace && !_previousHasSpace)
                {
                    Write(" ");
                }

                _expectSpace = false;
            }
        }
示例#2
0
        private void WriteBegin(ScriptNode node)
        {
            WriteTrivias(node, true);

            HandleEos(node);

            if (_hasEndOfStatement)
            {
                _hasEndOfStatement    = false;
                _expectEndOfStatement = false;
            }

            // Add a space if this is required and no trivia are providing it
            if (node.CanHaveLeadingTrivia())
            {
                if (_expectSpace && !_previousHasSpace)
                {
                    Write(" ");
                }
                _expectSpace = false;
            }
        }