Beispiel #1
0
        /// <summary>
        /// Formats the intendation.
        /// </summary>
        /// <param name="line">The line.</param>
        /// <returns></returns>
        private string FormatIntendation(string line)
        {
            string emptySpace = String.Empty;

            foreach (char c in line)
            {
                bool        stop = false;
                SpacingType type = GetSpacingType(c);
                switch (type)
                {
                case SpacingType.Whitespace:
                    emptySpace += " ";
                    break;

                case SpacingType.Tab:
                    emptySpace += "\t";
                    break;

                case SpacingType.Neither:
                default:
                    stop = true;
                    break;
                }
                if (stop)
                {
                    break;
                }
            }
            return(emptySpace);
        }
Beispiel #2
0
        public void SetSymbolIfNull(SpacingType type, SpacingPattern pattern, string value)
        {
            int i = (int)type;
            int j = (int)pattern;

            if (symbols[i][j] == null)
            {
                symbols[i][j] = value;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gets the type of the spacing.
        /// </summary>
        /// <param name="c">The c.</param>
        /// <returns></returns>
        private SpacingType GetSpacingType(char c)
        {
            SpacingType type = SpacingType.Neither;

            if (c.ToString().Equals("\t"))
            {
                type = SpacingType.Tab;
            }
            else if (char.IsWhiteSpace(c))
            {
                type = SpacingType.Whitespace;
            }
            return(type);
        }