Beispiel #1
0
        public void WriteDocs(FileWriter writer, CreateMethod method, string sectionTitle, Action?writeSection)
        {
            const string typeName = "Instruction";

            docWriter.BeginWrite(writer);
            foreach (var doc in method.Docs)
            {
                docWriter.WriteDocLine(writer, doc, typeName);
            }
            docWriter.WriteLine(writer, string.Empty);
            if (writeSection is not null)
            {
                docWriter.WriteLine(writer, $"# {sectionTitle}");
                docWriter.WriteLine(writer, string.Empty);
                writeSection();
                docWriter.WriteLine(writer, string.Empty);
            }
            docWriter.WriteLine(writer, "# Arguments");
            docWriter.WriteLine(writer, string.Empty);
            for (int i = 0; i < method.Args.Count; i++)
            {
                var arg = method.Args[i];
                docWriter.Write($"* `{idConverter.Argument(arg.Name)}`: ");
                docWriter.WriteDocLine(writer, arg.Doc, typeName);
            }
            docWriter.EndWrite(writer);
        }
Beispiel #2
0
 public GeneratedMethodInfo(CreateMethod method, bool canFail, string rustMethodName, string pythonMethodName, IdentifierConverter rustIdConverter, IdentifierConverter pythonIdConverter)
 {
     Method           = method;
     CanFail          = canFail;
     RustMethodName   = rustMethodName;
     PythonMethodName = pythonMethodName;
     ArgInfos         = new MethodArgInfo[method.Args.Count];
     for (int i = 0; i < method.Args.Count; i++)
     {
         var origName   = method.Args[i].Name;
         var rustName   = rustIdConverter.Argument(origName);
         var pythonName = pythonIdConverter.Argument(origName);
         ArgInfos[i] = new MethodArgInfo(rustName: rustName, pythonName: pythonName);
     }
 }
Beispiel #3
0
 public GeneratedMethodInfo(CreateMethod method, bool canFail, string rustMethodName, string luaMethodName, IdentifierConverter rustIdConverter, IdentifierConverter luaIdConverter)
 {
     Method         = method;
     CanFail        = canFail;
     RustMethodName = rustMethodName;
     LuaMethodName  = luaMethodName;
     ArgInfos       = new MethodArgInfo[method.Args.Count];
     Overloads      = new();
     for (int i = 0; i < method.Args.Count; i++)
     {
         var origName = method.Args[i].Name;
         var rustName = rustIdConverter.Argument(origName);
         var luaName  = luaIdConverter.Argument(origName);
         ArgInfos[i] = new MethodArgInfo(rustName: rustName, luaName: luaName);
     }
 }