Beispiel #1
0
#pragma warning disable RCS1175 // Unused this parameter.

        public static void AddBoolLibrary(this DogeWorkspace workspace, DogeSymbolTable symbolTable)
#pragma warning restore RCS1175 // Unused this parameter.
        {
            symbolTable.SetSymbol(Bool, new DogeSymbol(
                                      Bool,
                                      List(Name, Bool),
                                      DogeSymbolAttribute.Static,
                                      DogeSymbolType.Type,
                                      DogeAccessibilityModifier.Public,
                                      null,
                                      null));

            var internalSymbolTable = symbolTable.GetOrAddSymbolTable(Bool, DogeSymbolTableType.Namespace);
        }
Beispiel #2
0
        public static void AddStandardLibrary(this DogeWorkspace workspace, DogeSymbolTable symbolTable)
        {
            symbolTable.SetSymbol(Name, new DogeSymbol(
                                      Name,
                                      List(Name),
                                      DogeSymbolAttribute.None,
                                      DogeSymbolType.Namespace,
                                      DogeAccessibilityModifier.Public,
                                      null,
                                      null));

            var internalSymbolTable = symbolTable.GetOrAddSymbolTable(Name, DogeSymbolTableType.Namespace);

            workspace.AddStringLibrary(internalSymbolTable);
            workspace.AddIntLibrary(internalSymbolTable);
            workspace.AddBoolLibrary(internalSymbolTable);
            workspace.AddConsoleLibrary(internalSymbolTable);
        }
Beispiel #3
0
#pragma warning disable RCS1175 // Unused this parameter.

        public static void AddConsoleLibrary(this DogeWorkspace workspace, DogeSymbolTable symbolTable)
#pragma warning restore RCS1175 // Unused this parameter.
        {
            symbolTable.SetSymbol(Console, new DogeSymbol(
                                      Console,
                                      List(Name, Console),
                                      DogeSymbolAttribute.Static,
                                      DogeSymbolType.Type,
                                      DogeAccessibilityModifier.Public,
                                      null,
                                      null));

            var internalSymbolTable = symbolTable.GetOrAddSymbolTable(Console, DogeSymbolTableType.Type);

            internalSymbolTable.SetSymbol(ConsolePrint, new DogeSymbol(
                                              ConsolePrint,
                                              List(Name, Console, ConsolePrint),
                                              DogeSymbolAttribute.None,
                                              DogeSymbolType.Method,
                                              DogeAccessibilityModifier.Public,
                                              null,
                                              new DogeExternalCall(Parameters(("text", Name + "." + String)), new DogeExternalCall.CallInterpreter(locals =>
            {
                System.Console.Write(locals["text"]);
                return(null);
            }))));

            internalSymbolTable.SetSymbol(ConsolePrintLine, new DogeSymbol(
                                              ConsolePrintLine,
                                              List(Name, Console, ConsolePrintLine),
                                              DogeSymbolAttribute.None,
                                              DogeSymbolType.Method,
                                              DogeAccessibilityModifier.Public,
                                              null,
                                              new DogeExternalCall(Parameters(("text", Name + "." + String)), new DogeExternalCall.CallInterpreter(locals =>
            {
                System.Console.WriteLine(locals["text"]);
                return(null);
            }))));
        }