示例#1
0
        public List <ExtensibleFunction> GetExtensibleFunctions()
        {
            string typeDefinitionsRawCode             = string.Join("\n", this.ExtensionTypeDefinitions);
            List <ExtensibleFunction> output          = new List <ExtensibleFunction>();
            List <ExtensibleFunction> typeDefinitions = ExtensibleFunctionMetadataParser.Parse(this.Path, typeDefinitionsRawCode);
            Dictionary <string, ExtensibleFunction> typeDefinitionsLookup = new Dictionary <string, ExtensibleFunction>();

            foreach (ExtensibleFunction exFn in typeDefinitions)
            {
                typeDefinitionsLookup[exFn.Name] = exFn;
            }

            foreach (string exFunctionName in this.ExtensionPlatformValues.Keys.OrderBy(k => k))
            {
                if (!typeDefinitionsLookup.ContainsKey(exFunctionName))
                {
                    Token throwToken = this.ExtensionPlatformValuesDefinitionTokens[exFunctionName];
                    throw new ParserException(throwToken, "No type information defined for extensible function '" + exFunctionName + "'");
                }

                ExtensibleFunction exFn = typeDefinitionsLookup[exFunctionName];
                exFn.Translation = this.ExtensionPlatformValues[exFunctionName];
                output.Add(exFn);
            }
            return(output);
        }
示例#2
0
 public PastelContext AddExtensibleFunction(ExtensibleFunction fn, string translation)
 {
     this.extensibleFunctions.Add(fn);
     this.extensibleFunctionTranslations[fn.Name] = translation;
     return(this);
 }