private Tuple <String, String> CleanRefs(RecycleParser.GameContext g1, RecycleParser.GameContext g2, IParseTree t1, IParseTree t2) { //TODO // check for vars and locs // if vars or locs don't exist in rest of context, then switch to something of same type that does exist // if that fails, create a definition based on usage in other game return(new Tuple <String, String>(t1.ToString(), t2.ToString())); }
public Tuple <bool, bool> Loader() { Debug.AutoFlush = true; if (exp.logging) { File.WriteAllText(exp.fileName + ".txt", string.Empty); } /************ * Load up the game from the .gdl RECYCLE description ************/ fileName = exp.fileName; Console.WriteLine("name: " + fileName); var file = File.ReadAllText(fileName); var regex = new Regex("(;;)(.*?)(\n)"); file = regex.Replace(file, "\n"); /*********** * Parse the game with the Antlr grammar description ***********/ AntlrInputStream stream = new AntlrInputStream(file); ITokenSource lexer = new RecycleLexer(stream); ITokenStream tokens = new CommonTokenStream(lexer); var parser = new RecycleParser(tokens); parser.BuildParseTree = true; this.tree = parser.game(); /*********** * Make the parse tree visualization ***********/ if (!exp.evaluating) { DotVisualization.DOTMakerTop(tree, exp.fileName); } return(HasShuffleAndChoice(tree)); }
/// <summary> /// Exit a parse tree produced by <see cref="RecycleParser.game"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitGame([NotNull] RecycleParser.GameContext context) { }