Example #1
0
        private IEnumerable <Parselet> FunctionText(Token <R> token)
        {
            var name  = token.Value;
            var group = RantFunctions.GetFunctionGroup(name);

            if (group == null)
            {
                compiler.SyntaxError(token, $"Unknown function: '{name}'");
            }

            if (reader.TakeLoose(R.Colon))
            {
                foreach (var parselet in FuncArgs(token, group))
                {
                    yield return(parselet);
                }
            }
            else
            {
                var end = reader.Read(R.RightSquare);
                AddToOutput(new RAFunction(Stringe.Range(token, end), compiler.GetFunctionInfo(group, 0, token, end), new List <RantAction>()));
            }
        }
Example #2
0
 /// <summary>
 /// Returns the description for the function with the specified name.
 /// </summary>
 /// <param name="functionName">The name of the function to get the description for.</param>
 /// <param name="argc">The number of arguments in the overload to get the description for.</param>
 /// <returns></returns>
 public static string GetFunctionDescription(string functionName, int argc) => RantFunctions.GetFunctionDescription(functionName, argc);
Example #3
0
 /// <summary>
 /// Enumerates the aliases assigned to the specified function name.
 /// </summary>
 /// <param name="functionName">The function name to retrieve aliases for.</param>
 /// <returns></returns>
 public static IEnumerable <string> GetFunctionAliases(string functionName) => RantFunctions.GetAliases(functionName);
Example #4
0
 /// <summary>
 /// Enumerates the available functions.
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <IRantFunctionGroup> GetFunctions() => RantFunctions.GetFunctions();
Example #5
0
 /// <summary>
 /// Enumerates all function names and their aliases.
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <string> GetFunctionNamesAndAliases() => RantFunctions.GetFunctionNamesAndAliases();
Example #6
0
 /// <summary>
 /// Returns the function with the specified name. The return value will be null if the function is not found.
 /// </summary>
 /// <param name="functionName">The name of the function to retrieve.</param>
 /// <returns></returns>
 public static IRantFunctionGroup GetFunction(string functionName) => RantFunctions.GetFunctionGroup(functionName);
Example #7
0
 /// <summary>
 /// Determines whether a function with the specified name is defined in the current engine version.
 /// </summary>
 /// <param name="functionName">The name of the function to search for. Argument is not case-sensitive.</param>
 /// <returns></returns>
 public static bool FunctionExists(string functionName)
 {
     return(RantFunctions.FunctionExists(functionName));
 }
Example #8
0
 static RantEngine()
 {
     RantFunctions.Load();
     RichardFunctions.Load();
     Engine.Compiler.Parselets.Parselet.Load();
 }