Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 45278 / js2html
diff options
context:
space:
mode:
Commitaeb0d4f887a0c18c36b59acc7b5df08e62020c50 (patch)
Author
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-10-11 21:32:48 +0300
Committer
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-10-11 21:33:38 +0300
Filesb6abdc6e1810326b587f2a160f39570f1f568f27 /homework/45278/js2html
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.tar
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.tar.gz
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.zip
Parent154b7cd30f21af1554ca26986ff1643e28857727 (diff)
Removed old homeworks
diff --git a/homework/45278/js2html/.gitignore b/homework/45278/js2html/.gitignore
deleted file mode 100644
index f00a0eb..0000000
--- a/homework/45278/js2html/.gitignore
+++ /dev/null
@@ -1,334 +0,0 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-##
-## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
-# User-specific files
-*.rsuser
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-bld/
-[Bb]in/
-[Oo]bj/
-[Ll]og/
-
-# Visual Studio 2015/2017 cache/options directory
-.vs/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
-
-# Visual Studio 2017 auto generated files
-Generated\ Files/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# Benchmark Results
-BenchmarkDotNet.Artifacts/
-
-# .NET Core
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-# StyleCop
-StyleCopReport.xml
-
-# Files built by Visual Studio
-*_i.c
-*_p.c
-*_h.h
-*.ilk
-*.meta
-*.obj
-*.iobj
-*.pch
-*.pdb
-*.ipdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*_wpftmp.csproj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# Visual Studio Trace Files
-*.e2e
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# AxoCover is a Code Coverage Tool
-.axoCover/*
-!.axoCover/settings.json
-
-# Visual Studio code coverage results
-*.coverage
-*.coveragexml
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# Note: Comment the next line if you want to checkin your web deploy settings,
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-PublishScripts/
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/[Pp]ackages/*
-# except build/, which is used as an MSBuild target.
-!**/[Pp]ackages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/[Pp]ackages/repositories.config
-# NuGet v3's project.json files produces more ignorable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-*.appx
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-orleans.codegen.cs
-
-# Including strong name files can present a security risk
-# (https://github.com/github/gitignore/pull/2483#issue-259490424)
-#*.snk
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-ServiceFabricBackup/
-*.rptproj.bak
-
-# SQL Server files
-*.mdf
-*.ldf
-*.ndf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-*.rptproj.rsuser
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-node_modules/
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
-*.vbw
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# JetBrains Rider
-.idea/
-*.sln.iml
-
-# CodeRush personal settings
-.cr/personal
-
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
-*.pyc
-
-# Cake - Uncomment if you are using it
-# tools/**
-# !tools/packages.config
-
-# Tabs Studio
-*.tss
-
-# Telerik's JustMock configuration file
-*.jmconfig
-
-# BizTalk build output
-*.btp.cs
-*.btm.cs
-*.odx.cs
-*.xsd.cs
-
-# OpenCover UI analysis results
-OpenCover/
-
-# Azure Stream Analytics local run output
-ASALocalRun/
-
-# MSBuild Binary and Structured Log
-*.binlog
-
-# NVidia Nsight GPU debugger configuration file
-*.nvuser
-
-# MFractors (Xamarin productivity tool) working folder
-.mfractor/
-
-# Local History for Visual Studio
-.localhistory/ \ No newline at end of file
diff --git a/homework/45278/js2html/js2html/Extensions/TokenizerExtensions.cs b/homework/45278/js2html/js2html/Extensions/TokenizerExtensions.cs
deleted file mode 100644
index 1a9da1b..0000000
--- a/homework/45278/js2html/js2html/Extensions/TokenizerExtensions.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace js2html.Extensions
-{
- public static class TokenizerExtensions
- {
- public static IEnumerable<string> ParseHtml(this Tokenizer tokenizer)
- {
- var whitespace = string.Empty;
- foreach(var token in tokenizer.Tokens)
- {
- if (token.TokenType == Models.TokenType.Number)
- {
- var result = string.Format("<span class=\"number\">{0}{1}</span>", whitespace, token.Lexeme);
- whitespace = string.Empty;
- yield return result;
- }
- else if(token.TokenType == Models.TokenType.String)
- {
- var result = string.Format("<span class=\"string\" style=\"color:indianred\">{0}{1}</span>", whitespace, token.Lexeme);
- whitespace = string.Empty;
- yield return result;
- }
- else if (tokenizer.KeywordsTable.ContainsKey(token.Lexeme))
- {
- var result = string.Format("<span class=\"keyword\" style=\"color:blue\">{0}{1}</span>", whitespace, token.Lexeme);
- whitespace = string.Empty;
- yield return result;
- }
- else if (token.TokenType == Models.TokenType.Identifier)
- {
- var result = string.Format("<span class=\"identifier\">{0}{1}</span>", whitespace, token.Lexeme);
- whitespace = string.Empty;
- yield return result;
- }
- else if (token.TokenType == Models.TokenType.Whitespace)
- {
- if(whitespace != string.Empty)
- {
- var tempWhitespace = token.Lexeme.Replace(" ", "&nbsp;").Replace("\r\n", "<br>").Replace("\n","<br>").Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
- whitespace = whitespace + tempWhitespace;
- }
- else
- whitespace = token.Lexeme.Replace(" ", "&nbsp;").Replace("\r\n", "<br>").Replace("\n", "<br>").Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
- }
- else if (token.TokenType == Models.TokenType.Eof)
- yield return whitespace;
- else
- {
- //string result = "";
- //if (whitespace.Contains("<br>"))
- //{
- // result = string.Format("{0}<span class=\"operator\">{1}</span>", whitespace, token.Lexeme);
- //}
- //else
- var result = string.Format("<span class=\"operator\">{0}{1}</span>", whitespace, token.Lexeme);
- whitespace = string.Empty;
- yield return result;
- }
- }
- }
-
- //static private string BuildWhitespace(string lexeme)
- //{
- // StringBuilder result = new StringBuilder();
- // foreach(var c in lexeme)
- // {
- // if (c != '\n')
- // result.Append("&nbsp;");
- // else
- // result.Append("<br>");
- // }
-
- // return result.ToString();
- //}
- }
-}
diff --git a/homework/45278/js2html/js2html/Models/Token.cs b/homework/45278/js2html/js2html/Models/Token.cs
deleted file mode 100644
index a0204f3..0000000
--- a/homework/45278/js2html/js2html/Models/Token.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace js2html.Models
-{
- public class Token
- {
- public TokenType TokenType { get; set; }
- public int Line { get; set; }
- public string Lexeme { get; set; }
- public double NumericValue { get; set; }
-
- public Token(TokenType tokenType, int line, string lexeme = "", double numericValue = 0 )
- {
- TokenType = tokenType;
- Line = line;
- Lexeme = lexeme;
- NumericValue = numericValue;
- }
- }
-}
diff --git a/homework/45278/js2html/js2html/Models/TokenType.cs b/homework/45278/js2html/js2html/Models/TokenType.cs
deleted file mode 100644
index 13061e9..0000000
--- a/homework/45278/js2html/js2html/Models/TokenType.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace js2html.Models
-{
- public enum TokenType
- {
- // Single-character tokens.
- LeftParen,
- RightParen,
- LeftBrace,
- RightBrace,
- Comma,
- Dot,
- Minus,
- Plus,
- Semicolon,
- Star,
- Division,
- Modulo,
- BitwiseNot,
- BitwiseAnd,
- BitwiseXor,
- BitwiseOr,
- QuestionMark,
- Colon,
- LeftSquareBracket,
- RightSquareBracket,
-
- // One or two character tokens
- Bang,
- BangEqual,
- Equal,
- EqualEqual,
- StrictEqual,
- StrictNotEqual,
- Greater,
- GreaterEqual,
- Less,
- LessEqual,
- MinusMinus,
- PlusPlus,
- LeftShift,
- RightShift,
- LogicalAnd,
- LogicalOr,
- StarEqual,
- DivideEqual,
- ModuloEqual,
- PlusEqual,
- MinusEqual,
- LeftShiftEqual,
- RightShiftEqual,
- BitwiseAndEqual,
- BitwiseXorEqual,
- BitwiseOrEqual,
-
- Identifier,
- String,
- Number,
-
- // Keywords. ECMAScript 2015
- Break,
- Case,
- Catch,
- Class,
- Const,
- Continue,
- Debugger,
- Default,
- Delete,
- Do,
- Else,
- Export,
- Extends,
- Finally,
- For,
- Function,
- If,
- Import,
- In,
- Instanceof,
- New,
- Return,
- Super,
- Switch,
- This,
- Throw,
- Try,
- Typeof,
- Var,
- Void,
- While,
- With,
- Yield,
- Null,
- Undefined,
- True,
- False,
-
- Eof,
- Invalid,
- Whitespace
- }
-}
diff --git a/homework/45278/js2html/js2html/Program.cs b/homework/45278/js2html/js2html/Program.cs
deleted file mode 100644
index 9bf0ebb..0000000
--- a/homework/45278/js2html/js2html/Program.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using js2html.Extensions;
-using System;
-using System.IO;
-using System.Text;
-
-namespace js2html
-{
- class Program
- {
- static void Main(string[] args)
- {
- if(args.Length == 2)
- {
- string path = args[0];
- string code = File.ReadAllText(path);
- Tokenizer tokenizer = new Tokenizer(code);
- tokenizer.Tokens = tokenizer.Tokenize();
- StringBuilder html = new StringBuilder("<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n");
- foreach (var str in tokenizer.ParseHtml())
- {
- html.Append(str);
- }
- html.Append("</body>\n</html>");
- File.WriteAllText(args[1], html.ToString());
- Console.WriteLine("Finished...");
- }
- }
- }
-}
diff --git a/homework/45278/js2html/js2html/Tokenizer.cs b/homework/45278/js2html/js2html/Tokenizer.cs
deleted file mode 100644
index fa61775..0000000
--- a/homework/45278/js2html/js2html/Tokenizer.cs
+++ /dev/null
@@ -1,288 +0,0 @@
-using js2html.Models;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace js2html
-{
- public class Tokenizer
- {
- public Dictionary<string, TokenType> KeywordsTable { get; set; }
- public int Line { get; set; }
- public int Current { get; set; }
- public string Code { get; set; }
- public IEnumerable<Token> Tokens { get; set; }
- public Tokenizer(string code)
- {
- KeywordsTable = new Dictionary<string, TokenType>();
- KeywordsTable.Add("break", TokenType.Break);
- KeywordsTable.Add("case", TokenType.Case);
- KeywordsTable.Add("catch", TokenType.Catch);
- KeywordsTable.Add("class", TokenType.Class);
- KeywordsTable.Add("const", TokenType.Const);
- KeywordsTable.Add("continue", TokenType.Continue);
- KeywordsTable.Add("debugger", TokenType.Debugger);
- KeywordsTable.Add("default", TokenType.Default);
- KeywordsTable.Add("delete", TokenType.Delete);
- KeywordsTable.Add("do", TokenType.Do);
- KeywordsTable.Add("else", TokenType.Else);
- KeywordsTable.Add("export", TokenType.Export);
- KeywordsTable.Add("extends", TokenType.Extends);
- KeywordsTable.Add("finally", TokenType.Finally);
- KeywordsTable.Add("for", TokenType.For);
- KeywordsTable.Add("function", TokenType.Function);
- KeywordsTable.Add("if", TokenType.If);
- KeywordsTable.Add("import", TokenType.Import);
- KeywordsTable.Add("in", TokenType.In);
- KeywordsTable.Add("instanceof", TokenType.Instanceof);
- KeywordsTable.Add("new", TokenType.New);
- KeywordsTable.Add("return", TokenType.Return);
- KeywordsTable.Add("super", TokenType.Super);
- KeywordsTable.Add("switch", TokenType.Switch);
- KeywordsTable.Add("this", TokenType.This);
- KeywordsTable.Add("throw", TokenType.Throw);
- KeywordsTable.Add("try", TokenType.Try);
- KeywordsTable.Add("typeof", TokenType.Typeof);
- KeywordsTable.Add("var", TokenType.Var);
- KeywordsTable.Add("void", TokenType.Void);
- KeywordsTable.Add("while", TokenType.While);
- KeywordsTable.Add("with", TokenType.With);
- KeywordsTable.Add("yield", TokenType.Yield);
- KeywordsTable.Add("null", TokenType.Null);
- KeywordsTable.Add("undefined", TokenType.Undefined);
- KeywordsTable.Add("true", TokenType.True);
- KeywordsTable.Add("false", TokenType.False);
-
- Current = 0;
- Line = 1;
- Code = code;
- }
-
- public IEnumerable<Token> Tokenize()
- {
- List<Token> tokens = new List<Token>();
- do
- {
- tokens.Add(GetNextToken());
- } while (tokens[tokens.Count - 1].TokenType != TokenType.Eof);
- return tokens;
- }
-
- private Token ProduceWhitespaceToken()
- {
- var lexeme = new StringBuilder();
- while(string.IsNullOrWhiteSpace(Code[Current].ToString()))
- {
- lexeme.Append(Code[Current]);
- if (Code[Current] == '\n')
- {
- Current++;
- return new Token(TokenType.Whitespace, Line++, lexeme.ToString());
- }
- Current++;
- }
- return new Token(TokenType.Whitespace, Line, lexeme.ToString());
- }
-
- private string ReadString()
- {
- var opening = Code[Current++];
- var lexeme = new StringBuilder(opening);
- while (!Match(opening))
- {
- lexeme.Append(Code[Current]);
- Current++;
- }
- lexeme.Append(opening);
- return lexeme.ToString();
- }
-
- private string ReadNumber()
- {
- var lexeme = new StringBuilder();
- while(Code[Current] >= '0' && Code[Current] <= '9')
- {
- lexeme.Append(Code[Current]);
- Current++;
- }
- return lexeme.ToString();
- }
-
- private string ReadKeyword()
- {
- var lexeme = new StringBuilder();
- while (Code[Current] >= 'a' && Code[Current] <= 'z')
- {
- lexeme.Append(Code[Current]);
- Current++;
- }
- return lexeme.ToString();
- }
-
- private string ReadIdentifier()
- {
- var lexeme = new StringBuilder();
- while (IsValidIdentifierChar())
- {
- lexeme.Append(Code[Current]);
- Current++;
- }
- return lexeme.ToString();
- }
-
- public Token GetNextToken()
- {
- if (Current == Code.Length)
- {
- return new Token(TokenType.Eof, Line);
- }
- if (Code[Current] == '\0')
- {
- return new Token(TokenType.Eof, Line);
- }
-
-
- if (string.IsNullOrWhiteSpace(Code[Current].ToString())) return ProduceWhitespaceToken();
-
- switch (Code[Current])
- {
- case '(': Current++; return new Token(TokenType.LeftParen, Line, "(");
- case ')': Current++; return new Token(TokenType.RightParen, Line, ")");
- case '{': Current++; return new Token(TokenType.LeftBrace, Line, "{");
- case '}': Current++; return new Token(TokenType.RightBrace, Line, "}");
- case ',': Current++; return new Token(TokenType.Comma, Line, ",");
- case '.': Current++; return new Token(TokenType.Dot, Line, ".");
- case '-':
- Current++;
- if (Match('-'))
- return new Token(TokenType.MinusMinus, Line, "--");
- else if (Match('='))
- return new Token(TokenType.MinusEqual, Line, "-=" );
- else
- return new Token(TokenType.Minus, Line, "-");
- case '+':
- Current++;
- if (Match('+'))
- return new Token(TokenType.PlusPlus, Line, "++");
- else if (Match('='))
- return new Token(TokenType.PlusEqual, Line, "+=");
- else
- return new Token(TokenType.Plus, Line, "+");
- case ';': Current++; return new Token(TokenType.Semicolon, Line, ";");
- case '*': Current++; return new Token(TokenType.Star, Line, "*");
- case '/': Current++; return new Token(TokenType.Division, Line, "/");
- case '%': Current++; return new Token(TokenType.Modulo, Line, "%");
- case '~': Current++; return new Token(TokenType.BitwiseNot, Line, "~");
- case '=':
- Current++;
- if (Match('='))
- {
- if (Match('='))
- return new Token(TokenType.StrictEqual, Line, "===");
- else
- return new Token(TokenType.EqualEqual, Line, "==");
- }
- else
- return new Token(TokenType.Equal, Line, "=");
- case '!':
- Current++;
- if (Match('='))
- {
- if (Match('='))
- return new Token(TokenType.StrictNotEqual, Line, "!==");
- else
- return new Token(TokenType.BangEqual, Line, "!!");
- }
- else
- return new Token(TokenType.Bang, Line, "!");
- case '>':
- Current++;
- if (Match('='))
- return new Token(TokenType.GreaterEqual, Line, ">=");
- else if (Match('>'))
- return new Token(TokenType.RightShift, Line, ">>");
- else
- return new Token(TokenType.Greater, Line, ">");
- case '<':
- Current++;
- if (Match('='))
- return new Token(TokenType.LessEqual, Line, "<=");
- else if (Match('<'))
- return new Token(TokenType.LeftShift, Line, "<<");
- else
- return new Token(TokenType.Less, Line, "<");
- case '&':
- Current++;
- if (Match('&')) return new Token(TokenType.LogicalAnd, Line, "&&");
- else return new Token(TokenType.BitwiseAnd, Line, "&");
- case '|':
- Current++;
- if (Match('|')) return new Token(TokenType.LogicalOr, Line,"||");
- else return new Token(TokenType.BitwiseOr, Line, "|");
- case '^': Current++; return new Token(TokenType.BitwiseXor, Line, "^");
- case '?': Current++; return new Token(TokenType.QuestionMark, Line, "?");
- case ':': Current++; return new Token(TokenType.Colon, Line, ":");
- case '[': Current++; return new Token(TokenType.LeftSquareBracket, Line, "[");
- case ']': Current++; return new Token(TokenType.RightSquareBracket, Line, "]");
- default:
- break;
- }
-
- if(Code[Current] == '\'' || Code[Current] == '"')
- {
- var lexeme = ReadString();
- return new Token(TokenType.String, Line, lexeme);
- }
-
- if(Code[Current] >= '0' && Code[Current] <= '9')
- {
- var lexeme = ReadNumber();
- return new Token(TokenType.Number, Line, lexeme, double.Parse(lexeme));
- }
-
- if(Code[Current] >= 'a' && Code[Current] <= 'z')
- {
- var start = Current;
- var lexeme = ReadKeyword();
- TokenType type = TokenType.Eof;
- if(KeywordsTable.TryGetValue(lexeme, out type))
- {
- return new Token(type, Line, lexeme);
- }
- else
- {
- Current = start;
- }
- }
-
- if(IsValidIdentifierStarting())
- {
- var lexeme = ReadIdentifier();
- return new Token(TokenType.Identifier, Line, lexeme);
- }
-
-
- return new Token(TokenType.Eof, Line);
- }
-
- private bool IsValidIdentifierStarting()
- {
- return (Code[Current] >= 'A' && Code[Current] <= 'z') || Code[Current] == '_';
- }
-
- private bool IsValidIdentifierChar()
- {
- return IsValidIdentifierStarting() || (Code[Current] >= '0' && Code[Current] <= '9');
- }
-
- private bool Match(char c)
- {
- if (c == Code[Current])
- {
- ++Current;
- return true;
- }
- return false;
- }
- }
-}
diff --git a/homework/45278/js2html/js2html/hello.html b/homework/45278/js2html/js2html/hello.html
deleted file mode 100644
index 2c8f911..0000000
--- a/homework/45278/js2html/js2html/hello.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-</head>
-<body>
-<span class="keyword" style="color:blue">function</span><span class="identifier">&nbsp;answer</span><span class="operator">(</span><span class="operator">)</span><span class="operator">&nbsp;{</span><span class="keyword" style="color:blue"><br>&nbsp;&nbsp;&nbsp;&nbsp;return</span><span class="number">&nbsp;42</span><span class="operator">;</span><span class="operator"><br>}</span><span class="identifier"><br>console</span><span class="operator">.</span><span class="identifier">log</span><span class="operator">(</span><span class="string" style="color:indianred">The "Answer" is: '</span><span class="operator">&nbsp;+</span><span class="identifier">&nbsp;answer</span><span class="operator">(</span><span class="operator">)</span><span class="operator">)</span><span class="operator">;</span><br></body>
-</html> \ No newline at end of file
diff --git a/homework/45278/js2html/js2html/hello.js b/homework/45278/js2html/js2html/hello.js
deleted file mode 100644
index ab5524a..0000000
--- a/homework/45278/js2html/js2html/hello.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function answer() {
- return 42;
-}
-console.log('The "Answer" is: ' + answer());
diff --git a/homework/45278/js2html/js2html/js2html.csproj b/homework/45278/js2html/js2html/js2html.csproj
deleted file mode 100644
index b5c27ba..0000000
--- a/homework/45278/js2html/js2html/js2html.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp2.1</TargetFramework>
- <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="Sprache" Version="2.2.0" />
- </ItemGroup>
-
-</Project>