Example #1
0
 public void IdentifySimbols(string key)
 {
     if (tokensSymbols.ContainsKey(key))
     {
         Saver.WriteLine(key, tokensSymbols[key]);
     }
 }
Example #2
0
 public bool TryGetValueForStatement(string key)
 {
     if (tokensStatements.ContainsKey(key))
     {
         Saver.WriteLine(key, tokensStatements[key]);
         return(true);
     }
     return(false);
 }
Example #3
0
 public void IdentifyNames(string value)
 {
     if (Regex.Match(value, Constants.NamePattern).Length == value.Length)
     {
         Saver.WriteLine(value, Constants.Name);
     }
     else
     {
         Saver.WriteLine(value, Constants.Exception);
     }
 }
Example #4
0
        public int IdentifyNumbers(string line, int indexStart)
        {
            var number = new StringBuilder();

            while (indexStart < line.Length && Constants.NumbersFrom0To9.Contains(line[indexStart]))
            {
                number.Append(line[indexStart++]);
            }
            Saver.WriteLine(number.ToString(), Constants.Number);
            return(indexStart - 1);
        }
Example #5
0
        public int IdentifyQchar(string line, int index)
        {
            var construct = new StringBuilder();

            do
            {
                construct.Append(line[index++]);
            } while (index < line.Length && line[index] != Constants.Apostrophe);
            construct.Append(line[index++]);

            if (construct.ToString().StartsWith(Constants.Apostrophe) &&
                construct.ToString().EndsWith(Constants.Apostrophe) &&
                construct.ToString().Length == 3)
            {
                Saver.WriteLine(construct.ToString(), Constants.Qchar);
            }
            else
            {
                Saver.WriteLine(construct.ToString(), Constants.Exception);
            }

            return(index - 1);
        }
Example #6
0
 public void IdentifyEqual(string equal)
 {
     Saver.WriteLine(equal, tokensSymbols[equal]);
 }