fsyacc msbuild проблема, ошибка при вызове генератора лексера - PullRequest
0 голосов
/ 28 апреля 2019

У меня проблема с пониманием того, как настроить файл fsproj для корректной работы с библиотекой генератора лексеров / анализаторов FSyacc с VS (msbuild).Я пытаюсь следовать руководству от https://fsprojects.github.io/FsLexYacc/fslex.html

Но я не думаю, что понимаю файл fsproj.Самое интересное в том, что у меня есть работающий проект-пустышка, работающий на Linux, но если я попытаюсь перенести его на Windows VS, он не может быть собран.(работает с mono, а не с msbuild)

Пробовал с помощью простого тестового проекта, приведенного по ссылке выше.

Первая проблема заключалась в том, что он не мог найти файлы Lexer.fs и Parser.fs,это я решил с помощью false, но затем он завершается ошибкой при попытке вызвать fslex.exe

Я только что сбросил содержимое файла дыры fsproj ниже.

, который возвращает следующую ошибку

1>..\YaccParser\Lexer.fsl(14,32): error : Unexpected character '''
1>C:\Users\KAM\Desktop\Fasto2019\YaccParser\YaccParser\packages\FsLexYacc.7.0.6\build\FsLexYacc.targets(34,3): error MSB3073: The command ""C:\Users\KAM\Desktop\Fasto2019\YaccParser\YaccParser\packages\FsLexYacc.7.0.6\build\\fslex.exe"  -o "Lexer.fs" --unicode ..\YaccParser\Lexer.fsl" exited with code 1.
1>Done building project "YaccParser.fsproj" -- FAILED.
1>
1>Build FAILED.

Я пытался следовать некоторым старым потокам в stackoverflow без какой-либо удачи.Так что, если кто-то может быть настолько хорош, чтобы помочь мне направить меня через возможные ошибки в моем файле fsproj и тому подобное, это было бы хорошо.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{352CE065-7A61-460B-888B-B47F7E9FF8A3}</ProjectGuid>
    <UseStandardResourceNames>true</UseStandardResourceNames>
    <OutputType>Exe</OutputType>
    <RootNamespace>YaccParser</RootNamespace>
    <AssemblyName>YaccParser</AssemblyName>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <ExternalConsole>true</ExternalConsole>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <ExternalConsole>true</ExternalConsole>
    <GenerateTailCalls>true</GenerateTailCalls>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup>
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0' OR '$(VisualStudioVersion)' == '11.0'">
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
  </PropertyGroup>
  <Import Project="$(FSharpTargetsPath)" />
  <Import Project="..\packages\FsLexYacc.7.0.6\build\FsLexYacc.targets" Condition="Exists('..\packages\FsLexYacc.7.0.6\build\FsLexYacc.targets')" />
  <ItemGroup>
    <Compile Include="Parser.fs">
      <visible>false</visible>
        <link> Parser.fs</link>
    </Compile>
    <Compile Include="Lexer.fs">
      <visible>false</visible>
        <link> Lexer.fs</link>
    </Compile>
    <FsYacc Include="..\YaccParser\Parser.fsy">
      <OtherFlags>--module Parser</OtherFlags>
    </FsYacc>
    <FsLex Include="..\YaccParser\Lexer.fsl">
      <OtherFlags>--unicode</OtherFlags>
    </FsLex>
    <Compile Include="AssemblyInfo.fs" />
    <Compile Include="Program.fs" />
    <Content Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="FSharp.Core">
      <HintPath>packages\FSharp.Core.4.3.3\lib\net45\FSharp.Core.dll</HintPath>
    </Reference>
    <Reference Include="FsLexYacc.Runtime">
      <HintPath>packages\FsLexYacc.Runtime.7.0.6\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid10+MonoTouch10\FsLexYacc.Runtime.dll</HintPath>
    </Reference>
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Numerics" />
  </ItemGroup>
  <Import Project="packages\FsLexYacc.7.0.6\build\FsLexYacc.targets" Condition="Exists('packages\FsLexYacc.7.0.6\build\FsLexYacc.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('packages\FsLexYacc.7.0.6\build\FsLexYacc.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\FsLexYacc.7.0.6\build\FsLexYacc.targets'))" />
  </Target>
</Project>
...