Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (6)
Showing
with 1193 additions and 203 deletions
......@@ -68,13 +68,18 @@ namespace Lexer
public override bool Parse()
{
NextCh();
int res = 0; //
int sign = 1; //
if (currentCh == '+' || currentCh == '-')
{
if (currentCh == '-')
sign = -1;
NextCh();
}
if (char.IsDigit(currentCh))
{
res = currentCh - '0';
NextCh();
}
else
......@@ -84,6 +89,7 @@ namespace Lexer
while (char.IsDigit(currentCh))
{
res = res * 10 + currentCh - '0';
NextCh();
}
......@@ -93,6 +99,8 @@ namespace Lexer
Error();
}
this.parseResult = res * sign;
return true;
}
......@@ -113,10 +121,40 @@ namespace Lexer
builder = new StringBuilder();
}
public override bool Parse()
{
throw new NotImplementedException();
}
public override bool Parse()
{
NextCh();
if (currentCharValue == -1)
Error();
var builder1 = new StringBuilder();
if (char.IsLetter(currentCh) || currentCh == '_')
{
builder1.Append(currentCh);
NextCh();
}
else
{
Error();
return false;
}
while (char.IsLetter(currentCh) || char.IsDigit(currentCh) || currentCh == '_')
{
builder1.Append(currentCh);
NextCh();
}
if (currentCharValue != -1)
{
Error();
}
parseResult = builder1.ToString();
return true;
}
}
......@@ -129,8 +167,34 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
}
NextCh();
if (currentCharValue == -1)
{
Error();
}
if (currentCh == '0')
Error();
if (currentCh == '+' || currentCh == '-')
{
NextCh();
if (currentCh == '0')
Error();
}
while (char.IsDigit(currentCh))
NextCh();
if (currentCharValue != -1)
{
Error();
}
return true;
//throw new NotImplementedException();
}
}
public class LetterDigitLexer : Lexer
......@@ -151,7 +215,33 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
//throw new NotImplementedException();
NextCh();
if (currentCharValue == -1)
{
Error();
}
if (char.IsDigit(currentCh))
Error();
bool isDigit = false;
NextCh();
while ((char.IsDigit(currentCh) && !isDigit) || (char.IsLetter(currentCh) && isDigit))
{
isDigit = char.IsDigit(currentCh);
NextCh();
}
if (currentCharValue != -1)
{
Error();
}
return true;
}
}
......@@ -173,7 +263,41 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
List<char> res = new List<char>();
if (currentCharValue == -1)
{
Error();
}
if (!char.IsLetter(currentCh))
Error();
else
{
res.Add(currentCh);
NextCh();
}
while (currentCh == ',' || currentCh == ';')
{
NextCh();
if (char.IsLetter(currentCh))
res.Add(currentCh);
else
Error();
NextCh();
}
if (currentCharValue != -1)
{
Error();
}
parseResult = res;
return true;
}
}
......@@ -194,7 +318,45 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
List<int> res = new List<int>();
if (currentCharValue == -1)
{
Error();
}
if (!char.IsDigit(currentCh))
Error();
else
{
res.Add(currentCh - '0');
NextCh();
}
while (currentCh == ' ')
{
NextCh();
if (char.IsDigit(currentCh))
{
res.Add(currentCh - '0');
NextCh();
}
else if (currentCh == ' ')
continue;
else
Error();
}
if (currentCharValue != -1)
{
Error();
}
parseResult = res;
return true;
}
}
......@@ -216,7 +378,55 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
StringBuilder res = new StringBuilder("");
if (currentCharValue == -1)
{
Error();
}
while (char.IsLetterOrDigit(currentCh))
{
if (char.IsLetter(currentCh))
{
res.Append(currentCh);
NextCh();
}
else
Error();
if (char.IsLetter(currentCh))
{
res.Append(currentCh);
NextCh();
if (currentCharValue == -1)
break;
}
if (char.IsDigit(currentCh))
{
res.Append(currentCh);
NextCh();
if (currentCharValue == -1)
break;
}
if (char.IsDigit(currentCh))
{
res.Append(currentCh);
NextCh();
if (currentCharValue == -1)
break;
}
}
if (currentCharValue != -1)
{
Error();
}
parseResult = res.ToString();
return true;
}
}
......@@ -240,7 +450,80 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
StringBuilder res = new StringBuilder("");
if (currentCharValue == -1)
{
Error();
}
if (char.IsDigit(currentCh))
{
if (currentCh == '0')
{
res.Append(currentCh);
NextCh();
if (currentCharValue == -1)
{
parseResult = double.Parse(res.ToString());
return true;
}
else if (currentCh != '.' && currentCharValue != -1)
Error();
else if (currentCh == '.')
{
res.Append(currentCh);
NextCh();
if (!char.IsDigit(currentCh))
Error();
}
else
Error();
}
else
{
while (char.IsDigit(currentCh))
{
res.Append(currentCh);
NextCh();
}
if (currentCharValue == -1)
{
parseResult = double.Parse(res.ToString());
return true;
}
else if (currentCh != '.' && currentCharValue != -1)
Error();
else if (currentCh == '.')
{
res.Append(currentCh);
NextCh();
if (!char.IsDigit(currentCh))
Error();
}
else
Error();
}
}
else
Error();
while (char.IsDigit(currentCh))
{
res.Append(currentCh);
NextCh();
}
if (currentCharValue != -1)
{
Error();
}
parseResult = double.Parse(res.ToString());
return true;
}
}
......@@ -264,7 +547,41 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
StringBuilder res = new StringBuilder("");
if (currentCharValue == -1)
{
Error();
}
if (currentCh != '\'')
Error();
res.Append(currentCh);
NextCh();
while (currentCh != '\'')
{
if (currentCharValue == -1)
Error();
res.Append(currentCh);
NextCh();
}
if (currentCh != '\'')
Error();
res.Append(currentCh);
NextCh();
if (currentCharValue != -1)
{
Error();
}
parseResult = res.ToString();
return true;
}
}
......@@ -287,7 +604,45 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
StringBuilder res = new StringBuilder("");
if (currentCharValue == -1)
Error();
if (currentCh != '/')
Error();
res.Append(currentCh);
NextCh();
if (currentCh != '*')
Error();
res.Append(currentCh);
NextCh();
while (true)
{
if (currentCharValue == -1)
Error();
if (currentCh == '*')
{
res.Append(currentCh);
NextCh();
if (currentCh == '/')
{
res.Append(currentCh);
NextCh();
if (currentCharValue != -1)
Error();
break;
}
}
res.Append(currentCh);
NextCh();
}
parseResult = res.ToString();
return true;
}
}
......@@ -311,7 +666,18 @@ namespace Lexer
public override bool Parse()
{
throw new NotImplementedException();
NextCh();
StringBuilder res = new StringBuilder("");
StringBuilder ident = new StringBuilder("");
if (currentCharValue == -1)
Error();
IdentLexer l = new IdentLexer("abc22");
return true;
}
}
......@@ -319,16 +685,8 @@ namespace Lexer
{
public static void Main()
{
string input = "154216";
Lexer L = new IntLexer(input);
try
{
L.Parse();
}
catch (LexerException e)
{
System.Console.WriteLine(e.Message);
}
CommentLexer l = new CommentLexer("/**/");
l.Parse();
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -13,6 +15,8 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -40,6 +44,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -53,8 +60,16 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
......@@ -83,7 +83,8 @@ namespace SimpleLexer
NextLexem(); // Считать первую лексему, заполнив LexText, LexKind и, возможно, LexValue
}
public void Init() {
public void Init()
{
}
......@@ -100,6 +101,21 @@ namespace SimpleLexer
keywordsMap["begin"] = Tok.BEGIN;
keywordsMap["end"] = Tok.END;
keywordsMap["cycle"] = Tok.CYCLE;
keywordsMap["div"] = Tok.DIV;
keywordsMap["mod"] = Tok.MOD;
keywordsMap["and"] = Tok.AND;
keywordsMap["or"] = Tok.OR;
keywordsMap["not"] = Tok.NOT;
// доб. RecursiveDescnetParser
keywordsMap["while"] = Tok.WHILE;
keywordsMap["do"] = Tok.DO;
keywordsMap["for"] = Tok.FOR;
keywordsMap["to"] = Tok.TO;
keywordsMap["if"] = Tok.IF;
keywordsMap["then"] = Tok.THEN;
keywordsMap["else"] = Tok.ELSE;
//keywordsMap["("] = Tok.LEFT_BRACKET;
//keywordsMap[")"] = Tok.RIGHT_BRACKET;
}
public string FinishCurrentLine()
......@@ -156,23 +172,146 @@ namespace SimpleLexer
LexText = "";
LexRow = row;
LexCol = col;
// Тип лексемы определяется по ее первому символу
// Для каждой лексемы строится синтаксическая диаграмма
if (currentCh == ';')
// Тип лексемы определяется по ее первому символу
// Для каждой лексемы строится синтаксическая диаграмма
if (currentCh == ';')
{
NextCh();
LexKind = Tok.SEMICOLON;
}
else if (currentCh == ':')
{
NextCh();
if (currentCh == '=')
{
NextCh();
LexKind = Tok.ASSIGN;
}
else
{
LexKind = Tok.COLON;
}
}
else if (currentCh == ',')
{
NextCh();
LexKind = Tok.COMMA;
}
else if (currentCh == '+')
{
NextCh();
if (currentCh == '=')
{
NextCh();
LexKind = Tok.PLUSASSIGN;
}
else
{
LexKind = Tok.PLUS;
}
}
else if (currentCh == '-')
{
NextCh();
if (currentCh == '=')
{
NextCh();
LexKind = Tok.MINUSASSIGN;
}
else
{
LexKind = Tok.MINUS;
}
}
else if (currentCh == '*')
{
NextCh();
if (currentCh == '=')
{
NextCh();
LexKind = Tok.MULTASSIGN;
}
else
{
LexKind = Tok.MULT;
}
}
else if (currentCh == '/')
{
NextCh();
if (currentCh == '=')
{
NextCh();
LexKind = Tok.DIVASSIGN;
}
else if (currentCh == '/')
{
while (currentCh != '\0' && currentCh != '\n')
NextCh();
if (currentCh == '\0')
LexKind = Tok.EOF;
else
NextLexem();
}
else
{
LexKind = Tok.DIVISION;
}
}
else if (currentCh == '>')
{
NextCh();
LexKind = Tok.GT;
if (currentCh == '=')
{
NextCh();
LexKind = Tok.GEQ;
}
}
else if (currentCh == '<')
{
NextCh();
LexKind = Tok.LT;
if (currentCh == '=')
{
NextCh();
LexKind = Tok.LEQ;
}
if (currentCh == '>')
{
NextCh();
LexKind = Tok.NEQ;
}
}
else if (currentCh == '=')
{
NextCh();
LexKind = Tok.EQ;
}
// доб. DescentParser
else if (currentCh == '(')
{
NextCh();
LexKind = Tok.SEMICOLON;
LexKind = Tok.LEFT_BRACKET;
}
else if (currentCh == ':')
else if (currentCh == ')')
{
NextCh();
if (currentCh != '=')
{
LexError("= was expected");
}
NextCh();
LexKind = Tok.ASSIGN;
LexKind = Tok.RIGHT_BRACKET;
}
// -----
else if (currentCh == '{')
{
while (currentCh != '}')
{
if (currentCh == '\0')
LexError("Неверное использование комментариев {}.");
NextCh();
}
NextCh();
NextLexem();
}
else if (char.IsLetter(currentCh))
{
while (char.IsLetterOrDigit(currentCh))
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -12,6 +14,8 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -39,6 +43,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -50,7 +57,17 @@
<Compile Include="SimpleLexer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -12,6 +14,8 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -36,6 +40,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -55,8 +62,16 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
......@@ -34,6 +36,8 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<LangVersion>5</LangVersion>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -52,6 +56,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
......@@ -92,10 +99,18 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="SimpleLex.lex" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<ProjectExtensions>
<VisualStudio AllowExistingFolder="true" />
</ProjectExtensions>
</Project>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
</Project>
\ No newline at end of file
File added
......@@ -46,8 +46,32 @@ namespace GeneratedLexer
if (tok == (int)Tok.EOF)
{
idsInComment = myScanner.idsInComment;
break;
}
else if (tok == (int)Tok.ID)
{
++idCount;
if (myScanner.yytext.Length < minIdLength)
minIdLength = myScanner.yytext.Length;
if (myScanner.yytext.Length > maxIdLength)
maxIdLength = myScanner.yytext.Length;
avgIdLength = (avgIdLength * (idCount - 1) + myScanner.yytext.Length) / idCount;
}
else if (tok == (int)Tok.RNUM)
{
sumDouble += double.Parse(myScanner.yytext);
}
else if (tok == (int)Tok.INUM)
{
sumInt += int.Parse(myScanner.yytext);
}
} while (true);
}
}
......
This diff is collapsed.
......@@ -7,13 +7,19 @@ AlphaDigit {Alpha}|{Digit}
INTNUM {Digit}+
REALNUM {INTNUM}\.{INTNUM}
ID {Alpha}{AlphaDigit}*
DotChr [^\r\n]
OneLineCmnt \/\/{DotChr}*
StringUp \'[^']*\'
// , - Scanner
%{
public int LexValueInt;
public double LexValueDouble;
public List<string> idsInComment = new List<string>();
%}
%x COMMENT
%%
{INTNUM} {
LexValueInt = int.Parse(yytext);
......@@ -41,6 +47,44 @@ cycle {
return (int)Tok.ID;
}
{OneLineCmnt} {
return (int)Tok.COMMENT;
}
{StringUp} {
return (int)Tok.STRINGAP;
}
"{" {
// COMMENT
BEGIN(COMMENT);
return (int)Tok.LONGCOMMENT;
}
<COMMENT> "}" {
// INITIAL
BEGIN(INITIAL);
return (int)Tok.LONGCOMMENT;
}
<COMMENT>begin {
}
<COMMENT>end {
}
<COMMENT>cycle {
}
<COMMENT>{ID} {
// ID
idsInComment.Add(yytext);
}
":" {
return (int)Tok.COLON;
}
......@@ -55,7 +99,7 @@ cycle {
[^ \r\n] {
LexError();
return 0; //
return 0; //
}
%%
......@@ -64,7 +108,7 @@ cycle {
public void LexError()
{
Console.WriteLine("({0},{1}): {2}", yyline, yycol, yytext);
Console.WriteLine("({0},{1}): {2}", yyline, yycol, yytext);
}
public string TokToString(Tok tok)
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.13.3" targetFramework="net40" />
<package id="NUnit.ConsoleRunner" version="3.15.2" targetFramework="net40" />
<package id="NUnit3TestAdapter" version="4.2.1" targetFramework="net40" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -12,6 +14,8 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -39,6 +43,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -56,7 +63,17 @@
<Name>SimpleLexer</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
......@@ -29,14 +29,12 @@ namespace SimpleLangParser
public void Expr()
{
if (l.LexKind == Tok.ID || l.LexKind == Tok.INUM)
{
l.NextLexem();
}
if (l.LexKind == Tok.ID || l.LexKind == Tok.INUM || l.LexKind == Tok.PLUS || l.LexKind == Tok.MINUS || l.LexKind == Tok.MULT || l.LexKind == Tok.DIVISION || l.LexKind == Tok.RIGHT_BRACKET || l.LexKind == Tok.LEFT_BRACKET)
while (l.LexKind == Tok.ID || l.LexKind == Tok.INUM || l.LexKind == Tok.PLUS || l.LexKind == Tok.MINUS || l.LexKind == Tok.MULT || l.LexKind == Tok.DIVISION || l.LexKind == Tok.RIGHT_BRACKET || l.LexKind == Tok.LEFT_BRACKET)
l.NextLexem();
//if (l.LexKind != Tok.ID && l.LexKind != Tok.INUM && l.LexKind != Tok.PLUS && l.LexKind != Tok.MINUS && l.LexKind != Tok.MULT && l.LexKind != Tok.DIVISION && l.LexKind != Tok.RIGHT_BRACKET && l.LexKind != Tok.LEFT_BRACKET)
else
{
SyntaxError("expression expected");
}
}
public void Assign()
......@@ -46,7 +44,8 @@ namespace SimpleLangParser
{
l.NextLexem();
}
else {
else
{
SyntaxError(":= expected");
}
Expr();
......@@ -81,6 +80,21 @@ namespace SimpleLangParser
Assign();
break;
}
case Tok.WHILE:
{
While();
break;
}
case Tok.FOR:
{
For();
break;
}
case Tok.IF:
{
If();
break;
}
default:
{
SyntaxError("Operator expected");
......@@ -111,6 +125,70 @@ namespace SimpleLangParser
Statement();
}
// доб. WHILE
public void While()
{
l.NextLexem();
Expr();
if (l.LexKind == Tok.DO)
{
l.NextLexem();
Statement();
}
else SyntaxError("DO expected");
}
// доб. FOR
public void For()
{
l.NextLexem();
if (l.LexKind == Tok.ID)
{
l.NextLexem();
if (l.LexKind == Tok.ASSIGN)
{
l.NextLexem();
Expr();
if (l.LexKind == Tok.TO)
{
l.NextLexem();
Expr();
if (l.LexKind == Tok.DO)
{
l.NextLexem();
Statement();
}
else SyntaxError("DO expected");
}
else SyntaxError("TO expected");
}
else SyntaxError("ASSIGN expected");
}
else SyntaxError("ID expected");
}
// доб. IF
public void If()
{
l.NextLexem();
Expr();
if (l.LexKind == Tok.THEN)
{
l.NextLexem();
Statement();
if (l.LexKind == Tok.ELSE)
{
l.NextLexem();
Statement();
}
}
else SyntaxError("THEN expected");
}
public void SyntaxError(string message)
{
var errorMessage = "Syntax error in line " + l.LexRow.ToString() + ":\n";
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -12,6 +14,8 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -39,6 +43,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -62,8 +69,16 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
......@@ -14,6 +16,8 @@
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -56,6 +60,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -79,8 +86,16 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
......@@ -14,6 +16,8 @@
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -60,6 +64,9 @@
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -86,6 +93,13 @@
<Content Include="SimpleYacc.y" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net35-client" requireReinstallation="true" />
<package id="NUnit" version="3.13.3" targetFramework="net40" />
<package id="NUnit.ConsoleRunner" version="3.15.2" targetFramework="net40" />
<package id="NUnit3TestAdapter" version="4.2.1" targetFramework="net40" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
......@@ -14,6 +16,8 @@
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -56,6 +60,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -89,8 +96,16 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
......@@ -14,6 +16,8 @@
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -56,6 +60,9 @@
<Reference Include="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -86,8 +93,16 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -12,6 +14,8 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -37,6 +41,9 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.3-beta1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -55,4 +62,11 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.2.1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
</Project>
\ No newline at end of file