private static void Main(string[] commandLine) { #if DEBUG commandLine = new[] { "--abbrev", "--map", "--sane", "--show-warnings" }; Snippet snippet = SourceCode.TestCode; #else var snippet = SourceCode.FromStdin(); #endif Options options = ConfigureOptions(); List <Call> actions = options.Parse(commandLine).ToList(); if (NoActionsSpecified(actions)) { Help.Print(options); return; } InvokeAll(actions, snippet); }
public void Sane(Snippet snippet) { _check = new SanityCheck(); _check.CheckTree(_replacedCode, snippet); }
public void Map(Snippet snippet) { "Map".Announce(); _map.Each((key, value) => Console.WriteLine("{0}: {1}", key, value)); }
public void Abbrev(Snippet snippet) { ReplaceIdentifiers(snippet, new ThreeCharacters(_random).Replace); }
public void Single(Snippet snippet) { ReplaceIdentifiers(snippet, new SingleCharacter(_random).Replace); }
public void Normal(Snippet snippet) { ReplaceIdentifiers(snippet, new Normal().Replace); }
public static void MethodName(Snippet snippet) { Console.WriteLine("Method Name: {0}", snippet.MethodName); }
public static void ListTokens(Snippet snippet) { ListTokens(snippet.Tokens); }
public static void CountLines(Snippet snippet) { Console.WriteLine("LOC: {0}", snippet.LinesOfCodeCount); }
public static void CountIdenfifiers(Snippet snippet) { Console.WriteLine("Identifiers: {0}", snippet.Identifiers.Count()); }
public static void CountTokens(Snippet snippet) { Console.WriteLine("Tokens: {0}", snippet.Tokens.Count()); }
public static void ListIdentifiers(Snippet snippet) { ListTokens(snippet.Identifiers); }
public static Snippet FromStdin() { string code = ReadCodeFromStdIn(); return(Snippet.Parse(code)); }