update bison flex

-Updated bison flex exe files to the latest windows version i could find
-Regenned the compiler..... alot of changes.....
This commit is contained in:
marauder2k7 2024-04-14 22:17:41 +01:00
parent 0954b081d0
commit 83b3f01928
65 changed files with 31010 additions and 11607 deletions

View file

@ -0,0 +1,173 @@
How to setup custom build rules for Visual Studio 2010 and up.
---------------
First of all you should have the necessary files.
Custom Build rules are separated into a file triplet of `.xml`, `.targets` and `.props`.
You find the custom build rules for win_flex_bison in the **custom_build_rules** directory of the win_flex_bison archive.
You may choose to install one of the following rule set
* the combined rules - [alternative download][1]:
* [win_flex_bison_custom_build.props ](win_flex_bison/win_flex_bison_custom_build.props)
* [win_flex_bison_custom_build.targets](win_flex_bison/win_flex_bison_custom_build.targets)
* [win_flex_bison_custom_build.xml ](win_flex_bison/win_flex_bison_custom_build.xml)
* flex only rules - [alternative download][2]:
* [win_flex_custom_build.props ](win_flex_only/win_flex_custom_build.props)
* [win_flex_custom_build.targets ](win_flex_only/win_flex_custom_build.targets)
* [win_flex_custom_build.xml ](win_flex_only/win_flex_custom_build.xml)
* bison only rules - [alternative download][3]:
* [win_bison_custom_build.props ](win_bison_only/win_bison_custom_build.props)
* [win_bison_custom_build.targets](win_bison_only/win_bison_custom_build.targets)
* [win_bison_custom_build.xml ](win_bison_only/win_bison_custom_build.xml)
This documentation uses the combined rule-set but can be used for all rule-sets.
[1]: https://sourceforge.net/projects/winflexbison/files/win_flex_bison_custom_build_rules.zip/download "Combined build rules for Bison and Flex"
[2]: https://sourceforge.net/projects/winflexbison/files/win_flex_custom_build_rules.zip/download "Build rules for Flex only"
[3]: https://sourceforge.net/projects/winflexbison/files/win_bison_custom_build_rules.zip/download "Build rules for Bison only"
----
Launch Visual Studio and open an VC/VC++ project.
Open context menu for project item in Solution Explorer panel and select "**Build Customizations...**" menu item.
(Note: newer VS versions have this below sub-menu "**Build Dependencies...**".)
![Build Customizations in Solution Explorer](docs/1.png)
----
In popup dialog "Visual C++ Build Customization Files" press "**Find Existing...**" button.
![Customization Files](docs/2.png)
----
In Open File dialog select "**win_flex_bison_custom_build.targets**" file and press "Open".
(Note: you may have to switch the file filter to "(*.*) all files".)
----
You will see "Add Search Path?" message box, press "Yes".
![Adding Search Path](docs/3.png)
----
In "Visual C++ Build Customization Files" dialog check just added item **win_flex_bison_custom_build** and press "OK".
![activate custom build rule](docs/4.png)
----
Now you can add flex and bison files to the project...
![project with flex and bison files added](docs/5.png)
... and build.
In build output you should see something like this:
~~~~
1>------ Rebuild All started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> Process sample bison file
1> Process sample flex file
1> stdafx.cpp
1> ConsoleApplication1.cpp
1> Generating Code...
1> ConsoleApplication1.vcxproj -> C:\Users\ConsoleApplication1\Debug\ConsoleApplication1.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
~~~~
-----
For **sample.y** bison file there are two output files: **sample.tab.h** and **sample.tab.cpp**.
For **sample.l** flex file you'll got **sample.flex.cpp**.
Now you can add them to the project and build. (*Don't forget to exclude cpp files from using precompiled headers*)
![Include generated files into Solution](docs/6.png)
~~~~
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> Process sample bison file
1> Process sample flex file
1> sample.tab.cpp
1> sample.flex.cpp
1> Generating Code...
1> ConsoleApplication1.vcxproj -> C:\Users\ConsoleApplication1\Debug\ConsoleApplication1.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
~~~~
----
If your flex/bison file is incorrect and you've got an error. But you don't see actual error message, something like this:
~~~~
1>------ Build started: Project: ConsoleApplication2, Configuration: Debug Win32 ------
1> Process "grammar.y" bison file
1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: The command "
1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: start /B /WAIT /D "C:...\ConsoleApplication2\ConsoleApplication2\" win_bison.exe --output="grammar.tab.cpp" --defines="grammar.tab.h" --graph="1.dot" "grammar.y"
1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: exit /b %errorlevel%" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
~~~~
You can change Build Output Verbosity from "Minimal" to "Normal" in "Options" dialog
![Verbosity](docs/Verbosity.png)
Then you will see more detailed output:
~~~~
1>BisonTarget:
1> Process "grammar.y" bison file
1> grammar.y:51.1-4: error: invalid directive: '%sdw'
1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: The command "
1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: start /B /WAIT /D "C:...\ConsoleApplication2\" win_bison.exe --output="grammar.tab.cpp" --defines="grammar.tab.h" --graph="1.dot" "grammar.y"
1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: exit /b %errorlevel%" exited with code 1.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.21
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
~~~~
----
Also you can tune some flex/bison options in files properties dialog:
![Opening File Properties](docs/Properties.png)
![Property Page for Flex sources](docs/FlexProperties.png)
![Property Page for Bison sources](docs/BisonProperties.png)
----
To debug your scanner or parser you can set break points right into **sample.y** or **sample.l** code.
![Debugging Flex source files](docs/Flex_debuging.png)
----
To use the Visual C++ Code editor for Flex/Bison files instead of the text editor adjust your editor settings as follows:
* click **Options** on the **Tools** menu, expand the **Text Editor** node and select **File Extension**
* type extension **`l`** in the **Extension** field and choose **Microsoft Visual C++** in the **Editor** drop-down field, click **Add**
* do the same for the extension **`y`**
You now have syntax highlighting, code-completion and show definition options in your Flex/Bison source.
----
Enjoy!

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup
Condition="'$(BisonBeforeTargets)' == '' and '$(BisonAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<BisonBeforeTargets>Midl</BisonBeforeTargets>
<BisonAfterTargets>CustomBuild</BisonAfterTargets>
</PropertyGroup>
<PropertyGroup>
<BisonDependsOn
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(BisonDependsOn)</BisonDependsOn>
</PropertyGroup>
<ItemDefinitionGroup>
<Bison>
<OutputFile>%(Filename).tab.cpp</OutputFile>
<DefinesFile>%(Filename).tab.h</DefinesFile>
<CommandLineTemplate>
start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
exit /b %errorlevel%</CommandLineTemplate>
<Outputs>%(RootDir)%(Directory)%(OutputFile);%(RootDir)%(Directory)%(DefinesFile);</Outputs>
<ExecutionDescription>Process "%(Filename)%(Extension)" bison file</ExecutionDescription>
</Bison>
</ItemDefinitionGroup>
</Project>

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName
Include="Bison">
<Targets>BisonTarget</Targets>
</AvailableItemName>
</ItemGroup>
<UsingTask
TaskName="Bison"
TaskFactory="XamlTaskFactory"
AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<Target
Name="BisonTarget"
BeforeTargets="$(BisonBeforeTargets)"
AfterTargets="$(BisonAfterTargets)"
Condition="'@(Bison)' != ''"
DependsOnTargets="$(BisonDependsOn);ComputeBisonOutput"
Outputs="%(Bison.Outputs)"
Inputs="%(Bison.Identity);%(Bison.AdditionalDependencies);$(MSBuildProjectFile)">
<ItemGroup
Condition="'@(SelectedFiles)' != ''">
<Bison
Remove="@(Bison)"
Condition="'%(Identity)' != '@(SelectedFiles)'" />
</ItemGroup>
<ItemGroup>
<Bison_tlog
Include="%(Bison.Outputs)"
Condition="'%(Bison.Outputs)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'">
<Source>@(Bison, '|')</Source>
</Bison_tlog>
</ItemGroup>
<Message
Importance="High"
Text="%(Bison.ExecutionDescription)" />
<WriteLinesToFile
Condition="'@(Bison_tlog)' != '' and '%(Bison_tlog.ExcludedFromBuild)' != 'true'"
File="$(IntDir)$(ProjectName).write.1.tlog"
Lines="^%(Bison_tlog.Source);@(Bison_tlog-&gt;'%(Fullpath)')" />
<Bison
Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
CommandLineTemplate="%(Bison.CommandLineTemplate)"
OutputFile="%(Bison.OutputFile)"
DefinesFile="%(Bison.DefinesFile)"
Debug="%(Bison.Debug)"
Verbose="%(Bison.Verbose)"
NoLines="%(Bison.NoLines)"
FilePrefix="%(Bison.FilePrefix)"
GraphFile="%(Bison.GraphFile)"
Warnings="%(Bison.Warnings)"
Report="%(Bison.Report)"
ReportFile="%(Bison.ReportFile)"
AdditionalOptions="%(Bison.AdditionalOptions)"
Inputs="%(Bison.Identity)" />
</Target>
<PropertyGroup>
<ComputeLinkInputsTargets>
$(ComputeLinkInputsTargets);
ComputeBisonOutput;
</ComputeLinkInputsTargets>
<ComputeLibInputsTargets>
$(ComputeLibInputsTargets);
ComputeBisonOutput;
</ComputeLibInputsTargets>
</PropertyGroup>
<Target
Name="ComputeBisonOutput"
Condition="'@(Bison)' != ''">
<ItemGroup>
<BisonDirsToMake
Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
Include="%(Bison.Outputs)" />
<Link
Include="%(BisonDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<Lib
Include="%(BisonDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<ImpLib
Include="%(BisonDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
</ItemGroup>
<MakeDir
Directories="@(BisonDirsToMake-&gt;'%(RootDir)%(Directory)')" />
</Target>
</Project>

View file

@ -0,0 +1,281 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
<Rule
Name="Bison"
PageTemplate="tool"
DisplayName="Bison files"
SwitchPrefix="--"
Order="200">
<Rule.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Bison" />
</Rule.DataSource>
<Rule.Categories>
<Category
Name="General">
<Category.DisplayName>
<sys:String>General</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Bison Options">
<Category.DisplayName>
<sys:String>Bison Options</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Command Line"
Subtype="CommandLine">
<Category.DisplayName>
<sys:String>Command Line</sys:String>
</Category.DisplayName>
</Category>
</Rule.Categories>
<StringListProperty
Name="OutputFile"
Category="Bison Options"
IsRequired="true"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Output File Name"
Description="Specify the file for the parser implementation file. --output=value"
Switch="output=&quot;[value]&quot;"
/>
<StringListProperty
Name="DefinesFile"
Category="Bison Options"
Subtype="file"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Defines File Name"
Description="Pretend that %defines was specified, i.e., write an extra output file containing macro definitions for the token type names defined in the grammar, as well as a few other declarations. --defines=value"
Switch="defines=&quot;[value]&quot;"
/>
<BoolProperty
Name="Debug"
Category="Bison Options"
DisplayName="Debug"
Description="In the parser implementation file, define the macro YYDEBUG to 1 if it is not already defined, so that the debugging facilities are compiled. (--debug)"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Enabling-Traces.html#Enabling-Traces"
Switch="debug" />
<BoolProperty
Name="Verbose"
Category="Bison Options"
DisplayName="Verbose"
Description="Write an extra output file containing verbose descriptions of the parser states and what is done for each type of lookahead token in that state. (--verbose)"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Understanding.html#Understanding"
Switch="verbose" />
<BoolProperty
Name="NoLines"
Category="Bison Options"
DisplayName="No lines"
Description="Dont put any #line preprocessor commands in the parser implementation file. (--no-lines)"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
Switch="no-lines" />
<StringListProperty
Name="FilePrefix"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="File Prefix"
Description="Pretend that %file-prefix was specified, i.e., specify prefix to use for all Bison output file names. --file-prefix=prefix"
Switch="file-prefix=&quot;[value]&quot;"
/>
<StringListProperty
Name="GraphFile"
Category="Bison Options"
Subtype="file"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Graph File"
Description="Output a graphical representation of the parsers automaton computed by Bison, in Graphviz DOT format. --graph=file"
Switch="graph=&quot;[value]&quot;"
/>
<EnumProperty
Name="Warnings"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Warnings"
Description="Output warnings falling in category. (--warnings=category)">
<EnumValue
Name="midrule-values"
DisplayName="midrule-values"
Switch="warnings=midrule-values"/>
<EnumValue
Name="yacc"
DisplayName="yacc"
Switch="warnings=yacc"/>
<EnumValue
Name="conflicts-sr"
DisplayName="conflicts-sr"
Switch="warnings=conflicts-sr"/>
<EnumValue
Name="conflicts-rr"
DisplayName="conflicts-rr"
Switch="warnings=conflicts-rr"/>
<EnumValue
Name="other"
DisplayName="other"
Switch="warnings=other"/>
<EnumValue
Name="all"
DisplayName="all"
Switch="warnings=all"/>
<EnumValue
Name="none"
DisplayName="none"
Switch="warnings=none"/>
<EnumValue
Name="error"
DisplayName="error"
Switch="warnings=error"/>
</EnumProperty>
<EnumProperty
Name="Report"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Report"
Description="Write an extra output file containing verbose description of the comma separated list of things. (--report=things)">
<EnumValue
Name="state"
DisplayName="state"
Switch="report=state"/>
<EnumValue
Name="itemset"
DisplayName="itemset"
Switch="report=itemset"/>
<EnumValue
Name="lookahead"
DisplayName="lookahead"
Switch="report=lookahead"/>
<EnumValue
Name="solved"
DisplayName="solved"
Switch="report=solved"/>
<EnumValue
Name="all"
DisplayName="all"
Switch="report=all"/>
<EnumValue
Name="none"
DisplayName="none"
Switch="report=none"/>
</EnumProperty>
<StringListProperty
Name="ReportFile"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Report File Name"
Description="Specify the file for the verbose description. --report-file=value"
Switch="report-file=&quot;[value]&quot;"
/>
<StringListProperty
Name="Inputs"
Category="Command Line"
IsRequired="true"
Switch=" ">
<StringListProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Bison"
SourceType="Item" />
</StringListProperty.DataSource>
</StringListProperty>
<StringProperty
Name="CommandLineTemplate"
DisplayName="Command Line"
Visible="False"
IncludeInCommandLine="False" />
<DynamicEnumProperty
Name="BisonBeforeTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute Before</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^BisonBeforeTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<DynamicEnumProperty
Name="BisonAfterTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute After</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^BisonAfterTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType=""
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<StringListProperty
Name="Outputs"
DisplayName="Outputs"
Visible="False"
IncludeInCommandLine="False" />
<StringProperty
Name="ExecutionDescription"
DisplayName="Execution Description"
Visible="False"
IncludeInCommandLine="False" />
<StringListProperty
Name="AdditionalDependencies"
DisplayName="Additional Dependencies"
IncludeInCommandLine="False"
Visible="false" />
<StringProperty
Subtype="AdditionalOptions"
Name="AdditionalOptions"
Category="Command Line">
<StringProperty.DisplayName>
<sys:String>Additional Options</sys:String>
</StringProperty.DisplayName>
<StringProperty.Description>
<sys:String>Additional Options</sys:String>
</StringProperty.Description>
</StringProperty>
</Rule>
<ItemType
Name="Bison"
DisplayName="Bison files" />
<FileExtension
Name="*.y"
ContentType="Bison" />
<ContentType
Name="Bison"
DisplayName="Bison files"
ItemType="Bison" />
</ProjectSchemaDefinitions>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup
Condition="'$(BisonBeforeTargets)' == '' and '$(BisonAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<BisonBeforeTargets>Midl</BisonBeforeTargets>
<BisonAfterTargets>CustomBuild</BisonAfterTargets>
</PropertyGroup>
<PropertyGroup>
<BisonDependsOn
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(BisonDependsOn)</BisonDependsOn>
</PropertyGroup>
<ItemDefinitionGroup>
<Bison>
<OutputFile>%(Filename).tab.cpp</OutputFile>
<DefinesFile>%(Filename).tab.h</DefinesFile>
<CommandLineTemplate>
start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
exit /b %errorlevel%</CommandLineTemplate>
<Outputs>%(RootDir)%(Directory)%(OutputFile);%(RootDir)%(Directory)%(DefinesFile);</Outputs>
<ExecutionDescription>Process "%(Filename)%(Extension)" bison file</ExecutionDescription>
</Bison>
</ItemDefinitionGroup>
<PropertyGroup
Condition="'$(FlexBeforeTargets)' == '' and '$(FlexAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<FlexBeforeTargets>Midl</FlexBeforeTargets>
<FlexAfterTargets>CustomBuild</FlexAfterTargets>
</PropertyGroup>
<PropertyGroup>
<FlexDependsOn
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(FlexDependsOn)</FlexDependsOn>
</PropertyGroup>
<ItemDefinitionGroup>
<Flex>
<OutputFile>%(Filename).flex.cpp</OutputFile>
<Wincompat>true</Wincompat>
<CommandLineTemplate>
start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
exit /b %errorlevel%</CommandLineTemplate>
<Outputs>%(RootDir)%(Directory)%(OutputFile);</Outputs>
<ExecutionDescription>Process "%(Filename)%(Extension)" flex file</ExecutionDescription>
</Flex>
</ItemDefinitionGroup>
</Project>

View file

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName
Include="Bison">
<Targets>BisonTarget</Targets>
</AvailableItemName>
<AvailableItemName
Include="Flex">
<Targets>FlexTarget</Targets>
</AvailableItemName>
</ItemGroup>
<UsingTask
TaskName="Bison"
TaskFactory="XamlTaskFactory"
AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<UsingTask
TaskName="Flex"
TaskFactory="XamlTaskFactory"
AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<Target
Name="BisonTarget"
BeforeTargets="$(BisonBeforeTargets)"
AfterTargets="$(BisonAfterTargets)"
Condition="'@(Bison)' != ''"
DependsOnTargets="$(BisonDependsOn);ComputeBisonOutput"
Outputs="%(Bison.Outputs)"
Inputs="%(Bison.Identity);%(Bison.AdditionalDependencies);$(MSBuildProjectFile)">
<ItemGroup
Condition="'@(SelectedFiles)' != ''">
<Bison
Remove="@(Bison)"
Condition="'%(Identity)' != '@(SelectedFiles)'" />
</ItemGroup>
<ItemGroup>
<Bison_tlog
Include="%(Bison.Outputs)"
Condition="'%(Bison.Outputs)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'">
<Source>@(Bison, '|')</Source>
</Bison_tlog>
</ItemGroup>
<Message
Importance="High"
Text="%(Bison.ExecutionDescription)" />
<WriteLinesToFile
Condition="'@(Bison_tlog)' != '' and '%(Bison_tlog.ExcludedFromBuild)' != 'true'"
File="$(IntDir)$(ProjectName).write.1.tlog"
Lines="^%(Bison_tlog.Source);@(Bison_tlog-&gt;'%(Fullpath)')" />
<Bison
Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
CommandLineTemplate="%(Bison.CommandLineTemplate)"
OutputFile="%(Bison.OutputFile)"
DefinesFile="%(Bison.DefinesFile)"
Debug="%(Bison.Debug)"
Verbose="%(Bison.Verbose)"
NoLines="%(Bison.NoLines)"
FilePrefix="%(Bison.FilePrefix)"
GraphFile="%(Bison.GraphFile)"
Warnings="%(Bison.Warnings)"
Report="%(Bison.Report)"
ReportFile="%(Bison.ReportFile)"
AdditionalOptions="%(Bison.AdditionalOptions)"
Inputs="%(Bison.Identity)" />
</Target>
<PropertyGroup>
<ComputeLinkInputsTargets>
$(ComputeLinkInputsTargets);
ComputeBisonOutput;
</ComputeLinkInputsTargets>
<ComputeLibInputsTargets>
$(ComputeLibInputsTargets);
ComputeBisonOutput;
</ComputeLibInputsTargets>
</PropertyGroup>
<Target
Name="ComputeBisonOutput"
Condition="'@(Bison)' != ''">
<ItemGroup>
<BisonDirsToMake
Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
Include="%(Bison.Outputs)" />
<Link
Include="%(BisonDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<Lib
Include="%(BisonDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<ImpLib
Include="%(BisonDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
</ItemGroup>
<MakeDir
Directories="@(BisonDirsToMake-&gt;'%(RootDir)%(Directory)')" />
</Target>
<Target
Name="FlexTarget"
BeforeTargets="$(FlexBeforeTargets)"
AfterTargets="$(FlexAfterTargets)"
Condition="'@(Flex)' != ''"
DependsOnTargets="$(FlexDependsOn);ComputeFlexOutput"
Outputs="%(Flex.Outputs)"
Inputs="%(Flex.Identity);%(Flex.AdditionalDependencies);$(MSBuildProjectFile)">
<ItemGroup
Condition="'@(SelectedFiles)' != ''">
<Flex
Remove="@(Flex)"
Condition="'%(Identity)' != '@(SelectedFiles)'" />
</ItemGroup>
<ItemGroup>
<Flex_tlog
Include="%(Flex.Outputs)"
Condition="'%(Flex.Outputs)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'">
<Source>@(Flex, '|')</Source>
</Flex_tlog>
</ItemGroup>
<Message
Importance="High"
Text="%(Flex.ExecutionDescription)" />
<WriteLinesToFile
Condition="'@(Flex_tlog)' != '' and '%(Flex_tlog.ExcludedFromBuild)' != 'true'"
File="$(IntDir)$(ProjectName).write.1.tlog"
Lines="^%(Flex_tlog.Source);@(Flex_tlog-&gt;'%(Fullpath)')" />
<Flex
Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
CommandLineTemplate="%(Flex.CommandLineTemplate)"
OutputFile="%(Flex.OutputFile)"
HeaderFile="%(Flex.HeaderFile)"
Prefix="%(Flex.Prefix)"
Wincompat="%(Flex.Wincompat)"
CaseInsensitive="%(Flex.CaseInsensitive)"
LexCompat="%(Flex.LexCompat)"
Stack="%(Flex.Stack)"
BisonBridge="%(Flex.BisonBridge)"
Noline="%(Flex.Noline)"
Reentrant="%(Flex.Reentrant)"
Cpp="%(Flex.Cpp)"
CppClassName="%(Flex.CppClassName)"
Debug="%(Flex.Debug)"
AdditionalOptions="%(Flex.AdditionalOptions)"
Inputs="%(Flex.Identity)" />
</Target>
<PropertyGroup>
<ComputeLinkInputsTargets>
$(ComputeLinkInputsTargets);
ComputeFlexOutput;
</ComputeLinkInputsTargets>
<ComputeLibInputsTargets>
$(ComputeLibInputsTargets);
ComputeFlexOutput;
</ComputeLibInputsTargets>
</PropertyGroup>
<Target
Name="ComputeFlexOutput"
Condition="'@(Flex)' != ''">
<ItemGroup>
<FlexDirsToMake
Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
Include="%(Flex.Outputs)" />
<Link
Include="%(FlexDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<Lib
Include="%(FlexDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<ImpLib
Include="%(FlexDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
</ItemGroup>
<MakeDir
Directories="@(FlexDirsToMake-&gt;'%(RootDir)%(Directory)')" />
</Target>
</Project>

View file

@ -0,0 +1,521 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
<Rule
Name="Bison"
PageTemplate="tool"
DisplayName="Bison files"
SwitchPrefix="--"
Order="200">
<Rule.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Bison" />
</Rule.DataSource>
<Rule.Categories>
<Category
Name="General">
<Category.DisplayName>
<sys:String>General</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Bison Options">
<Category.DisplayName>
<sys:String>Bison Options</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Command Line"
Subtype="CommandLine">
<Category.DisplayName>
<sys:String>Command Line</sys:String>
</Category.DisplayName>
</Category>
</Rule.Categories>
<StringListProperty
Name="OutputFile"
Category="Bison Options"
IsRequired="true"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Output File Name"
Description="Specify the file for the parser implementation file. --output=value"
Switch="output=&quot;[value]&quot;"
/>
<StringListProperty
Name="DefinesFile"
Category="Bison Options"
Subtype="file"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Defines File Name"
Description="Pretend that %defines was specified, i.e., write an extra output file containing macro definitions for the token type names defined in the grammar, as well as a few other declarations. --defines=value"
Switch="defines=&quot;[value]&quot;"
/>
<BoolProperty
Name="Debug"
Category="Bison Options"
DisplayName="Debug"
Description="In the parser implementation file, define the macro YYDEBUG to 1 if it is not already defined, so that the debugging facilities are compiled. (--debug)"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Enabling-Traces.html#Enabling-Traces"
Switch="debug" />
<BoolProperty
Name="Verbose"
Category="Bison Options"
DisplayName="Verbose"
Description="Write an extra output file containing verbose descriptions of the parser states and what is done for each type of lookahead token in that state. (--verbose)"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Understanding.html#Understanding"
Switch="verbose" />
<BoolProperty
Name="NoLines"
Category="Bison Options"
DisplayName="No lines"
Description="Dont put any #line preprocessor commands in the parser implementation file. (--no-lines)"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
Switch="no-lines" />
<StringListProperty
Name="FilePrefix"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="File Prefix"
Description="Pretend that %file-prefix was specified, i.e., specify prefix to use for all Bison output file names. --file-prefix=prefix"
Switch="file-prefix=&quot;[value]&quot;"
/>
<StringListProperty
Name="GraphFile"
Category="Bison Options"
Subtype="file"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Graph File"
Description="Output a graphical representation of the parsers automaton computed by Bison, in Graphviz DOT format. --graph=file"
Switch="graph=&quot;[value]&quot;"
/>
<EnumProperty
Name="Warnings"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Warnings"
Description="Output warnings falling in category. (--warnings=category)">
<EnumValue
Name="midrule-values"
DisplayName="midrule-values"
Switch="warnings=midrule-values"/>
<EnumValue
Name="yacc"
DisplayName="yacc"
Switch="warnings=yacc"/>
<EnumValue
Name="conflicts-sr"
DisplayName="conflicts-sr"
Switch="warnings=conflicts-sr"/>
<EnumValue
Name="conflicts-rr"
DisplayName="conflicts-rr"
Switch="warnings=conflicts-rr"/>
<EnumValue
Name="other"
DisplayName="other"
Switch="warnings=other"/>
<EnumValue
Name="all"
DisplayName="all"
Switch="warnings=all"/>
<EnumValue
Name="none"
DisplayName="none"
Switch="warnings=none"/>
<EnumValue
Name="error"
DisplayName="error"
Switch="warnings=error"/>
</EnumProperty>
<EnumProperty
Name="Report"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Report"
Description="Write an extra output file containing verbose description of the comma separated list of things. (--report=things)">
<EnumValue
Name="state"
DisplayName="state"
Switch="report=state"/>
<EnumValue
Name="itemset"
DisplayName="itemset"
Switch="report=itemset"/>
<EnumValue
Name="lookahead"
DisplayName="lookahead"
Switch="report=lookahead"/>
<EnumValue
Name="solved"
DisplayName="solved"
Switch="report=solved"/>
<EnumValue
Name="all"
DisplayName="all"
Switch="report=all"/>
<EnumValue
Name="none"
DisplayName="none"
Switch="report=none"/>
</EnumProperty>
<StringListProperty
Name="ReportFile"
Category="Bison Options"
HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
DisplayName="Report File Name"
Description="Specify the file for the verbose description. --report-file=value"
Switch="report-file=&quot;[value]&quot;"
/>
<StringListProperty
Name="Inputs"
Category="Command Line"
IsRequired="true"
Switch=" ">
<StringListProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Bison"
SourceType="Item" />
</StringListProperty.DataSource>
</StringListProperty>
<StringProperty
Name="CommandLineTemplate"
DisplayName="Command Line"
Visible="False"
IncludeInCommandLine="False" />
<DynamicEnumProperty
Name="BisonBeforeTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute Before</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^BisonBeforeTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<DynamicEnumProperty
Name="BisonAfterTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute After</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^BisonAfterTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType=""
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<StringListProperty
Name="Outputs"
DisplayName="Outputs"
Visible="False"
IncludeInCommandLine="False" />
<StringProperty
Name="ExecutionDescription"
DisplayName="Execution Description"
Visible="False"
IncludeInCommandLine="False" />
<StringListProperty
Name="AdditionalDependencies"
DisplayName="Additional Dependencies"
IncludeInCommandLine="False"
Visible="false" />
<StringProperty
Subtype="AdditionalOptions"
Name="AdditionalOptions"
Category="Command Line">
<StringProperty.DisplayName>
<sys:String>Additional Options</sys:String>
</StringProperty.DisplayName>
<StringProperty.Description>
<sys:String>Additional Options</sys:String>
</StringProperty.Description>
</StringProperty>
</Rule>
<ItemType
Name="Bison"
DisplayName="Bison files" />
<FileExtension
Name="*.y"
ContentType="Bison" />
<ContentType
Name="Bison"
DisplayName="Bison files"
ItemType="Bison" />
<Rule
Name="Flex"
PageTemplate="tool"
DisplayName="Flex files"
SwitchPrefix="--"
Order="200">
<Rule.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Flex" />
</Rule.DataSource>
<Rule.Categories>
<Category
Name="General">
<Category.DisplayName>
<sys:String>General</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Flex Options">
<Category.DisplayName>
<sys:String>Flex Options</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Command Line"
Subtype="CommandLine">
<Category.DisplayName>
<sys:String>Command Line</sys:String>
</Category.DisplayName>
</Category>
</Rule.Categories>
<StringListProperty
Name="OutputFile"
Category="Flex Options"
IsRequired="true"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="Output File Name"
Description="Directs flex to write the scanner to the file FILE instead of lex.yy.c. --outfile=value"
Switch="outfile=&quot;[value]&quot;"
/>
<StringListProperty
Name="HeaderFile"
Category="Flex Options"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="Header File Name"
Description="Instructs flex to write a C header to FILE. This file contains function prototypes, extern variables, and types used by the scanner. Only the external API is exported by the header file. (--header-file=value)"
Switch="header-file=&quot;[value]&quot;"
/>
<StringListProperty
Name="Prefix"
Category="Flex Options"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="Prefix"
Description="Changes the default yy prefix used by flex for all globally-visible variable and function names to instead be PREFIX. For example, --prefix=foo changes the name of yytext to footext. It also changes the name of the default output file from lex.yy.c to lex.foo.c. (--prefix=value)"
Switch="prefix=&quot;[value]&quot;"
/>
<BoolProperty
Name="Wincompat"
Category="Flex Options"
DisplayName="Windows compatibility mode"
Description="This option changes 'unistd.h' unix header with windows analog 'io.h' and replaces isatty/fileno functions to safe windows analogs _isatty/_fileno. (--wincompat)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="wincompat" />
<BoolProperty
Name="CaseInsensitive"
Category="Flex Options"
DisplayName="Case-insensitive mode"
Description="Instructs flex to generate a case-insensitive scanner. The case of letters given in the flex input patterns will be ignored, and tokens in the input will be matched regardless of case. The matched text given in yytext will have the preserved case (i.e., it will not be folded). (--case-insensitive)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="case-insensitive" />
<BoolProperty
Name="LexCompat"
Category="Flex Options"
DisplayName="Lex-compatibility mode"
Description="Turns on maximum compatibility with the original AT&amp;T lex implementation. Note that this does not mean full compatibility. Use of this option costs a considerable amount of performance, and it cannot be used with the --c++, --full, --fast, -Cf, or -CF options. (--lex-compat)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="lex-compat" />
<BoolProperty
Name="Stack"
Category="Flex Options"
DisplayName="Start Condition Stacks"
Description="Enables the use of start condition stacks. (--stack)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="stack" />
<BoolProperty
Name="BisonBridge"
Category="Flex Options"
DisplayName="Bison Bridge Mode"
Description="Instructs flex to generate a C scanner that is meant to be called by a GNU bison parser. The scanner has minor API changes for bison compatibility. In particular, the declaration of yylex is modified to take an additional parameter, yylval. (--bison-bridge)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="bison-bridge" />
<BoolProperty
Name="Noline"
Category="Flex Options"
DisplayName="No #line Directives"
Description="Instructs flex not to generate #line directives. (--noline)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="noline" />
<BoolProperty
Name="Reentrant"
Category="Flex Options"
DisplayName="Generate Reentrant Scanner"
Description="Instructs flex to generate a reentrant C scanner. The generated scanner may safely be used in a multi-threaded environment. The API for a reentrant scanner is different than for a non-reentrant scanner. (--reentrant)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="reentrant" />
<BoolProperty
Name="Cpp"
Category="Flex Options"
DisplayName="Generate C++ Scanner"
Description="Specifies that you want flex to generate a C++ scanner class. (--c++)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="c++" />
<StringListProperty
Name="CppClassName"
Category="Flex Options"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="C++ Class Name"
Description="Only applies when generating a C++ scanner (the --c++ option). It informs flex that you have derived NAME as a subclass of yyFlexLexer, so flex will place your actions in the member function foo::yylex() instead of yyFlexLexer::yylex(). It also generates a yyFlexLexer::yylex() member function that emits a run-time error (by invoking yyFlexLexer::LexerError()) if called. (--yyclass=value)"
Switch="yyclass=&quot;[value]&quot;" />
<BoolProperty
Name="Debug"
Category="Flex Options"
DisplayName="Debug Mode"
Description="Makes the generated scanner run in debug mode. Whenever a pattern is recognized and the global variable yy_flex_debug is non-zero (which is the default), the scanner will write to stderr a line of the form: -accepting rule at line 53 ('the matched text'). (--debug)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="debug" />
<StringListProperty
Name="Inputs"
Category="Command Line"
IsRequired="true"
Switch=" ">
<StringListProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Flex"
SourceType="Item" />
</StringListProperty.DataSource>
</StringListProperty>
<StringProperty
Name="CommandLineTemplate"
DisplayName="Command Line"
Visible="False"
IncludeInCommandLine="False" />
<DynamicEnumProperty
Name="FlexBeforeTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute Before</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^FlexBeforeTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<DynamicEnumProperty
Name="FlexAfterTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute After</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^FlexAfterTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType=""
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<StringListProperty
Name="Outputs"
DisplayName="Outputs"
Visible="False"
IncludeInCommandLine="False" />
<StringProperty
Name="ExecutionDescription"
DisplayName="Execution Description"
Visible="False"
IncludeInCommandLine="False" />
<StringListProperty
Name="AdditionalDependencies"
DisplayName="Additional Dependencies"
IncludeInCommandLine="False"
Visible="false" />
<StringProperty
Subtype="AdditionalOptions"
Name="AdditionalOptions"
Category="Command Line">
<StringProperty.DisplayName>
<sys:String>Additional Options</sys:String>
</StringProperty.DisplayName>
<StringProperty.Description>
<sys:String>Additional Options</sys:String>
</StringProperty.Description>
</StringProperty>
</Rule>
<ItemType
Name="Flex"
DisplayName="Flex files" />
<FileExtension
Name="*.l"
ContentType="Flex" />
<ContentType
Name="Flex"
DisplayName="Flex files"
ItemType="Flex" />
</ProjectSchemaDefinitions>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup
Condition="'$(FlexBeforeTargets)' == '' and '$(FlexAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<FlexBeforeTargets>Midl</FlexBeforeTargets>
<FlexAfterTargets>CustomBuild</FlexAfterTargets>
</PropertyGroup>
<PropertyGroup>
<FlexDependsOn
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(FlexDependsOn)</FlexDependsOn>
</PropertyGroup>
<ItemDefinitionGroup>
<Flex>
<OutputFile>%(Filename).flex.cpp</OutputFile>
<Wincompat>true</Wincompat>
<CommandLineTemplate>
start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
exit /b %errorlevel%</CommandLineTemplate>
<Outputs>%(RootDir)%(Directory)%(OutputFile);</Outputs>
<ExecutionDescription>Process "%(Filename)%(Extension)" flex file</ExecutionDescription>
</Flex>
</ItemDefinitionGroup>
</Project>

View file

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName
Include="Flex">
<Targets>FlexTarget</Targets>
</AvailableItemName>
</ItemGroup>
<UsingTask
TaskName="Flex"
TaskFactory="XamlTaskFactory"
AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<Target
Name="FlexTarget"
BeforeTargets="$(FlexBeforeTargets)"
AfterTargets="$(FlexAfterTargets)"
Condition="'@(Flex)' != ''"
DependsOnTargets="$(FlexDependsOn);ComputeFlexOutput"
Outputs="%(Flex.Outputs)"
Inputs="%(Flex.Identity);%(Flex.AdditionalDependencies);$(MSBuildProjectFile)">
<ItemGroup
Condition="'@(SelectedFiles)' != ''">
<Flex
Remove="@(Flex)"
Condition="'%(Identity)' != '@(SelectedFiles)'" />
</ItemGroup>
<ItemGroup>
<Flex_tlog
Include="%(Flex.Outputs)"
Condition="'%(Flex.Outputs)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'">
<Source>@(Flex, '|')</Source>
</Flex_tlog>
</ItemGroup>
<Message
Importance="High"
Text="%(Flex.ExecutionDescription)" />
<WriteLinesToFile
Condition="'@(Flex_tlog)' != '' and '%(Flex_tlog.ExcludedFromBuild)' != 'true'"
File="$(IntDir)$(ProjectName).write.1.tlog"
Lines="^%(Flex_tlog.Source);@(Flex_tlog-&gt;'%(Fullpath)')" />
<Flex
Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
CommandLineTemplate="%(Flex.CommandLineTemplate)"
OutputFile="%(Flex.OutputFile)"
HeaderFile="%(Flex.HeaderFile)"
Prefix="%(Flex.Prefix)"
Wincompat="%(Flex.Wincompat)"
CaseInsensitive="%(Flex.CaseInsensitive)"
LexCompat="%(Flex.LexCompat)"
Stack="%(Flex.Stack)"
BisonBridge="%(Flex.BisonBridge)"
Noline="%(Flex.Noline)"
Reentrant="%(Flex.Reentrant)"
Cpp="%(Flex.Cpp)"
CppClassName="%(Flex.CppClassName)"
Debug="%(Flex.Debug)"
AdditionalOptions="%(Flex.AdditionalOptions)"
Inputs="%(Flex.Identity)" />
</Target>
<PropertyGroup>
<ComputeLinkInputsTargets>
$(ComputeLinkInputsTargets);
ComputeFlexOutput;
</ComputeLinkInputsTargets>
<ComputeLibInputsTargets>
$(ComputeLibInputsTargets);
ComputeFlexOutput;
</ComputeLibInputsTargets>
</PropertyGroup>
<Target
Name="ComputeFlexOutput"
Condition="'@(Flex)' != ''">
<ItemGroup>
<FlexDirsToMake
Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
Include="%(Flex.Outputs)" />
<Link
Include="%(FlexDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<Lib
Include="%(FlexDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
<ImpLib
Include="%(FlexDirsToMake.Identity)"
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
</ItemGroup>
<MakeDir
Directories="@(FlexDirsToMake-&gt;'%(RootDir)%(Directory)')" />
</Target>
</Project>

View file

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
<Rule
Name="Flex"
PageTemplate="tool"
DisplayName="Flex files"
SwitchPrefix="--"
Order="200">
<Rule.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Flex" />
</Rule.DataSource>
<Rule.Categories>
<Category
Name="General">
<Category.DisplayName>
<sys:String>General</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Flex Options">
<Category.DisplayName>
<sys:String>Flex Options</sys:String>
</Category.DisplayName>
</Category>
<Category
Name="Command Line"
Subtype="CommandLine">
<Category.DisplayName>
<sys:String>Command Line</sys:String>
</Category.DisplayName>
</Category>
</Rule.Categories>
<StringListProperty
Name="OutputFile"
Category="Flex Options"
IsRequired="true"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="Output File Name"
Description="Directs flex to write the scanner to the file FILE instead of lex.yy.c. --outfile=value"
Switch="outfile=&quot;[value]&quot;"
/>
<StringListProperty
Name="HeaderFile"
Category="Flex Options"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="Header File Name"
Description="Instructs flex to write a C header to FILE. This file contains function prototypes, extern variables, and types used by the scanner. Only the external API is exported by the header file. (--header-file=value)"
Switch="header-file=&quot;[value]&quot;"
/>
<StringListProperty
Name="Prefix"
Category="Flex Options"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="Prefix"
Description="Changes the default yy prefix used by flex for all globally-visible variable and function names to instead be PREFIX. For example, --prefix=foo changes the name of yytext to footext. It also changes the name of the default output file from lex.yy.c to lex.foo.c. (--prefix=value)"
Switch="prefix=&quot;[value]&quot;"
/>
<BoolProperty
Name="Wincompat"
Category="Flex Options"
DisplayName="Windows compatibility mode"
Description="This option changes 'unistd.h' unix header with windows analog 'io.h' and replaces isatty/fileno functions to safe windows analogs _isatty/_fileno. (--wincompat)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="wincompat" />
<BoolProperty
Name="CaseInsensitive"
Category="Flex Options"
DisplayName="Case-insensitive mode"
Description="Instructs flex to generate a case-insensitive scanner. The case of letters given in the flex input patterns will be ignored, and tokens in the input will be matched regardless of case. The matched text given in yytext will have the preserved case (i.e., it will not be folded). (--case-insensitive)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="case-insensitive" />
<BoolProperty
Name="LexCompat"
Category="Flex Options"
DisplayName="Lex-compatibility mode"
Description="Turns on maximum compatibility with the original AT&amp;T lex implementation. Note that this does not mean full compatibility. Use of this option costs a considerable amount of performance, and it cannot be used with the --c++, --full, --fast, -Cf, or -CF options. (--lex-compat)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="lex-compat" />
<BoolProperty
Name="Stack"
Category="Flex Options"
DisplayName="Start Condition Stacks"
Description="Enables the use of start condition stacks. (--stack)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="stack" />
<BoolProperty
Name="BisonBridge"
Category="Flex Options"
DisplayName="Bison Bridge Mode"
Description="Instructs flex to generate a C scanner that is meant to be called by a GNU bison parser. The scanner has minor API changes for bison compatibility. In particular, the declaration of yylex is modified to take an additional parameter, yylval. (--bison-bridge)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="bison-bridge" />
<BoolProperty
Name="Noline"
Category="Flex Options"
DisplayName="No #line Directives"
Description="Instructs flex not to generate #line directives. (--noline)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="noline" />
<BoolProperty
Name="Reentrant"
Category="Flex Options"
DisplayName="Generate Reentrant Scanner"
Description="Instructs flex to generate a reentrant C scanner. The generated scanner may safely be used in a multi-threaded environment. The API for a reentrant scanner is different than for a non-reentrant scanner. (--reentrant)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="reentrant" />
<BoolProperty
Name="Cpp"
Category="Flex Options"
DisplayName="Generate C++ Scanner"
Description="Specifies that you want flex to generate a C++ scanner class. (--c++)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="c++" />
<StringListProperty
Name="CppClassName"
Category="Flex Options"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
DisplayName="C++ Class Name"
Description="Only applies when generating a C++ scanner (the --c++ option). It informs flex that you have derived NAME as a subclass of yyFlexLexer, so flex will place your actions in the member function foo::yylex() instead of yyFlexLexer::yylex(). It also generates a yyFlexLexer::yylex() member function that emits a run-time error (by invoking yyFlexLexer::LexerError()) if called. (--yyclass=value)"
Switch="yyclass=&quot;[value]&quot;" />
<BoolProperty
Name="Debug"
Category="Flex Options"
DisplayName="Debug Mode"
Description="Makes the generated scanner run in debug mode. Whenever a pattern is recognized and the global variable yy_flex_debug is non-zero (which is the default), the scanner will write to stderr a line of the form: -accepting rule at line 53 ('the matched text'). (--debug)"
HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
Switch="debug" />
<StringListProperty
Name="Inputs"
Category="Command Line"
IsRequired="true"
Switch=" ">
<StringListProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType="Flex"
SourceType="Item" />
</StringListProperty.DataSource>
</StringListProperty>
<StringProperty
Name="CommandLineTemplate"
DisplayName="Command Line"
Visible="False"
IncludeInCommandLine="False" />
<DynamicEnumProperty
Name="FlexBeforeTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute Before</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^FlexBeforeTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<DynamicEnumProperty
Name="FlexAfterTargets"
Category="General"
EnumProvider="Targets"
IncludeInCommandLine="False">
<DynamicEnumProperty.DisplayName>
<sys:String>Execute After</sys:String>
</DynamicEnumProperty.DisplayName>
<DynamicEnumProperty.Description>
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
</DynamicEnumProperty.Description>
<DynamicEnumProperty.ProviderSettings>
<NameValuePair
Name="Exclude"
Value="^FlexAfterTargets|^Compute" />
</DynamicEnumProperty.ProviderSettings>
<DynamicEnumProperty.DataSource>
<DataSource
Persistence="ProjectFile"
ItemType=""
HasConfigurationCondition="true" />
</DynamicEnumProperty.DataSource>
</DynamicEnumProperty>
<StringListProperty
Name="Outputs"
DisplayName="Outputs"
Visible="False"
IncludeInCommandLine="False" />
<StringProperty
Name="ExecutionDescription"
DisplayName="Execution Description"
Visible="False"
IncludeInCommandLine="False" />
<StringListProperty
Name="AdditionalDependencies"
DisplayName="Additional Dependencies"
IncludeInCommandLine="False"
Visible="false" />
<StringProperty
Subtype="AdditionalOptions"
Name="AdditionalOptions"
Category="Command Line">
<StringProperty.DisplayName>
<sys:String>Additional Options</sys:String>
</StringProperty.DisplayName>
<StringProperty.Description>
<sys:String>Additional Options</sys:String>
</StringProperty.Description>
</StringProperty>
</Rule>
<ItemType
Name="Flex"
DisplayName="Flex files" />
<FileExtension
Name="*.l"
ContentType="Flex" />
<ContentType
Name="Flex"
DisplayName="Flex files"
ItemType="Flex" />
</ProjectSchemaDefinitions>