Beispiel #1
0
        public static Thing BuildBreed(string script, out List <Error> errors)
        {
            Instance.ClearState();
            Instance.buildBreedOnly = true;
            var parser    = ScriptReader.GetParserForScript(script, out _);
            var breedTree = parser.baseDefinition();

            Instance.Visit(breedTree);
            errors = Instance.errors;
            return(Instance.currentBreed);
        }
Beispiel #2
0
        public static List <Error> CheckBreedScriptErrors(string script, Scope scope = null)
        {
            Instance.scope  = scope ?? new Scope();
            Instance.errors = new List <Error>();
            var parser    = ScriptReader.GetParserForScript(script, out var syntaxErrors);
            var breedTree = parser.breedScript();

            if (syntaxErrors.Count > 0)
            {
                return(syntaxErrors);
            }

            Instance.Visit(breedTree);

            return(Instance.errors);
        }