예제 #1
0
        public IEnumerable <BasicRule> CompileAllRules(
            Dictionary <string, string> allReplacementDirectives,
            out SystemLevelRuleNativeData ruleNativeData,
            int openSymbol, int closeSymbol
            )
        {
            var allValidRuntimeParameters = allGlobalRuntimeParams.Select(x => x.name).ToArray();
            var parsedRules = allFiles.data
                              .SelectMany((file, index) =>
            {
                Func <char, int> remappingFunction = character => file.GetSymbolInFile(character);
                try
                {
                    return(file.GetRulesWithReplacements(allReplacementDirectives)
                           .Select(x => RuleParser.ParseToRule(x, remappingFunction, (short)index, allValidRuntimeParameters))
                           .ToList());
                }
                catch (SyntaxException ex)
                {
                    ex.fileName = file.fileSource;
                    throw ex;
                }
            })
                              .Where(x => x != null)
                              .ToArray();
            var allRules = RuleParser.CompileAndCheckParsedRules(parsedRules, out ruleNativeData, openSymbol, closeSymbol);

            ruleNativeData.immaturityMarkerSymbols = new NativeHashSet <int>(immaturitySymbolMarkers.Length, Allocator.Persistent);
            foreach (var immature in immaturitySymbolMarkers)
            {
                ruleNativeData.immaturityMarkerSymbols.Add(immature);
            }
            return(allRules);
        }