From aeb0d4f887a0c18c36b59acc7b5df08e62020c50 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 11 Oct 2020 21:32:48 +0300 Subject: Removed old homeworks --- .../81709/JSCompiler.SyntaxHighlighter/App.config | 6 - .../JSCompiler.SyntaxHighlighter.csproj | 62 ------- .../81709/JSCompiler.SyntaxHighlighter/Program.cs | 36 ---- .../Properties/AssemblyInfo.cs | 36 ---- .../SyntaxHighlighter.cs | 187 --------------------- .../JSCompiler.SyntaxHighlighter/test/test.js | 23 --- .../JSCompiler.SyntaxHighlighter/test/testout.html | 49 ------ 7 files changed, 399 deletions(-) delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/App.config delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/JSCompiler.SyntaxHighlighter.csproj delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/Program.cs delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/Properties/AssemblyInfo.cs delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/SyntaxHighlighter.cs delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/test/test.js delete mode 100644 homework/81709/JSCompiler.SyntaxHighlighter/test/testout.html (limited to 'homework/81709/JSCompiler.SyntaxHighlighter') diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/App.config b/homework/81709/JSCompiler.SyntaxHighlighter/App.config deleted file mode 100644 index 62c8f44..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/JSCompiler.SyntaxHighlighter.csproj b/homework/81709/JSCompiler.SyntaxHighlighter/JSCompiler.SyntaxHighlighter.csproj deleted file mode 100644 index cb321ea..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/JSCompiler.SyntaxHighlighter.csproj +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Debug - AnyCPU - {D555ADB4-0161-4DF9-8098-1A72C03C1576} - Exe - JSCompiler.SyntaxHighlighter - JSCompiler.SyntaxHighlighter - v4.7.1 - 512 - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - Designer - - - - - {c8dd3d07-6ae9-444b-8ba0-22dc633a9432} - JSCompiler.Core - - - - \ No newline at end of file diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/Program.cs b/homework/81709/JSCompiler.SyntaxHighlighter/Program.cs deleted file mode 100644 index fd0d539..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/Program.cs +++ /dev/null @@ -1,36 +0,0 @@ -using JSCompiler.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JSCompiler.SyntaxHighlighter -{ - class Program - { - static int Main(string[] args) - { - if(args.Length < 2) - { - Console.WriteLine("Input and output destinations not specified!"); - return 1; - } - - try - { - BaseInputStream stream = new BaseInputStream(args[0]); - Lexer lex = new Lexer(stream); - List tokens = lex.Tokenize((line, cause) => Console.Out.WriteLine($"On line {line} error: {cause}")); - SyntaxHighlighter.GenerateHtml(tokens, args[1]); - } - catch(Exception e) - { - Console.WriteLine(e.Message); - return 1; - } - - return 0; - } - } -} diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/Properties/AssemblyInfo.cs b/homework/81709/JSCompiler.SyntaxHighlighter/Properties/AssemblyInfo.cs deleted file mode 100644 index 6d5d657..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("JSCompiler.SyntaxHighlighter")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("JSCompiler.SyntaxHighlighter")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d555adb4-0161-4df9-8098-1a72c03c1576")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/SyntaxHighlighter.cs b/homework/81709/JSCompiler.SyntaxHighlighter/SyntaxHighlighter.cs deleted file mode 100644 index fd8572f..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/SyntaxHighlighter.cs +++ /dev/null @@ -1,187 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.IO; -using JSCompiler.Core; - -namespace JSCompiler.SyntaxHighlighter -{ - public static class SyntaxHighlighter - { - private static readonly string HTML = - @" - - -{0} - {1} - - {2} "; - - private static readonly string DEFAULT_CSS = - @""; - - private static IEnumerable KEYWORDS = ReservedStrings.KeywordsAsMap().Values; - - private static IEnumerable OTHER_RESERVED = ReservedStrings.OthersAsMap().Values; - - private static IEnumerable ONE_SYMBOL_OPERATORS = new List - { - TokenType.Minus, // - - TokenType.Plus, // + - TokenType.Star, // * - TokenType.Division, // / - TokenType.Modulo, // % - TokenType.BitwiseNot, // ~ - TokenType.BitwiseAnd, // & - TokenType.BitwiseXor, // ^ - TokenType.BitwiseOr, // | - TokenType.QuestionMark, // ? - TokenType.Bang, // ! - TokenType.Equal, // = - TokenType.Greater, // > - TokenType.Less, // < - TokenType.Backslash, // \ - }; - - private static IEnumerable MULT_SYMBOL_OPERATORS = new List - { - TokenType.NotEqual, // != - TokenType.EqualEqual, // == - TokenType.StrictEqual, // === - TokenType.StrictNotEqual, // !== - TokenType.GreaterEqual, // >= - TokenType.LessEqual, // <= - TokenType.MinusMinus, // -- - TokenType.PlusPlus, // ++ - TokenType.LeftShift, // << - TokenType.RightShift, // >> - TokenType.LogicalAnd, // && - TokenType.LogicalOr, // || - TokenType.StarEqual, // *= - TokenType.DivideEqual, // /= - TokenType.ModuloEqual, // %= - TokenType.PlusEqual, // += - TokenType.MinusEqual, // -= - TokenType.LeftShiftEqual, // <<= - TokenType.RightShiftEqual, // >>= - TokenType.BitwiseAndEqual, // &= - TokenType.BitwiseXorEqual, // ^= - TokenType.BitwiseOrEqual, // |= - }; - - public static void GenerateHtml(IEnumerable tokens, string fileName, string css = null) - { - if (css == null) css = DEFAULT_CSS; - - string code = ""; - IEnumerator tokenEnum = tokens.GetEnumerator(); - if (!tokenEnum.MoveNext()) return; - Token cur; - do - { - cur = tokenEnum.Current; - TokenType type = cur.Type; - - switch (type) - { - case TokenType.Whitespace: - code += " "; - break; - case TokenType.Tab: - code += " " + " " + " " + " "; - break; - case TokenType.NewLine: - code += "
"; - break; - case TokenType.Number: - code += "" + ((NumToken)cur).Num + ""; - break; - case TokenType.String: - code += "" + ((WordToken)cur).Lexeme + ""; - break; - case TokenType.Identifier: - code += "" + ((WordToken)cur).Lexeme + ""; - break; - case TokenType.Comment: - code += "" + ((WordToken)cur).Lexeme + ""; - break; - case TokenType.Error: - code += "" + ((WordToken)cur).Lexeme + ""; - break; - - default: - if (KEYWORDS.Contains(type)) - { - code += "" + ((WordToken)cur).Lexeme + ""; - } - else if(OTHER_RESERVED.Contains(type)) - { - code += "" + ((WordToken)cur).Lexeme + ""; - } - else if (ONE_SYMBOL_OPERATORS.Contains(type)) - { - code += "" + cur.ToString() + ""; - } - else if (MULT_SYMBOL_OPERATORS.Contains(type)) - { - code += "" + ((WordToken)cur).Lexeme + ""; - } - else - { - code += "" + cur.ToString() + ""; - break; - } - break; - } - } - while (tokenEnum.MoveNext() && tokenEnum.Current.Type != TokenType.EOF); - - string shouldWrite = string.Format(HTML, css, fileName, code); - - using (StreamWriter writer = new StreamWriter(fileName)) - { - writer.Write(shouldWrite); - } - } - } -} diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/test/test.js b/homework/81709/JSCompiler.SyntaxHighlighter/test/test.js deleted file mode 100644 index 537e59f..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/test/test.js +++ /dev/null @@ -1,23 +0,0 @@ -/* -** This is a test function to demonstrate syntax highlighting! -*/ -function myFunction() { - var res = ""; - res = res +isNaN(123) + ": 123"; - res = res + isNaN(-1.23) + ": -1.23"; - res = res + isNaN(5-2) + ": 5-2"; - res = res + isNaN(0) + ": 0"; - res = res + isNaN('123') + ": 123 - "; - //oops! - res = res + isNaN(true) + ": true"; - res = res + isNaN(undefined) + ": undefined \ - nextString \ - "; - res = res + isNaN('NaN') + ": NaN 'Hell no'"; - res = res + isNaN(NaN) + ': NaN \\n \'; - res = res + isNaN(0 / 0) + ": 0 / 0 \ "; - - document.getElementById("demo").innerHTML = res; -} -//Cool, it works! \ No newline at end of file diff --git a/homework/81709/JSCompiler.SyntaxHighlighter/test/testout.html b/homework/81709/JSCompiler.SyntaxHighlighter/test/testout.html deleted file mode 100644 index d1182c2..0000000 --- a/homework/81709/JSCompiler.SyntaxHighlighter/test/testout.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - ..\..\test\testout.html - - /* -** This is a test function to demonstrate syntax highlighting! -*/
function myFunction() {
    var res = "";
    res = res +isNaN(123) + ": 123";
    res = res + isNaN(-1.23) + ": -1.23";
    res = res + isNaN(5-2) + ": 5-2";
    res = res + isNaN(0) + ": 0";
    res = res + isNaN('123') + ": 123
    ";
    //oops!
    res = res + isNaN(true) + ": true";
    res = res + isNaN(undefined) + ": undefined \ - nextString \ - ";
    res = res + isNaN('NaN') + ": NaN 'Hell no'";
    res = res + isNaN(NaN) + ': NaN \\n \';
    res = res + isNaN(0 / 0) + ": 0 / 0 \ ";

    document.getElementById("demo").innerHTML = res;
}
//Cool, it works! \ No newline at end of file -- cgit v1.3.1-26-gb76a