public void EndOfLineBlock()
 {
     if (_position != CodePositions.LineStart && _position != CodePositions.BlockStart)
     {
         _position = CodePositions.BlockEnd;
     }
 }
 public void EndOfLine()
 {
     if (_position != CodePositions.LineStart)
     {
         _position = CodePositions.StatementEnd;
     }
 }
        public void BeginBlock()
        {
            if (_position != CodePositions.LineStart)
            {
                _code.AppendLine();
            }

            _position = CodePositions.LineStart;

            AppendToken("{");
            _blockLevel++;

            _position = CodePositions.BlockStart;
        }
        public void EndBlock()
        {
            if (_blockLevel == 0)
            {
                throw new InvalidOperationException("Blocklevel ist 0");
            }

            if (_position != CodePositions.LineStart)
            {
                _code.AppendLine();
            }

            _position = CodePositions.LineStart;

            _blockLevel--;
            AppendToken("}");

            _position = CodePositions.BlockEnd;
        }
        public void AppendToken(string token, bool trim = true)
        {
            if (string.IsNullOrWhiteSpace(token))
            {
                return;
            }

            if (trim)
            {
                token = token.Trim();
            }

            if (_insertSeparator)
            {
                _insertSeparator = false;
                AppendToken(_separators.Peek());
            }

            PrepareSpace(token);

            _code.Append(token);

            _position = token == "(" ? CodePositions.OpenParenEnd : CodePositions.TokenEnd;
        }
Esempio n. 6
0
 public static T SetPosition <T>(this T element, XElement e)
     where T : UnifiedElement
 {
     element.Position = CodePositions.New(e);
     return(element);
 }
        public void EndOfStatement()
        {
            _code.Append(";");

            _position = CodePositions.StatementEnd;
        }
 public void ForceNoWhitespace()
 {
     _position = CodePositions.TokenEndNoWhitespace;
 }