Initial Commit
This commit is contained in:
		
						commit
						024342d4da
					
				| 
						 | 
					@ -0,0 +1,26 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    "version": "0.2.0",
 | 
				
			||||||
 | 
					    "configurations": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            // Use IntelliSense to find out which attributes exist for C# debugging
 | 
				
			||||||
 | 
					            // Use hover for the description of the existing attributes
 | 
				
			||||||
 | 
					            // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
 | 
				
			||||||
 | 
					            "name": ".NET Core Launch (console)",
 | 
				
			||||||
 | 
					            "type": "coreclr",
 | 
				
			||||||
 | 
					            "request": "launch",
 | 
				
			||||||
 | 
					            "preLaunchTask": "build",
 | 
				
			||||||
 | 
					            // If you have changed target frameworks, make sure to update the program path.
 | 
				
			||||||
 | 
					            "program": "${workspaceFolder}/bin/Debug/net6.0/langtest.dll",
 | 
				
			||||||
 | 
					            "args": [],
 | 
				
			||||||
 | 
					            "cwd": "${workspaceFolder}",
 | 
				
			||||||
 | 
					            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
 | 
				
			||||||
 | 
					            "console": "internalConsole",
 | 
				
			||||||
 | 
					            "stopAtEntry": false
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "name": ".NET Core Attach",
 | 
				
			||||||
 | 
					            "type": "coreclr",
 | 
				
			||||||
 | 
					            "request": "attach"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,41 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    "version": "2.0.0",
 | 
				
			||||||
 | 
					    "tasks": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "label": "build",
 | 
				
			||||||
 | 
					            "command": "dotnet",
 | 
				
			||||||
 | 
					            "type": "process",
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "build",
 | 
				
			||||||
 | 
					                "${workspaceFolder}/langtest.csproj",
 | 
				
			||||||
 | 
					                "/property:GenerateFullPaths=true",
 | 
				
			||||||
 | 
					                "/consoleloggerparameters:NoSummary"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "problemMatcher": "$msCompile"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "label": "publish",
 | 
				
			||||||
 | 
					            "command": "dotnet",
 | 
				
			||||||
 | 
					            "type": "process",
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "publish",
 | 
				
			||||||
 | 
					                "${workspaceFolder}/langtest.csproj",
 | 
				
			||||||
 | 
					                "/property:GenerateFullPaths=true",
 | 
				
			||||||
 | 
					                "/consoleloggerparameters:NoSummary"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "problemMatcher": "$msCompile"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "label": "watch",
 | 
				
			||||||
 | 
					            "command": "dotnet",
 | 
				
			||||||
 | 
					            "type": "process",
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "watch",
 | 
				
			||||||
 | 
					                "run",
 | 
				
			||||||
 | 
					                "--project",
 | 
				
			||||||
 | 
					                "${workspaceFolder}/langtest.csproj"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "problemMatcher": "$msCompile"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,267 @@
 | 
				
			||||||
 | 
					using System.Globalization;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace langtest
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public enum LexTokenType 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        PLUS=0,
 | 
				
			||||||
 | 
					        MINUS=1,
 | 
				
			||||||
 | 
					        MULTIPLY=2,
 | 
				
			||||||
 | 
					        DIVIDE=3,
 | 
				
			||||||
 | 
					        MOD=4,
 | 
				
			||||||
 | 
					        LPAREN=5,
 | 
				
			||||||
 | 
					        RPAREN=6,
 | 
				
			||||||
 | 
					        IDENTIFER=7,
 | 
				
			||||||
 | 
					        NUMBER=8,
 | 
				
			||||||
 | 
					        EQUALS=9,
 | 
				
			||||||
 | 
					        COMMA=10,
 | 
				
			||||||
 | 
					        ERROR=11,
 | 
				
			||||||
 | 
					        SEMI=12,
 | 
				
			||||||
 | 
					        LBRACE=13,
 | 
				
			||||||
 | 
					        RBRACE=14,
 | 
				
			||||||
 | 
					        STRING=15,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class LexToken
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public LexToken()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public LexToken(string text)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Text = text;
 | 
				
			||||||
 | 
					            Type=char.IsLetter(text.FirstOrDefault()) ? LexTokenType.IDENTIFER : (char.IsNumber(text.FirstOrDefault()) ? LexTokenType.NUMBER : LexTokenType.ERROR);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
 | 
					        public LexTokenType Type {get;set;}
 | 
				
			||||||
 | 
					        public string Text {get;set;}="";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    public static class Lexer
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public static string? Prompt(string t)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Console.Write(t);
 | 
				
			||||||
 | 
					            return Console.ReadLine();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public static IEnumerable<LexToken> EnumerateTokens(string text)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					             int filePos=0;
 | 
				
			||||||
 | 
					              Func<(char chr,bool esc)> read_char = ()=>{
 | 
				
			||||||
 | 
					            int txt=text[filePos++];
 | 
				
			||||||
 | 
					         
 | 
				
			||||||
 | 
					            if(txt == '\\')
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                 
 | 
				
			||||||
 | 
					                //we are to escape
 | 
				
			||||||
 | 
					                txt = text[filePos++];
 | 
				
			||||||
 | 
					                if(txt == 'x')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                     
 | 
				
			||||||
 | 
					                    char[] chars=new char[4];
 | 
				
			||||||
 | 
					                   
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                    for(int  i = 0 ;i<4;i++)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        txt = text[filePos++];
 | 
				
			||||||
 | 
					                        
 | 
				
			||||||
 | 
					                        chars[i] = (char)txt;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    return ((char)Int16.Parse(new string(chars), NumberStyles.AllowHexSpecifier),true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                    if(txt == 'n')
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return ('\n',true);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if(txt == 'r')
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return ('\r',true);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if(txt == 't')
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return ('\t',true);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    return ((char)txt,true);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else{
 | 
				
			||||||
 | 
					                return ((char)txt,false);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Func<string> read_string = ()=>{
 | 
				
			||||||
 | 
					            StringBuilder b=new StringBuilder();
 | 
				
			||||||
 | 
					            while(true)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                (char chr,bool esc) txt=read_char();
 | 
				
			||||||
 | 
					                if(txt.chr == '\"' && !txt.esc)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                b.Append(txt.chr);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return b.ToString();
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					           
 | 
				
			||||||
 | 
					            StringBuilder b=new StringBuilder();
 | 
				
			||||||
 | 
					            while(filePos < text.Length)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                char c=text[filePos++];
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                if(c == '\"')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    string str = read_string();
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text = str,Type = LexTokenType.STRING};
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                if(c == '\'')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    char str = read_char().chr;
 | 
				
			||||||
 | 
					                    filePos++;
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text = ((int)str).ToString(),Type = LexTokenType.NUMBER};
 | 
				
			||||||
 | 
					                }else
 | 
				
			||||||
 | 
					                if(c == '+')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="+",Type = LexTokenType.PLUS};
 | 
				
			||||||
 | 
					                }else
 | 
				
			||||||
 | 
					                if(c == '-')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="-",Type = LexTokenType.MINUS};
 | 
				
			||||||
 | 
					                }else
 | 
				
			||||||
 | 
					                if(c == '*')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="*",Type = LexTokenType.MULTIPLY};
 | 
				
			||||||
 | 
					                }else
 | 
				
			||||||
 | 
					                if(c == '/')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="/",Type = LexTokenType.DIVIDE};
 | 
				
			||||||
 | 
					                }else
 | 
				
			||||||
 | 
					                if(c == '%')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="%",Type = LexTokenType.MOD};
 | 
				
			||||||
 | 
					                }else if(c == '{')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="{",Type = LexTokenType.LBRACE};
 | 
				
			||||||
 | 
					                }else if(c == '}')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="}",Type = LexTokenType.RBRACE};
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                if(c == '(')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="(",Type = LexTokenType.LPAREN};
 | 
				
			||||||
 | 
					                }else
 | 
				
			||||||
 | 
					                if(c == ')')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text=")",Type = LexTokenType.RPAREN};
 | 
				
			||||||
 | 
					                }else if(c == '=')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text="=",Type = LexTokenType.EQUALS};
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if(c == ',')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text=",",Type = LexTokenType.COMMA};
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if(c == ';')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    yield return new LexToken(){Text=";",Type = LexTokenType.SEMI};
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if(c == '\n' || c == ' ' || c == '\t')
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    b.Append(c);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(b.Length > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yield return new LexToken(b.ToString());
 | 
				
			||||||
 | 
					                        b.Clear();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,38 @@
 | 
				
			||||||
 | 
					using langtest;
 | 
				
			||||||
 | 
					using Newtonsoft.Json;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					var re=new ApplicationState();
 | 
				
			||||||
 | 
					if(args.Length == 0)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					string? text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while((text=Lexer.Prompt("> ")) != null)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    var lexed=Lexer.EnumerateTokens(text);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    var res=Ast.Parse(lexed.ToList());
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    res.Execute(re);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					}else{
 | 
				
			||||||
 | 
					    string text=File.ReadAllText(args[0]);
 | 
				
			||||||
 | 
					    var lexed=Lexer.EnumerateTokens(text);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    var res=Ast.Parse(lexed.ToList());
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    res.Execute(re);
 | 
				
			||||||
 | 
					}*/
 | 
				
			||||||
 | 
					var app = new ApplicationState();
 | 
				
			||||||
 | 
					var ast = new ListNode();
 | 
				
			||||||
 | 
					foreach(var file in Directory.GetFiles("code/dep","*",SearchOption.AllDirectories))
 | 
				
			||||||
 | 
					{   
 | 
				
			||||||
 | 
					    string text=File.ReadAllText(file);
 | 
				
			||||||
 | 
					    var lexed=Lexer.EnumerateTokens(text);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Ast.Parse(ast,lexed.ToList());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					string text2=File.ReadAllText("code/app.bs");
 | 
				
			||||||
 | 
					var lexed2=Lexer.EnumerateTokens(text2);
 | 
				
			||||||
 | 
					Ast.Parse(ast,lexed2.ToList());
 | 
				
			||||||
 | 
					ast.Execute(app);
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,18 @@
 | 
				
			||||||
 | 
					create_function(box_addrange,mybox,boxToAppend,{
 | 
				
			||||||
 | 
					    cur.i = 0;
 | 
				
			||||||
 | 
					    cur.len =box_len(boxToAppend);
 | 
				
			||||||
 | 
					    for(cur.i,cur.len,cur.i+1,{
 | 
				
			||||||
 | 
					        box_add(mybox,box_getvalue(boxToAppend,i));
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					box_print("Type youtube url: ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					connection=tcp_client("192.168.0.142",3252);
 | 
				
			||||||
 | 
					res = box_create();
 | 
				
			||||||
 | 
					box_addrange(res,"GET /api/AddItem/");
 | 
				
			||||||
 | 
					box_addrange(res,box_readline());
 | 
				
			||||||
 | 
					box_addrange(res,"HTTP/1.1\r\nHost: 192.168.0.142:3252\r\n\r\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stream_write(connection,res,0,box_len(res));
 | 
				
			||||||
 | 
					stream_close(connection);
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					res=string_split_chr("Demi,Lovato,Tom,Joel",',');
 | 
				
			||||||
 | 
					j=0;
 | 
				
			||||||
 | 
					for(j,box_len(res),j+1,{
 | 
				
			||||||
 | 
					    box_println(box_getvalue(res,j));
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,22 @@
 | 
				
			||||||
 | 
					create_function(string_split_chr,boxId,string_split_chr_chr,{
 | 
				
			||||||
 | 
					    box=box_create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    box2 = box_create();
 | 
				
			||||||
 | 
					    split_str_chr_i = 0;
 | 
				
			||||||
 | 
					    for(split_str_chr_i,box_len(boxId),split_str_chr_i+1,{
 | 
				
			||||||
 | 
					        if(eq(box_getvalue(boxId,split_str_chr_i),string_split_chr_chr),{
 | 
				
			||||||
 | 
					            if(box_len(box2),{
 | 
				
			||||||
 | 
					                box_add(box,box2);
 | 
				
			||||||
 | 
					                box2 = box_create();
 | 
				
			||||||
 | 
					            },0);
 | 
				
			||||||
 | 
					        },{
 | 
				
			||||||
 | 
					            box_add(box2,box_getvalue(boxId,split_str_chr_i));
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    if(box_len(box2),{
 | 
				
			||||||
 | 
					                box_add(box,box2);
 | 
				
			||||||
 | 
					                box2 = box_create();
 | 
				
			||||||
 | 
					            },0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    box;
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					<Project Sdk="Microsoft.NET.Sdk">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <PropertyGroup>
 | 
				
			||||||
 | 
					    <OutputType>Exe</OutputType>
 | 
				
			||||||
 | 
					    <TargetFramework>net6.0</TargetFramework>
 | 
				
			||||||
 | 
					    <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Project>
 | 
				
			||||||
		Loading…
	
		Reference in New Issue