Compare commits

...

2 Commits

3
.gitmodules vendored

@ -1,9 +1,6 @@
[submodule "dependencies/vmprofiler"]
path = dependencies/vmprofiler
url = https://githacks.org/vmp2/vmprofiler.git
[submodule "dependencies/xtils"]
path = dependencies/xtils
url = https://githacks.org/_xeroxz/xtils.git
[submodule "dependencies/cli-parser"]
path = dependencies/cli-parser
url = https://githacks.org/_xeroxz/cli-parser.git

@ -0,0 +1,162 @@
include_guard()
# Change these defaults to point to your infrastructure if desired
set(CMKR_REPO "https://github.com/build-cpp/cmkr" CACHE STRING "cmkr git repository" FORCE)
set(CMKR_TAG "archive_264e4ace" CACHE STRING "cmkr git tag (this needs to be available forever)" FORCE)
# Set these from the command line to customize for development/debugging purposes
set(CMKR_EXECUTABLE "" CACHE FILEPATH "cmkr executable")
set(CMKR_SKIP_GENERATION OFF CACHE BOOL "skip automatic cmkr generation")
# Disable cmkr if generation is disabled
if(DEFINED ENV{CI} OR CMKR_SKIP_GENERATION)
message(STATUS "[cmkr] Skipping automatic cmkr generation")
macro(cmkr)
endmacro()
return()
endif()
# Disable cmkr if no cmake.toml file is found
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml")
message(AUTHOR_WARNING "[cmkr] Not found: ${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml")
macro(cmkr)
endmacro()
return()
endif()
# Convert a Windows native path to CMake path
if(CMKR_EXECUTABLE MATCHES "\\\\")
string(REPLACE "\\" "/" CMKR_EXECUTABLE_CMAKE "${CMKR_EXECUTABLE}")
set(CMKR_EXECUTABLE "${CMKR_EXECUTABLE_CMAKE}" CACHE FILEPATH "" FORCE)
unset(CMKR_EXECUTABLE_CMAKE)
endif()
# Helper macro to execute a process (COMMAND_ERROR_IS_FATAL ANY is 3.19 and higher)
function(cmkr_exec)
execute_process(COMMAND ${ARGV} RESULT_VARIABLE CMKR_EXEC_RESULT)
if(NOT CMKR_EXEC_RESULT EQUAL 0)
message(FATAL_ERROR "cmkr_exec(${ARGV}) failed (exit code ${CMKR_EXEC_RESULT})")
endif()
endfunction()
# Windows-specific hack (CMAKE_EXECUTABLE_PREFIX is not set at the moment)
if(WIN32)
set(CMKR_EXECUTABLE_NAME "cmkr.exe")
else()
set(CMKR_EXECUTABLE_NAME "cmkr")
endif()
# Use cached cmkr if found
set(CMKR_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_cmkr_${CMKR_TAG}")
set(CMKR_CACHED_EXECUTABLE "${CMKR_DIRECTORY}/bin/${CMKR_EXECUTABLE_NAME}")
if(NOT CMKR_CACHED_EXECUTABLE STREQUAL CMKR_EXECUTABLE AND CMKR_EXECUTABLE MATCHES "^${CMAKE_CURRENT_BINARY_DIR}/_cmkr")
message(AUTHOR_WARNING "[cmkr] Upgrading '${CMKR_EXECUTABLE}' to '${CMKR_CACHED_EXECUTABLE}'")
unset(CMKR_EXECUTABLE CACHE)
endif()
if(CMKR_EXECUTABLE AND EXISTS "${CMKR_EXECUTABLE}")
message(VERBOSE "[cmkr] Found cmkr: '${CMKR_EXECUTABLE}'")
elseif(CMKR_EXECUTABLE AND NOT CMKR_EXECUTABLE STREQUAL CMKR_CACHED_EXECUTABLE)
message(FATAL_ERROR "[cmkr] '${CMKR_EXECUTABLE}' not found")
else()
set(CMKR_EXECUTABLE "${CMKR_CACHED_EXECUTABLE}" CACHE FILEPATH "Full path to cmkr executable" FORCE)
message(VERBOSE "[cmkr] Bootstrapping '${CMKR_EXECUTABLE}'")
message(STATUS "[cmkr] Fetching cmkr...")
if(EXISTS "${CMKR_DIRECTORY}")
cmkr_exec("${CMAKE_COMMAND}" -E rm -rf "${CMKR_DIRECTORY}")
endif()
find_package(Git QUIET REQUIRED)
cmkr_exec("${GIT_EXECUTABLE}"
clone
--config advice.detachedHead=false
--branch ${CMKR_TAG}
--depth 1
${CMKR_REPO}
"${CMKR_DIRECTORY}"
)
message(STATUS "[cmkr] Building cmkr...")
cmkr_exec("${CMAKE_COMMAND}"
--no-warn-unused-cli
"${CMKR_DIRECTORY}"
"-B${CMKR_DIRECTORY}/build"
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_INSTALL_PREFIX=${CMKR_DIRECTORY}"
"-DCMKR_GENERATE_DOCUMENTATION=OFF"
)
cmkr_exec("${CMAKE_COMMAND}"
--build "${CMKR_DIRECTORY}/build"
--config Release
--parallel
)
cmkr_exec("${CMAKE_COMMAND}"
--install "${CMKR_DIRECTORY}/build"
--config Release
--prefix "${CMKR_DIRECTORY}"
--component cmkr
)
if(NOT EXISTS ${CMKR_EXECUTABLE})
message(FATAL_ERROR "[cmkr] Failed to bootstrap '${CMKR_EXECUTABLE}'")
endif()
cmkr_exec("${CMKR_EXECUTABLE}" version)
message(STATUS "[cmkr] Bootstrapped ${CMKR_EXECUTABLE}")
endif()
execute_process(COMMAND "${CMKR_EXECUTABLE}" version
RESULT_VARIABLE CMKR_EXEC_RESULT
)
if(NOT CMKR_EXEC_RESULT EQUAL 0)
message(FATAL_ERROR "[cmkr] Failed to get version, try clearing the cache and rebuilding")
endif()
# This is the macro that contains black magic
macro(cmkr)
# When this macro is called from the generated file, fake some internal CMake variables
get_source_file_property(CMKR_CURRENT_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}" CMKR_CURRENT_LIST_FILE)
if(CMKR_CURRENT_LIST_FILE)
set(CMAKE_CURRENT_LIST_FILE "${CMKR_CURRENT_LIST_FILE}")
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
endif()
# File-based include guard (include_guard is not documented to work)
get_source_file_property(CMKR_INCLUDE_GUARD "${CMAKE_CURRENT_LIST_FILE}" CMKR_INCLUDE_GUARD)
if(NOT CMKR_INCLUDE_GUARD)
set_source_files_properties("${CMAKE_CURRENT_LIST_FILE}" PROPERTIES CMKR_INCLUDE_GUARD TRUE)
file(SHA256 "${CMAKE_CURRENT_LIST_FILE}" CMKR_LIST_FILE_SHA256_PRE)
# Generate CMakeLists.txt
cmkr_exec("${CMKR_EXECUTABLE}" gen
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
file(SHA256 "${CMAKE_CURRENT_LIST_FILE}" CMKR_LIST_FILE_SHA256_POST)
# Delete the temporary file if it was left for some reason
set(CMKR_TEMP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMakerLists.txt")
if(EXISTS "${CMKR_TEMP_FILE}")
file(REMOVE "${CMKR_TEMP_FILE}")
endif()
if(NOT CMKR_LIST_FILE_SHA256_PRE STREQUAL CMKR_LIST_FILE_SHA256_POST)
# Copy the now-generated CMakeLists.txt to CMakerLists.txt
# This is done because you cannot include() a file you are currently in
configure_file(CMakeLists.txt "${CMKR_TEMP_FILE}" COPYONLY)
# Add the macro required for the hack at the start of the cmkr macro
set_source_files_properties("${CMKR_TEMP_FILE}" PROPERTIES
CMKR_CURRENT_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}"
)
# 'Execute' the newly-generated CMakeLists.txt
include("${CMKR_TEMP_FILE}")
# Delete the generated file
file(REMOVE "${CMKR_TEMP_FILE}")
# Do not execute the rest of the original CMakeLists.txt
return()
endif()
# Resume executing the unmodified CMakeLists.txt
endif()
endmacro()

@ -1,155 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{1dc5c971-7d10-488d-a4bf-8702fa804559}</ProjectGuid>
<RootNamespace>demo</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>ClangCL</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="test.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\.clang-format" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="test.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\.clang-format">
<Filter>Header Files</Filter>
</None>
</ItemGroup>
</Project>

@ -1 +1 @@
Subproject commit 0f6ba9bad30d67f25f01b6c1e872077efdff61d4
Subproject commit d3eb282a5b902485a3e4dccf41ecb8d8e8fe4024

@ -1 +0,0 @@
Subproject commit 7c32517322c29a866cbb1e67fb9051efa2e05553

@ -1,52 +1,54 @@
#pragma once
#include <fstream>
#include <vmprofiler.hpp>
#include <xtils.hpp>
#include "compiler.h"
namespace gen
{
/// <summary>
/// function pasted from https://stackoverflow.com/questions/2342162/stdstring-formatting-like-sprintf
/// </summary>
/// <typeparam name="...Args"></typeparam>
/// <param name="format"></param>
/// <param name="...args"></param>
/// <returns></returns>
template < typename... Args > std::string string_format( const std::string &format, Args... args )
{
int size_s = std::snprintf( nullptr, 0, format.c_str(), args... ) + 1;
auto size = static_cast< size_t >( size_s );
auto buf = std::make_unique< char[] >( size );
std::snprintf( buf.get(), size, format.c_str(), args... );
return std::string( buf.get(), buf.get() + size - 1 );
}
/// <summary>
/// generates c++ header file which MUST BE COMPILED USING CLANG BECAUSE MSVC CANT HANDLE HUGE STATIC INITS (6/13/2021)....
/// </summary>
/// <param name="labels">vector of compiled labels...</param>
/// <param name="image_path">path to the image on disk...</param>
/// <param name="vmctx"></param>
/// <returns></returns>
inline std::string code( std::vector< vm::compiled_label_data > &labels, std::string image_path, vm::ctx_t& vmctx )
{
std::string result, raw_file_array;
std::vector< std::uint8_t > raw_file;
xtils::um_t::get_instance()->open_binary_file( image_path, raw_file );
for ( auto idx = 0u; idx < raw_file.size(); ++idx )
raw_file_array.append( string_format( "0x%x, ", raw_file[ idx ] ) );
result.append( "#pragma once\n"
"#pragma section( \".xmp2\" )\n"
"#pragma comment( linker, \"/section:.xmp2,RWE\" ) \n\n" );
result.append( "namespace vm\n"
"{\n" );
result.append( R"( using u8 = unsigned char;
namespace gen {
/// <summary>
/// function pasted from
/// https://stackoverflow.com/questions/2342162/stdstring-formatting-like-sprintf
/// </summary>
/// <typeparam name="...Args"></typeparam>
/// <param name="format"></param>
/// <param name="...args"></param>
/// <returns></returns>
template <typename... Args>
std::string string_format(const std::string &format, Args... args) {
int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1;
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, format.c_str(), args...);
return std::string(buf.get(), buf.get() + size - 1);
}
/// <summary>
/// generates c++ header file which MUST BE COMPILED USING CLANG BECAUSE MSVC
/// CANT HANDLE HUGE STATIC INITS (6/13/2021)....
/// </summary>
/// <param name="labels">vector of compiled labels...</param>
/// <param name="image_path">path to the image on disk...</param>
/// <param name="vmctx"></param>
/// <returns></returns>
inline std::string code(std::vector<vm::compiled_label_data> &labels,
std::string image_path, vm::ctx_t &vmctx) {
std::string result, raw_file_array;
std::vector<std::uint8_t> raw_file;
xtils::um_t::get_instance()->open_binary_file(image_path, raw_file);
for (auto idx = 0u; idx < raw_file.size(); ++idx)
raw_file_array.append(string_format("0x%x, ", raw_file[idx]));
result.append(
"#pragma once\n"
"#pragma section( \".xmp2\" )\n"
"#pragma comment( linker, \"/section:.xmp2,RWE\" ) \n\n");
result.append(
"namespace vm\n"
"{\n");
result.append(R"( using u8 = unsigned char;
using s8 = signed char;
using u16 = unsigned short;
@ -169,78 +171,82 @@ namespace gen
{
unsigned int VirtualAddress;
unsigned int SizeOfBlock;
} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;)" );
result.append( "\n\n\ttemplate < class T, class U > struct _pair_t\n"
"\t{\n"
"\t\tT first;\n"
"\t\tU second;\n"
"\t};\n\n" );
result.append( string_format( "\tconstexpr auto entry_rva = 0x%x;\n\n", vmctx.vm_entry_rva ) );
result.append( "\tenum class calls : u32\n"
"\t{\n" );
for ( auto idx = 0u; idx < labels.size(); ++idx )
result.append( string_format( "\t\t%s = 0x%x,\n", labels[ idx ].label_name, labels[ idx ].enc_alloc_rva ) );
result.append( "\t};\n\n" );
result.append( string_format( "\tinline _pair_t< u8, calls > call_map[%d] = \n"
"\t{\n",
labels.size() ) );
for ( auto idx = 0u; idx < labels.size(); ++idx )
result.append( string_format( "\t\t{ %d, calls::%s },\n", idx, labels[ idx ].label_name.c_str() ) );
result.append( "\t};\n\n" );
result.append( string_format( "\t__declspec(align(1)) struct _gen_data\n"
"\t{\n"
"\t\tu8 bin[%d] =\n"
"\t\t{\n"
"\t\t\t%s\n",
raw_file.size(), raw_file_array.c_str() ) );
result.append( "\t\t};\n\n" );
result.append( string_format( "\t\tu8 map_area[0x%x];\n\n", vmctx.image_size ) );
for ( auto &label : labels )
{
result.append(
string_format( "\t\tu8 __%s_vinstrs[%d] =\n", label.label_name.c_str(), label.vinstrs.size() ) );
result.append( "\t\t{\n\t\t\t" );
for ( auto &byte : label.vinstrs )
result.append( string_format( "0x%x, ", byte ) );
result.append( "\n\t\t};\n\n" );
}
result.append( string_format( "\t\tu8 __vmcall_shell_code[%d][15] =\n"
"\t\t{\n",
labels.size() ) );
for ( auto idx = 0u; idx < labels.size(); ++idx )
{
std::string jmp_code;
// two push instructions...
for ( auto i = 0u; i < 2; ++i )
{
jmp_code.append( "0x68, " ); // push opcode...
for ( auto _idx = 0u; _idx < 4; ++_idx )
jmp_code.append( "0x0, " );
}
} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;)");
result.append(
"\n\n\ttemplate < class T, class U > struct _pair_t\n"
"\t{\n"
"\t\tT first;\n"
"\t\tU second;\n"
"\t};\n\n");
result.append(string_format("\tconstexpr auto entry_rva = 0x%x;\n\n",
vmctx.vm_entry_rva));
result.append(
"\tenum class calls : u32\n"
"\t{\n");
for (auto idx = 0u; idx < labels.size(); ++idx)
result.append(string_format("\t\t%s = 0x%x,\n", labels[idx].label_name,
labels[idx].enc_alloc_rva));
result.append("\t};\n\n");
result.append(
string_format("\tinline _pair_t< u8, calls > call_map[%d] = \n"
"\t{\n",
labels.size()));
for (auto idx = 0u; idx < labels.size(); ++idx)
result.append(string_format("\t\t{ %d, calls::%s },\n", idx,
labels[idx].label_name.c_str()));
result.append("\t};\n\n");
result.append(
string_format("\t__declspec(align(1)) struct _gen_data\n"
"\t{\n"
"\t\tu8 bin[%d] =\n"
"\t\t{\n"
"\t\t\t%s\n",
raw_file.size(), raw_file_array.c_str()));
result.append("\t\t};\n\n");
result.append(string_format("\t\tu8 map_area[0x%x];\n\n", vmctx.image_size));
for (auto &label : labels) {
result.append(string_format("\t\tu8 __%s_vinstrs[%d] =\n",
label.label_name.c_str(),
label.vinstrs.size()));
result.append("\t\t{\n\t\t\t");
for (auto &byte : label.vinstrs)
result.append(string_format("0x%x, ", byte));
result.append("\n\t\t};\n\n");
}
result.append(
string_format("\t\tu8 __vmcall_shell_code[%d][15] =\n"
"\t\t{\n",
labels.size()));
for (auto idx = 0u; idx < labels.size(); ++idx) {
std::string jmp_code;
// two push instructions...
for (auto i = 0u; i < 2; ++i) {
jmp_code.append("0x68, "); // push opcode...
for (auto _idx = 0u; _idx < 4; ++_idx) jmp_code.append("0x0, ");
}
// one jmp instruction...
jmp_code.append( "0xE9, " );
for ( auto i = 0u; i < 4; ++i )
jmp_code.append( "0x0, " );
// one jmp instruction...
jmp_code.append("0xE9, ");
for (auto i = 0u; i < 4; ++i) jmp_code.append("0x0, ");
result.append( string_format( "\t\t\t{ %s },\n", jmp_code.c_str() ) );
}
result.append(string_format("\t\t\t{ %s },\n", jmp_code.c_str()));
}
result.append( "\t\t};\n\n" );
result.append( R"( bool init()
result.append("\t\t};\n\n");
result.append(R"( bool init()
{
static const auto _memcpy = []( void *dest, const void *src, size_t len ) -> void * {
char *d = ( char * )dest;
@ -324,12 +330,14 @@ namespace gen
}
return true; // only a bool so i can use static/call init only once...
})" );
})");
result.append( "\n\t};\n\n" );
result.append( "\t__declspec(allocate(\".xmp2\")) inline _gen_data gen_data;\n\n" );
result.append("\n\t};\n\n");
result.append(
"\t__declspec(allocate(\".xmp2\")) inline _gen_data gen_data;\n\n");
result.append( R"( template < calls e_call, class T, class ... Ts > auto call(const Ts... args) -> T
result.append(
R"( template < calls e_call, class T, class ... Ts > auto call(const Ts... args) -> T
{
static auto __init_result = gen_data.init();
@ -339,9 +347,9 @@ namespace gen
vmcall = reinterpret_cast< __vmcall_t >( &gen_data.__vmcall_shell_code[ idx ] );
return reinterpret_cast< T >( vmcall( args... ) );
})" );
})");
result.append( "\n}" );
return result;
}
} // namespace gen
result.append("\n}");
return result;
}
} // namespace gen

@ -0,0 +1,101 @@
#pragma once
#include <cstdint>
#include <functional>
#include <iostream>
#include <vector>
/// <summary>
/// raw virtual instruction information extracted using lex and yacc...
/// </summary>
struct _vinstr_meta {
/// <summary>
/// virtual instruction name...
/// </summary>
std::string name;
/// <summary>
/// if the virtual instruction has a second operand or not (imm)...
/// </summary>
bool has_imm;
/// <summary>
/// the imm if any...
/// </summary>
std::uintptr_t imm;
};
/// <summary>
/// raw label containing raw virtual instruction data extracted using lex and
/// yacc...
/// </summary>
struct _vlabel_meta {
/// <summary>
/// label name...
/// </summary>
std::string label_name;
/// <summary>
/// vector of raw virtual instruction data...
/// </summary>
std::vector<_vinstr_meta> vinstrs;
};
/// <summary>
/// used for parse_t::for_each...
/// </summary>
using callback_t = std::function<bool(_vlabel_meta *)>;
/// <summary>
/// this singleton class contains all the information for parsed virtual
/// instructions...
/// </summary>
class parse_t {
public:
/// <summary>
/// gets the one and only instance of this class...
/// </summary>
/// <returns>returns a pointer to the one and only instance of this
/// class...</returns>
static auto get_instance() -> parse_t *;
/// <summary>
/// used by yacc file to add new labels...
/// </summary>
/// <param name="label_name">label name, no pass by reference since a new
/// std::string object must be created...</param>
void add_label(std::string label_name);
/// <summary>
/// used by yacc file to add new virtual instruction with no imm...
/// </summary>
/// <param name="vinstr_name">virtual instruction name, no pass by reference
/// since a new std::string object must be created...</param>
void add_vinstr(std::string vinstr_name);
/// <summary>
/// used by yacc file to add new virtual instruction with an imm...
/// </summary>
/// <param name="vinstr_name">virtual instruction name, no pass by reference
/// since a new std::string object must be created...</param> <param
/// name="imm_val">imm value...</param>
void add_vinstr(std::string vinstr_name, std::uintptr_t imm_val);
/// <summary>
/// used to loop over every single label...
/// </summary>
/// <param name="callback">lambda to call back given the label
/// structure...</param> <returns>returns true if all labels were looped
/// through...</returns>
bool for_each(callback_t callback);
private:
/// <summary>
/// vector of raw virtual labels...
/// </summary>
std::vector<_vlabel_meta> virt_labels;
/// <summary>
/// default constructor... private...
/// </summary>
parse_t();
};

@ -1,23 +0,0 @@
<?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);</Outputs>
<ExecutionDescription>Process "%(Filename)%(Extension)" bison file</ExecutionDescription>
</Bison>
</ItemDefinitionGroup>
</Project>

@ -1,101 +0,0 @@
<?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>
</Project>

@ -1,281 +0,0 @@
<?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>

@ -1,23 +0,0 @@
<?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>

@ -1,94 +0,0 @@
<?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>

@ -1,243 +0,0 @@
<?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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/manual/Scanner-Options.html#Scanner-Options"
Switch="c++" />
<StringListProperty
Name="CppClassName"
Category="Flex Options"
HelpUrl="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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>

@ -1 +0,0 @@
https://sourceforge.net/p/winflexbison/wiki/Visual%20Studio%20custom%20build%20rules/

@ -1,23 +0,0 @@
<?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);</Outputs>
<ExecutionDescription>Process "%(Filename)%(Extension)" bison file</ExecutionDescription>
</Bison>
</ItemDefinitionGroup>
</Project>

@ -1,91 +0,0 @@
<?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>

@ -1,281 +0,0 @@
<?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>

@ -1,43 +0,0 @@
<?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);</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>

@ -1,178 +0,0 @@
<?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>

@ -1,521 +0,0 @@
<?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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/manual/Scanner-Options.html#Scanner-Options"
Switch="c++" />
<StringListProperty
Name="CppClassName"
Category="Flex Options"
HelpUrl="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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>

@ -1,23 +0,0 @@
<?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>

@ -1,94 +0,0 @@
<?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>

@ -1,243 +0,0 @@
<?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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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="http://flex.sourceforge.net/manual/Scanner-Options.html#Scanner-Options"
Switch="c++" />
<StringListProperty
Name="CppClassName"
Category="Flex Options"
HelpUrl="http://flex.sourceforge.net/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="http://flex.sourceforge.net/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>

@ -1,30 +0,0 @@
## Copyright (C) 2002, 2005-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
dist_pkgdata_DATA = README bison.m4 \
c-like.m4 \
c-skel.m4 c.m4 yacc.c glr.c \
c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc stack.hh \
java-skel.m4 java.m4 lalr1.java
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4
xsltdir = $(pkgdatadir)/xslt
dist_xslt_DATA = \
xslt/bison.xsl \
xslt/xml2dot.xsl \
xslt/xml2text.xsl \
xslt/xml2xhtml.xsl

File diff suppressed because it is too large Load Diff

@ -1,70 +0,0 @@
-*- outline -*-
This directory contains data needed by Bison.
* Skeletons
Bison skeletons: the general shapes of the different parser kinds,
that are specialized for specific grammars by the bison program.
Currently, the supported skeletons are:
- yacc.c
It used to be named bison.simple: it corresponds to C Yacc
compatible LALR(1) parsers.
- lalr1.cc
Produces a C++ parser class.
- lalr1.java
Produces a Java parser class.
- glr.c
A Generalized LR C parser based on Bison's LALR(1) tables.
- glr.cc
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
These skeletons are the only ones supported by the Bison team.
Because the interface between skeletons and the bison program is not
finished, *we are not bound to it*. In particular, Bison is not
mature enough for us to consider that ``foreign skeletons'' are
supported.
* m4sugar
This directory contains M4sugar, sort of an extended library for M4,
which is used by Bison to instantiate the skeletons.
* xslt
This directory contains XSLT programs that transform Bison's XML output
into various formats.
- bison.xsl
A library of routines used by the other XSLT programs.
- xml2dot.xsl
Conversion into GraphViz's dot format.
- xml2text.xsl
Conversion into text.
- xml2xhtml.xsl
Conversion into XHTML.
-----
Copyright (C) 2002, 2008-2012 Free Software Foundation, Inc.
This file is part of GNU Bison.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

@ -1,610 +0,0 @@
-*- Autoconf -*-
# Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
## ---------------- ##
## Identification. ##
## ---------------- ##
# b4_copyright(TITLE, YEARS)
# --------------------------
m4_define([b4_copyright],
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
b4_comment([$1
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.])
b4_comment([As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison.])])
## -------- ##
## Output. ##
## -------- ##
# b4_output_begin(FILE)
# ---------------------
# Enable output, i.e., send to diversion 0, expand after "#", and
# generate the tag to output into FILE. Must be followed by EOL.
m4_define([b4_output_begin],
[m4_changecom()
m4_divert_push(0)dnl
@output(m4_unquote([$1])@)@dnl
])
# b4_output_end()
# ---------------
# Output nothing, restore # as comment character (no expansions after #).
m4_define([b4_output_end],
[m4_divert_pop(0)
m4_changecom([#])
])
## ---------------- ##
## Error handling. ##
## ---------------- ##
# The following error handling macros print error directives that should not
# become arguments of other macro invocations since they would likely then be
# mangled. Thus, they print to stdout directly.
# b4_cat(TEXT)
# ------------
# Write TEXT to stdout. Precede the final newline with an @ so that it's
# escaped. For example:
#
# b4_cat([[@complain(invalid input@)]])
m4_define([b4_cat],
[m4_syscmd([cat <<'_m4eof'
]m4_bpatsubst(m4_dquote($1), [_m4eof], [_m4@`eof])[@
_m4eof
])dnl
m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
# -------------------------------------------
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to stdout.
#
# For example:
#
# b4_error([[warn]], [[invalid value for '%s': %s]], [[foo]], [[3]])
m4_define([b4_error],
[b4_cat([[@]$1[(]$2[]]dnl
[m4_if([$#], [2], [],
[m4_foreach([b4_arg],
m4_dquote(m4_shift(m4_shift($@))),
[[@,]b4_arg])])[@)]])])
# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
# ----------------------------------------------------------
# Write @KIND_at(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
#
# For example:
#
# b4_error_at([[complain]], [[input.y:2.3]], [[input.y:5.4]],
# [[invalid %s]], [[foo]])
m4_define([b4_error_at],
[b4_cat([[@]$1[_at(]$2[@,]$3[@,]$4[]]dnl
[m4_if([$#], [4], [],
[m4_foreach([b4_arg],
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
[[@,]b4_arg])])[@)]])])
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
# ------------------------------------
# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to stdout.
#
# For example:
#
# b4_warn([[invalid value for '%s': %s]], [[foo]], [[3]])
#
# As a simple test suite, this:
#
# m4_divert(-1)
# m4_define([asdf], [ASDF])
# m4_define([fsa], [FSA])
# m4_define([fdsa], [FDSA])
# b4_warn([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
# b4_warn([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
# b4_warn()
# b4_warn(1)
# b4_warn(1, 2)
#
# Should produce this without newlines:
#
# @warn([asdf), asdf]@,[fsa), fsa]@,[fdsa), fdsa]@)
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
# @warn(@)
# @warn(1@)
# @warn(1@,2@)
m4_define([b4_warn],
[b4_error([[warn]], $@)])
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
# ---------------------------------------------------
# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
#
# For example:
#
# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
m4_define([b4_warn_at],
[b4_error_at([[warn]], $@)])
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
# ----------------------------------------
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to stdout.
#
# See b4_warn example.
m4_define([b4_complain],
[b4_error([[complain]], $@)])
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
# -------------------------------------------------------
# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
#
# See b4_warn_at example.
m4_define([b4_complain_at],
[b4_error_at([[complain]], $@)])
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
# -------------------------------------
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
#
# See b4_warn example.
m4_define([b4_fatal],
[b4_error([[fatal]], $@)dnl
m4_exit(1)])
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
# ----------------------------------------------------
# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
#
# See b4_warn_at example.
m4_define([b4_fatal_at],
[b4_error_at([[fatal]], $@)dnl
m4_exit(1)])
## ------------ ##
## Data Types. ##
## ------------ ##
# b4_ints_in(INT1, INT2, LOW, HIGH)
# ---------------------------------
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
m4_define([b4_ints_in],
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
## ------------------ ##
## Decoding options. ##
## ------------------ ##
# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
# -----------------------------------
# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
m4_define([b4_flag_if],
[m4_case(b4_$1_flag,
[0], [$3],
[1], [$2],
[m4_fatal([invalid $1 value: ]$1)])])
# b4_define_flag_if(FLAG)
# -----------------------
# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
# value of the Boolean FLAG.
m4_define([b4_define_flag_if],
[_b4_define_flag_if($[1], $[2], [$1])])
# _b4_define_flag_if($1, $2, FLAG)
# --------------------------------
# Work around the impossibility to define macros inside macros,
# because issuing `[$1]' is not possible in M4. GNU M4 should provide
# $$1 a la M5/TeX.
m4_define([_b4_define_flag_if],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_define([b4_$3_if],
[b4_flag_if([$3], [$1], [$2])])])
# b4_FLAG_if(IF-TRUE, IF-FALSE)
# -----------------------------
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
b4_define_flag_if([defines]) # Whether headers are requested.
b4_define_flag_if([error_verbose]) # Whether error are verbose.
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
b4_define_flag_if([locations]) # Whether locations are tracked.
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
# yytoken_table is needed to support verbose errors.
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
## ----------- ##
## Synclines. ##
## ----------- ##
# b4_basename(NAME)
# -----------------
# Similar to POSIX basename; the differences don't matter here.
# Beware that NAME is not evaluated.
m4_define([b4_basename],
[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
# b4_syncline(LINE, FILE)
# -----------------------
m4_define([b4_syncline],
[b4_flag_if([synclines],
[b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
b4_sync_start([$1], [$2])])])
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
m4_define([b4_sync_start], [b4_comment([Line $1 of $2])])
# b4_user_code(USER-CODE)
# -----------------------
# Emit code from the user, ending it with synclines.
m4_define([b4_user_code],
[$1
b4_syncline([@oline@], [@ofile@])])
# b4_define_user_code(MACRO)
# --------------------------
# From b4_MACRO, build b4_user_MACRO that includes the synclines.
m4_define([b4_define_user_code],
[m4_define([b4_user_$1],
[b4_user_code([b4_$1])])])
# b4_user_actions
# b4_user_initial_action
# b4_user_post_prologue
# b4_user_pre_prologue
# b4_user_stype
# ----------------------
# Macros that issue user code, ending with synclines.
b4_define_user_code([actions])
b4_define_user_code([initial_action])
b4_define_user_code([post_prologue])
b4_define_user_code([pre_prologue])
b4_define_user_code([stype])
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
# -----------------------------------------------------
# Complain if any name of type WHAT is used by the user (as recorded in
# USER-LIST) but is not used by Bison (as recorded by macros in the
# namespace BISON-NAMESPACE).
#
# USER-LIST must expand to a list specifying all user occurrences of all names
# of type WHAT. Each item in the list must be a triplet specifying one
# occurrence: name, start boundary, and end boundary. Empty string names are
# fine. An empty list is fine.
#
# For example, to define b4_foo_user_names to be used for USER-LIST with three
# name occurrences and with correct quoting:
#
# m4_define([b4_foo_user_names],
# [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]],
# [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]],
# [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
#
# The macro BISON-NAMESPACE(bar) must be defined iff the name bar of type WHAT
# is used by Bison (in the front-end or in the skeleton). Empty string names
# are fine, but it would be ugly for Bison to actually use one.
#
# For example, to use b4_foo_bison_names for BISON-NAMESPACE and define that
# the names bar and baz are used by Bison:
#
# m4_define([b4_foo_bison_names(bar)])
# m4_define([b4_foo_bison_names(baz)])
#
# To invoke b4_check_user_names with TYPE foo, with USER-LIST
# b4_foo_user_names, with BISON-NAMESPACE b4_foo_bison_names, and with correct
# quoting:
#
# b4_check_user_names([[foo]], [b4_foo_user_names],
# [[b4_foo_bison_names]])
m4_define([b4_check_user_names],
[m4_foreach([b4_occurrence], $2,
[m4_pushdef([b4_occurrence], b4_occurrence)dnl
m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
[b4_complain_at([b4_start], [b4_end],
[[%s '%s' is not used]],
[$1], [b4_user_name])])[]dnl
m4_popdef([b4_occurrence])dnl
m4_popdef([b4_user_name])dnl
m4_popdef([b4_start])dnl
m4_popdef([b4_end])dnl
])])
## --------------------- ##
## b4_percent_define_*. ##
## --------------------- ##
# b4_percent_define_use(VARIABLE)
# -------------------------------
# Declare that VARIABLE was used.
m4_define([b4_percent_define_use],
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
])
# b4_percent_define_get(VARIABLE, [DEFAULT])
# ------------------------------------------
# Mimic muscle_percent_define_get in ../src/muscle-tab.h. That is, if
# the %define variable VARIABLE is defined, emit its value. Contrary
# to its C counterpart, return DEFAULT otherwise. Also, record
# Bison's usage of VARIABLE by defining
# b4_percent_define_bison_variables(VARIABLE).
#
# For example:
#
# b4_percent_define_get([[foo]])
m4_define([b4_percent_define_get],
[b4_percent_define_use([$1])dnl
m4_ifdef([b4_percent_define(]$1[)],
[m4_indir([b4_percent_define(]$1[)])],
[$2])])
# b4_percent_define_get_loc(VARIABLE)
# -----------------------------------
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
# if the %define variable VARIABLE is undefined, complain fatally since that's
# a Bison or skeleton error. Otherwise, return its definition location in a
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
# b4_fatal_at. Don't record this as a Bison usage of VARIABLE as there's no
# reason to suspect that the user-supplied value has yet influenced the output.
#
# For example:
#
# b4_complain_at(b4_percent_define_get_loc([[foo]]), [[invalid foo]])
m4_define([b4_percent_define_get_loc],
[m4_ifdef([b4_percent_define_loc(]$1[)],
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
b4_loc[]dnl
m4_popdef([b4_loc])],
[b4_fatal([[b4_percent_define_get_loc: undefined %%define variable '%s']], [$1])])])
# b4_percent_define_get_syncline(VARIABLE)
# ----------------------------------------
# Mimic muscle_percent_define_get_syncline in ../src/muscle-tab.h exactly.
# That is, if the %define variable VARIABLE is undefined, complain fatally
# since that's a Bison or skeleton error. Otherwise, return its definition
# location as a b4_syncline invocation. Don't record this as a Bison usage of
# VARIABLE as there's no reason to suspect that the user-supplied value has yet
# influenced the output.
#
# For example:
#
# b4_percent_define_get_syncline([[foo]])
m4_define([b4_percent_define_get_syncline],
[m4_ifdef([b4_percent_define_syncline(]$1[)],
[m4_indir([b4_percent_define_syncline(]$1[)])],
[b4_fatal([[b4_percent_define_get_syncline: undefined %%define variable '%s']], [$1])])])
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
# ------------------------------------------------------
# Mimic muscle_percent_define_ifdef in ../src/muscle-tab.h exactly. That is,
# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
# IF-FALSE. Also, record Bison's usage of VARIABLE by defining
# b4_percent_define_bison_variables(VARIABLE).
#
# For example:
#
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
m4_define([b4_percent_define_ifdef],
[m4_ifdef([b4_percent_define(]$1[)],
[m4_define([b4_percent_define_bison_variables(]$1[)])$2],
[$3])])
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
# --------------------------------------------------------
# Mimic muscle_percent_define_flag_if in ../src/muscle-tab.h exactly. That is,
# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE.
# If it is defined to "false", expand IF-FALSE. Complain if it is undefined
# (a Bison or skeleton error since the default value should have been set
# already) or defined to any other value (possibly a user error). Also, record
# Bison's usage of VARIABLE by defining
# b4_percent_define_bison_variables(VARIABLE).
#
# For example:
#
# b4_percent_define_flag_if([[foo]], [[it's true]], [[it's false]])
m4_define([b4_percent_define_flag_if],
[b4_percent_define_ifdef([$1],
[m4_case(b4_percent_define_get([$1]),
[], [$2], [true], [$2], [false], [$3],
[m4_expand_once([b4_complain_at(b4_percent_define_get_loc([$1]),
[[invalid value for %%define Boolean variable '%s']],
[$1])],
[[b4_percent_define_flag_if($1)]])])],
[b4_fatal([[b4_percent_define_flag_if: undefined %%define variable '%s']], [$1])])])
# b4_percent_define_default(VARIABLE, DEFAULT)
# --------------------------------------------
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
# Don't record this as a Bison usage of VARIABLE as there's no reason to
# suspect that the value has yet influenced the output.
#
# For example:
#
# b4_percent_define_default([[foo]], [[default value]])
m4_define([b4_percent_define_default],
[m4_ifndef([b4_percent_define(]$1[)],
[m4_define([b4_percent_define(]$1[)], [$2])dnl
m4_define([b4_percent_define_loc(]$1[)],
[[[[<skeleton default value>:-1.-1]],
[[<skeleton default value>:-1.-1]]]])dnl
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
# b4_percent_define_check_values(VALUES)
# --------------------------------------
# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
# except that the VALUES structure is more appropriate for M4. That is, VALUES
# is a list of sublists of strings. For each sublist, the first string is the
# name of a %define variable, and all remaining strings in that sublist are the
# valid values for that variable. Complain if such a variable is undefined (a
# Bison error since the default value should have been set already) or defined
# to any other value (possibly a user error). Don't record this as a Bison
# usage of the variable as there's no reason to suspect that the value has yet
# influenced the output.
#
# For example:
#
# b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]],
# [[[[bar]], [[bar-value1]]]])
m4_define([b4_percent_define_check_values],
[m4_foreach([b4_sublist], m4_quote($@),
[_b4_percent_define_check_values(b4_sublist)])])
m4_define([_b4_percent_define_check_values],
[m4_ifdef([b4_percent_define(]$1[)],
[m4_pushdef([b4_good_value], [0])dnl
m4_if($#, 1, [],
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
[m4_define([b4_good_value], [1])])])])dnl
m4_if(b4_good_value, [0],
[b4_complain_at(b4_percent_define_get_loc([$1]),
[[invalid value for %%define variable '%s': '%s']],
[$1],
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
[b4_complain_at(b4_percent_define_get_loc([$1]),
[[accepted value: '%s']],
m4_dquote(b4_value))])])dnl
m4_popdef([b4_good_value])],
[b4_fatal([[b4_percent_define_check_values: undefined %%define variable '%s']], [$1])])])
# b4_percent_code_get([QUALIFIER])
# --------------------------------
# If any %code blocks for QUALIFIER are defined, emit them beginning with a
# comment and ending with synclines and a newline. If QUALIFIER is not
# specified or empty, do this for the unqualified %code blocks. Also, record
# Bison's usage of QUALIFIER (if specified) by defining
# b4_percent_code_bison_qualifiers(QUALIFIER).
#
# For example, to emit any unqualified %code blocks followed by any %code
# blocks for the qualifier foo:
#
# b4_percent_code_get
# b4_percent_code_get([[foo]])
m4_define([b4_percent_code_get],
[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl
m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
m4_ifdef(b4_macro_name,
[b4_comment([m4_if([$#], [0], [[Unqualified %code]],
[["%code ]$1["]])[ blocks.]])
b4_user_code([m4_indir(b4_macro_name)])
])dnl
m4_popdef([b4_macro_name])])
# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------
# If any %code blocks for QUALIFIER (or unqualified %code blocks if
# QUALIFIER is empty) are defined, expand IF-TRUE, else expand IF-FALSE.
# Also, record Bison's usage of QUALIFIER (if specified) by defining
# b4_percent_code_bison_qualifiers(QUALIFIER).
m4_define([b4_percent_code_ifdef],
[m4_ifdef([b4_percent_code(]$1[)],
[m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2],
[$3])])
## ----------------------------------------------------------- ##
## After processing the skeletons, check that all the user's ##
## %define variables and %code qualifiers were used by Bison. ##
## ----------------------------------------------------------- ##
m4_define([b4_check_user_names_wrap],
[m4_ifdef([b4_percent_]$1[_user_]$2[s],
[b4_check_user_names([[%]$1 $2],
[b4_percent_]$1[_user_]$2[s],
[[b4_percent_]$1[_bison_]$2[s]])])])
m4_wrap_lifo([
b4_check_user_names_wrap([[define]], [[variable]])
b4_check_user_names_wrap([[code]], [[qualifier]])
])
## ---------------- ##
## Default values. ##
## ---------------- ##
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
m4_define_default([b4_pre_prologue], [])
m4_define_default([b4_post_prologue], [])
m4_define_default([b4_epilogue], [])
m4_define_default([b4_parse_param], [])
# The initial column and line.
m4_define_default([b4_location_initial_column], [1])
m4_define_default([b4_location_initial_line], [1])
# Sanity checks.
b4_percent_define_ifdef([api.prefix],
[m4_ifdef([b4_prefix],
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
[['%s' and '%s' cannot be used together]],
[%name-prefix],
[%define api.prefix])])])

@ -1,26 +0,0 @@
-*- Autoconf -*-
# C++ skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
m4_include(b4_used_skeleton)

@ -1,205 +0,0 @@
-*- Autoconf -*-
# C++ skeleton for Bison
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_include(b4_pkgdatadir/[c.m4])
## ---------------- ##
## Default values. ##
## ---------------- ##
# Default parser class name.
b4_percent_define_default([[parser_class_name]], [[parser]])
# Don't do that so that we remember whether we're using a user
# request, or the default value.
#
# b4_percent_define_default([[api.location.type]], [[location]])
b4_percent_define_default([[filename_type]], [[std::string]])
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
b4_percent_define_default([[define_location_comparison]],
[m4_if(b4_percent_define_get([[filename_type]]),
[std::string], [[true]], [[false]])])
## ----------- ##
## Namespace. ##
## ----------- ##
m4_define([b4_namespace_ref], [b4_percent_define_get([[namespace]])])
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
# would compile as an absolute reference with `parser' in the global namespace.
# b4_namespace_open would open an anonymous namespace and thus establish
# internal linkage. This would compile. However, it's cryptic, and internal
# linkage for the parser would be specified in all translation units that
# include the header, which is always generated. If we ever need to permit
# internal linkage somehow, surely we can find a cleaner approach.
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
[[namespace reference is empty]])])
# Instead of assuming the C++ compiler will do it, Bison should reject any
# invalid b4_namepsace_ref that would be converted to a valid
# b4_namespace_open. The problem is that Bison doesn't always output
# b4_namespace_ref to uncommented code but should reserve the ability to do so
# in future releases without risking breaking any existing user grammars.
# Specifically, don't allow empty names as b4_namespace_open would just convert
# those into anonymous namespaces, and that might tempt some users.
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
[[namespace reference has consecutive "::"]])])
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
[[namespace reference has a trailing "::"]])])
m4_define([b4_namespace_open],
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
[^\(.\)[ ]*::], [\1])),
[::], [ { namespace ])[ {]])])
m4_define([b4_namespace_close],
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
[\1])),
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -----------------------------------------------------
# Output the definition of the tokens as enums.
m4_define([b4_token_enums],
[/* Tokens. */
enum yytokentype {
m4_map_sep([ b4_token_enum], [,
],
[$@])
};
])
## ----------------- ##
## Semantic Values. ##
## ----------------- ##
# b4_lhs_value([TYPE])
# --------------------
# Expansion of $<TYPE>$.
m4_define([b4_lhs_value],
[(yyval[]m4_ifval([$1], [.$1]))])
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
# --------------------------------------
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS.
m4_define([b4_rhs_value],
[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
# b4_lhs_location()
# -----------------
# Expansion of @$.
m4_define([b4_lhs_location],
[(yyloc)])
# b4_rhs_location(RULE-LENGTH, NUM)
# ---------------------------------
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS.
m4_define([b4_rhs_location],
[(yylocation_stack_@{($1) - ($2)@})])
# b4_parse_param_decl
# -------------------
# Extra formal arguments of the constructor.
# Change the parameter names from "foo" into "foo_yyarg", so that
# there is no collision bw the user chosen attribute name, and the
# argument name in the constructor.
m4_define([b4_parse_param_decl],
[m4_ifset([b4_parse_param],
[m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
m4_define([b4_parse_param_decl_1],
[$1_yyarg])
# b4_parse_param_cons
# -------------------
# Extra initialisations of the constructor.
m4_define([b4_parse_param_cons],
[m4_ifset([b4_parse_param],
[
b4_cc_constructor_calls(b4_parse_param)])])
m4_define([b4_cc_constructor_calls],
[m4_map_sep([b4_cc_constructor_call], [,
], [$@])])
m4_define([b4_cc_constructor_call],
[$2 ($2_yyarg)])
# b4_parse_param_vars
# -------------------
# Extra instance variables.
m4_define([b4_parse_param_vars],
[m4_ifset([b4_parse_param],
[
/* User arguments. */
b4_cc_var_decls(b4_parse_param)])])
m4_define([b4_cc_var_decls],
[m4_map_sep([b4_cc_var_decl], [
], [$@])])
m4_define([b4_cc_var_decl],
[ $1;])
## ---------##
## Values. ##
## ---------##
# b4_yylloc_default_define
# ------------------------
# Define YYLLOC_DEFAULT.
m4_define([b4_yylloc_default_define],
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
# ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
(Current).end = YYRHSLOC (Rhs, N).end; \
} \
else \
{ \
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
} \
while (/*CONSTCOND*/ false)
# endif
]])

@ -1,44 +0,0 @@
-*- Autoconf -*-
# Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
# ----------------------------------------------
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
# pointer.
m4_define([b4_dollar_dollar_],
[m4_if([$2], [[]],
[m4_ifval([$3], [($1.$3)],
[$1])],
[($1.$2)])])
# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
# b4_dollar_popdef
# ---------------------------------------------------------
# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
# and b4_at_dollar for LOCATION.
m4_define([b4_dollar_pushdef],
[m4_pushdef([b4_dollar_dollar],
[b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
m4_pushdef([b4_at_dollar], [$3])dnl
])
m4_define([b4_dollar_popdef],
[m4_popdef([b4_at_dollar])dnl
m4_popdef([b4_dollar_dollar])dnl
])

@ -1,26 +0,0 @@
-*- Autoconf -*-
# C skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]])
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
m4_include(b4_used_skeleton)

@ -1,722 +0,0 @@
-*- Autoconf -*-
# C M4 Macros for Bison.
# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_include(b4_pkgdatadir/[c-like.m4])
# b4_tocpp(STRING)
# ----------------
# Convert STRING into a valid C macro name.
m4_define([b4_tocpp],
[m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
# b4_cpp_guard(FILE)
# ------------------
# A valid C macro name to use as a CPP header guard for FILE.
m4_define([b4_cpp_guard],
[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
# b4_cpp_guard_open(FILE)
# b4_cpp_guard_close(FILE)
# ------------------------
# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
m4_define([b4_cpp_guard_open],
[m4_ifval(m4_quote($1),
[#ifndef b4_cpp_guard([$1])
# define b4_cpp_guard([$1])])])
m4_define([b4_cpp_guard_close],
[m4_ifval(m4_quote($1),
[#endif b4_comment([!b4_cpp_guard([$1])])])])
## ---------------- ##
## Identification. ##
## ---------------- ##
# b4_comment(TEXT)
# ----------------
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
], [
]) */])
# b4_identification
# -----------------
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
# b4_pull_flag if they use the values of the %define variables api.pure or
# api.push-pull.
m4_define([b4_identification],
[[/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "]b4_version["
/* Skeleton name. */
#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
/* Pure parsers. */
#define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[
/* Push parsers. */
#define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[
/* Pull parsers. */
#define YYPULL ]b4_pull_flag])[
]])
## ---------------- ##
## Default values. ##
## ---------------- ##
# b4_api_prefix, b4_api_PREFIX
# ----------------------------
# Corresponds to %define api.prefix
b4_percent_define_default([[api.prefix]], [[yy]])
m4_define([b4_api_prefix],
[b4_percent_define_get([[api.prefix]])])
m4_define([b4_api_PREFIX],
[m4_toupper(b4_api_prefix)])
# b4_prefix
# ---------
# If the %name-prefix is not given, it is api.prefix.
m4_define_default([b4_prefix], [b4_api_prefix])
# If the %union is not named, its name is YYSTYPE.
m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
## ------------------------ ##
## Pure/impure interfaces. ##
## ------------------------ ##
# b4_user_args
# ------------
m4_define([b4_user_args],
[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
# b4_parse_param
# --------------
# If defined, b4_parse_param arrives double quoted, but below we prefer
# it to be single quoted.
m4_define([b4_parse_param],
b4_parse_param)
# b4_parse_param_for(DECL, FORMAL, BODY)
# ---------------------------------------
# Iterate over the user parameters, binding the declaration to DECL,
# the formal name to FORMAL, and evaluating the BODY.
m4_define([b4_parse_param_for],
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
m4_pushdef([$2], m4_shift($1_$2))dnl
$3[]dnl
m4_popdef([$2])dnl
m4_popdef([$1])dnl
])])
# b4_parse_param_use
# ------------------
# `YYUSE' all the parse-params.
m4_define([b4_parse_param_use],
[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
])dnl
])
## ------------ ##
## Data Types. ##
## ------------ ##
# b4_int_type(MIN, MAX)
# ---------------------
# Return the smallest int type able to handle numbers ranging from
# MIN to MAX (included).
m4_define([b4_int_type],
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
b4_ints_in($@, [-128], [127]), [1], [signed char],
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
b4_ints_in($@, [-32768], [32767]), [1], [short int],
m4_eval([0 <= $1]), [1], [unsigned int],
[int])])
# b4_int_type_for(NAME)
# ---------------------
# Return the smallest int type able to handle numbers ranging from
# `NAME_min' to `NAME_max' (included).
m4_define([b4_int_type_for],
[b4_int_type($1_min, $1_max)])
# b4_table_value_equals(TABLE, VALUE, LITERAL)
# --------------------------------------------
# Without inducing a comparison warning from the compiler, check if the
# literal value LITERAL equals VALUE from table TABLE, which must have
# TABLE_min and TABLE_max defined. YYID must be defined as an identity
# function that suppresses warnings about constant conditions.
m4_define([b4_table_value_equals],
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|| m4_indir([b4_]$1[_max]) < $3), [1],
[[YYID (0)]],
[(!!(($2) == ($3)))])])
## ---------##
## Values. ##
## ---------##
# b4_null_define
# --------------
# Portability issues: define a YY_NULL appropriate for the current
# language (C, C++98, or C++11).
m4_define([b4_null_define],
[# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
# else
# define YY_NULL 0
# endif
# endif[]dnl
])
# b4_null
# -------
# Return a null pointer constant.
m4_define([b4_null], [YY_NULL])
## ------------------------- ##
## Assigning token numbers. ##
## ------------------------- ##
# b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
# -----------------------------------------
# Output the definition of this token as #define.
m4_define([b4_token_define],
[#define $1 $2
])
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -------------------------------------------------------
# Output the definition of the tokens (if there are) as #defines.
m4_define([b4_token_defines],
[m4_if([$#$1], [1], [],
[/* Tokens. */
m4_map([b4_token_define], [$@])])
])
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
# ---------------------------------------
# Output the definition of this token as an enum.
m4_define([b4_token_enum],
[$1 = $2])
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[m4_if([$#$1], [1], [],
[[/* Tokens. */
#ifndef ]b4_api_PREFIX[TOKENTYPE
# define ]b4_api_PREFIX[TOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum ]b4_api_prefix[tokentype {
]m4_map_sep([ b4_token_enum], [,
],
[$@])[
};
#endif
]])])
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -------------------------------------------------------------
# Output the definition of the tokens (if there are any) as enums and, if POSIX
# Yacc is enabled, as #defines.
m4_define([b4_token_enums_defines],
[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
])
## --------------------------------------------- ##
## Defining C functions in both K&R and ANSI-C. ##
## --------------------------------------------- ##
# b4_modern_c
# -----------
# A predicate useful in #if to determine whether C is ancient or modern.
#
# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
# reasons, but it defines __C99__FUNC__ so check that as well.
# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
# Consider a C++ compiler to be modern if it defines __cplusplus.
#
m4_define([b4_c_modern],
[[(defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)]])
# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
# ----------------------------------------------------------
# Declare the function NAME.
m4_define([b4_c_function_def],
[#if b4_c_modern
b4_c_ansi_function_def($@)
#else
$2
$1 (b4_c_knr_formal_names(m4_shift2($@)))
b4_c_knr_formal_decls(m4_shift2($@))
#endif[]dnl
])
# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
# ---------------------------------------------------------------
# Declare the function NAME in ANSI.
m4_define([b4_c_ansi_function_def],
[$2
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
])
# b4_c_ansi_formals([DECL1, NAME1], ...)
# --------------------------------------
# Output the arguments ANSI-C definition.
m4_define([b4_c_ansi_formals],
[m4_if([$#], [0], [void],
[$#$1], [1], [void],
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
m4_define([b4_c_ansi_formal],
[$1])
# b4_c_knr_formal_names([DECL1, NAME1], ...)
# ------------------------------------------
# Output the argument names.
m4_define([b4_c_knr_formal_names],
[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
m4_define([b4_c_knr_formal_name],
[$2])
# b4_c_knr_formal_decls([DECL1, NAME1], ...)
# ------------------------------------------
# Output the K&R argument declarations.
m4_define([b4_c_knr_formal_decls],
[m4_map_sep([b4_c_knr_formal_decl],
[
],
[$@])])
m4_define([b4_c_knr_formal_decl],
[ $1;])
## ------------------------------------------------------------ ##
## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
## ------------------------------------------------------------ ##
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
# ----------------------------------------------------------------
# Declare the function NAME ANSI C style.
m4_define([b4_c_ansi_function_decl],
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
])
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
# -----------------------------------------------------------
# Declare the function NAME in both K&R and ANSI C.
m4_define([b4_c_function_decl],
[#if defined __STDC__ || defined __cplusplus
b4_c_ansi_function_decl($@)
#else
$2 $1 ();
#endif[]dnl
])
## --------------------- ##
## Calling C functions. ##
## --------------------- ##
# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
# -----------------------------------------------------------
# Call the function NAME with arguments NAME1, NAME2 etc.
m4_define([b4_c_function_call],
[$1 (b4_c_args(m4_shift2($@)))[]dnl
])
# b4_c_args([DECL1, NAME1], ...)
# ------------------------------
# Output the arguments NAME1, NAME2...
m4_define([b4_c_args],
[m4_map_sep([b4_c_arg], [, ], [$@])])
m4_define([b4_c_arg],
[$2])
## ----------- ##
## Synclines. ##
## ----------- ##
# b4_sync_start(LINE, FILE)
# -----------------------
m4_define([b4_sync_start], [[#]line $1 $2])
## -------------- ##
## User actions. ##
## -------------- ##
# b4_case(LABEL, STATEMENTS)
# --------------------------
m4_define([b4_case],
[ case $1:
$2
break;])
# b4_symbol_actions(FILENAME, LINENO,
# SYMBOL-TAG, SYMBOL-NUM,
# SYMBOL-ACTION, SYMBOL-TYPENAME)
# -------------------------------------------------
# Issue the code for a symbol action (e.g., %printer).
#
# Define b4_dollar_dollar([TYPE-NAME]), and b4_at_dollar, which are
# invoked where $<TYPE-NAME>$ and @$ were specified by the user.
m4_define([b4_symbol_actions],
[b4_dollar_pushdef([(*yyvaluep)], [$6], [(*yylocationp)])dnl
case $4: /* $3 */
b4_syncline([$2], [$1])
$5;
b4_syncline([@oline@], [@ofile@])
break;
b4_dollar_popdef[]dnl
])
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
# -------------------------------------------
# Generate the "yydestruct" function, which declaration is issued using
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
# or "b4_c_function_def" for K&R.
m4_define_default([b4_yydestruct_generate],
[[/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
/*ARGSUSED*/
]$1([yydestruct],
[static void],
[[const char *yymsg], [yymsg]],
[[int yytype], [yytype]],
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
YYUSE (yyvaluep);
]b4_locations_if([ YYUSE (yylocationp);
])dnl
b4_parse_param_use[]dnl
[
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype)
{
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
default:
break;
}
}]dnl
])
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
# ------------------------------------------------
# Generate the "yy_symbol_print" function, which declaration is issued using
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
# or "b4_c_function_def" for K&R.
m4_define_default([b4_yy_symbol_print_generate],
[[
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
/*ARGSUSED*/
]$1([yy_symbol_value_print],
[static void],
[[FILE *yyoutput], [yyoutput]],
[[int yytype], [yytype]],
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
]b4_locations_if([ YYUSE (yylocationp);
])dnl
b4_parse_param_use[]dnl
[# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
YYUSE (yyoutput);
# endif
switch (yytype)
{
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
[ default:
break;
}
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
]$1([yy_symbol_print],
[static void],
[[FILE *yyoutput], [yyoutput]],
[[int yytype], [yytype]],
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
])dnl
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
b4_locations_if([, yylocationp])[]b4_user_args[);
YYFPRINTF (yyoutput, ")");
}]dnl
])
## -------------- ##
## Declarations. ##
## -------------- ##
# b4_declare_yylstype
# -------------------
# Declarations that might either go into the header (if --defines) or
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
m4_define([b4_declare_yylstype],
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
]m4_ifdef([b4_stype],
[[typedef union ]b4_union_name[
{
]b4_user_stype[
} ]b4_api_PREFIX[STYPE;
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
[m4_if(b4_tag_seen_flag, 0,
[[typedef int ]b4_api_PREFIX[STYPE;
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
# define ]b4_api_prefix[stype ]b4_api_PREFIX[STYPE /* obsolescent; will be withdrawn */
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
#endif]b4_locations_if([[
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
typedef struct ]b4_api_PREFIX[LTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} ]b4_api_PREFIX[LTYPE;
# define ]b4_api_prefix[ltype ]b4_api_PREFIX[LTYPE /* obsolescent; will be withdrawn */
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
#endif]])
b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
])
# b4_YYDEBUG_define
# ------------------
m4_define([b4_YYDEBUG_define],
[[/* Enabling traces. */
]m4_if(b4_api_prefix, [yy],
[[#ifndef YYDEBUG
# define YYDEBUG ]b4_debug_flag[
#endif]],
[[#ifndef ]b4_api_PREFIX[DEBUG
# if defined YYDEBUG
# if YYDEBUG
# define ]b4_api_PREFIX[DEBUG 1
# else
# define ]b4_api_PREFIX[DEBUG 0
# endif
# else /* ! defined YYDEBUG */
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
# endif /* ! defined YYDEBUG */
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
])
# b4_declare_yydebug
# ------------------
m4_define([b4_declare_yydebug],
[b4_YYDEBUG_define[
#if ]b4_api_PREFIX[DEBUG
extern int ]b4_prefix[debug;
#endif][]dnl
])
# b4_yylloc_default_define
# ------------------------
# Define YYLLOC_DEFAULT.
m4_define([b4_yylloc_default_define],
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#endif
]])
# b4_yy_location_print_define
# ---------------------------
# Define YY_LOCATION_PRINT.
m4_define([b4_yy_location_print_define],
[b4_locations_if([[
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if (! defined __GNUC__ || __GNUC__ < 2 \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
# define __attribute__(Spec) /* empty */
# endif
#endif
#ifndef YY_LOCATION_PRINT
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__))
]b4_c_function_def([yy_location_print_],
[static unsigned],
[[FILE *yyo], [yyo]],
[[YYLTYPE const * const yylocp], [yylocp]])[
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
res += fprintf (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
res += fprintf (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
res += fprintf (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
res += fprintf (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
res += fprintf (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif]],
[[/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif]])
])
# b4_yyloc_default
# ----------------
# Expand to a possible default value for yylloc.
m4_define([b4_yyloc_default],
[[
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
= { ]m4_join([, ],
m4_defn([b4_location_initial_line]),
m4_defn([b4_location_initial_column]),
m4_defn([b4_location_initial_line]),
m4_defn([b4_location_initial_column]))[ }
# endif
]])

File diff suppressed because it is too large Load Diff

@ -1,346 +0,0 @@
-*- C -*-
# C++ GLR skeleton for Bison
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This skeleton produces a C++ class that encapsulates a C glr parser.
# This is in order to reduce the maintenance burden. The glr.c
# skeleton is clean and pure enough so that there are no real
# problems. The C++ interface is the same as that of lalr1.cc. In
# fact, glr.c can replace yacc.c without the user noticing any
# difference, and similarly for glr.cc replacing lalr1.cc.
#
# The passing of parse-params
#
# The additional arguments are stored as members of the parser
# object, yyparser. The C routines need to carry yyparser
# throughout the C parser; that easy: just let yyparser become an
# additional parse-param. But because the C++ skeleton needs to
# know the "real" original parse-param, we save them
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
# (and c.m4 strips one level of quotes). This is a PITA, and
# explains why there are so many levels of quotes.
#
# The locations
#
# We use location.cc just like lalr1.cc, but because glr.c stores
# the locations in a (C++) union, the position and location classes
# must not have a constructor. Therefore, contrary to lalr1.cc, we
# must not define "b4_location_constructors". As a consequence the
# user must initialize the first positions (in particular the
# filename member).
# We require a pure interface using locations.
m4_define([b4_locations_flag], [1])
m4_define([b4_pure_flag], [1])
# The header is mandatory.
b4_defines_if([],
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
m4_include(b4_pkgdatadir/[c++.m4])
b4_percent_define_ifdef([[api.location.type]], [],
[m4_include(b4_pkgdatadir/[location.cc])])
m4_define([b4_parser_class_name],
[b4_percent_define_get([[parser_class_name]])])
# Save the parse parameters.
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
# b4_yy_symbol_print_generate
# ---------------------------
# Bypass the default implementation to generate the "yy_symbol_print"
# and "yy_symbol_value_print" functions.
m4_define([b4_yy_symbol_print_generate],
[[
/*--------------------.
| Print this symbol. |
`--------------------*/
]b4_c_ansi_function_def([yy_symbol_print],
[static void],
[[FILE *], []],
[[int yytype], [yytype]],
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
[yyvaluep]],
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
[yylocationp]],
b4_parse_param)[
{
]b4_parse_param_use[]dnl
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
}
]])[
# Hijack the initial action to initialize the locations.
]b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [],
[m4_define([b4_initial_action],
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
m4_defn([b4_initial_action])]))])])[
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
# and declaration of yyerror.
]m4_append([b4_post_prologue],
[b4_syncline([@oline@], [@ofile@])[
]b4_yylloc_default_define[
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
]b4_c_ansi_function_decl([yyerror],
[static void],
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
[yylocationp]],
b4_parse_param,
[[const char* msg], [msg]])])
# Hijack the epilogue to define implementations (yyerror, parser member
# functions etc.).
m4_append([b4_epilogue],
[b4_syncline([@oline@], [@ofile@])[
/*------------------.
| Report an error. |
`------------------*/
]b4_c_ansi_function_def([yyerror],
[static void],
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
[yylocationp]],
b4_parse_param,
[[const char* msg], [msg]])[
{
]b4_parse_param_use[]dnl
[ yyparser.error (*yylocationp, msg);
}
]b4_namespace_open[
]dnl In this section, the parse param are the original parse_params.
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
[ /// Build a parser object.
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
:])[
#if ]b4_api_PREFIX[DEBUG
]m4_ifset([b4_parse_param], [ ], [ :])[
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
#endif]b4_parse_param_cons[
{
}
]b4_parser_class_name::~b4_parser_class_name[ ()
{
}
int
]b4_parser_class_name[::parse ()
{
return ::yyparse (*this]b4_user_args[);
}
#if ]b4_api_PREFIX[DEBUG
/*--------------------.
| Print this symbol. |
`--------------------*/
inline void
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp)
{
YYUSE (yylocationp);
YYUSE (yyvaluep);
std::ostream& yyoutput = debug_stream ();
std::ostream& yyo = yyoutput;
YYUSE (yyo);
switch (yytype)
{
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
[ default:
break;
}
}
void
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp)
{
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
<< ' ' << yytname[yytype] << " ("
<< *yylocationp << ": ";
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
*yycdebug_ << ')';
}
std::ostream&
]b4_parser_class_name[::debug_stream () const
{
return *yycdebug_;
}
void
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
{
yycdebug_ = &o;
}
]b4_parser_class_name[::debug_level_type
]b4_parser_class_name[::debug_level () const
{
return yydebug;
}
void
]b4_parser_class_name[::set_debug_level (debug_level_type l)
{
// Actually, it is yydebug which is really used.
yydebug = l;
}
#endif
]m4_popdef([b4_parse_param])dnl
b4_namespace_close])
# Let glr.c believe that the user arguments include the parser itself.
m4_ifset([b4_parse_param],
[m4_pushdef([b4_parse_param],
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
m4_defn([b4_parse_param]))],
[m4_pushdef([b4_parse_param],
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
])
m4_include(b4_pkgdatadir/[glr.c])
m4_popdef([b4_parse_param])
b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002-2006, 2009-2012])[
/* C++ GLR parser skeleton written by Akim Demaille. */
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_percent_code_get([[requires]])[
# include <string>
# include <iostream>
]b4_percent_define_ifdef([[api.location.type]], [],
[[# include "location.hh"]])[
]b4_YYDEBUG_define[
]b4_namespace_open[
/// A Bison parser.
class ]b4_parser_class_name[
{
public:
/// Symbol semantic values.
# ifndef ]b4_api_PREFIX[STYPE
]m4_ifdef([b4_stype],
[ union semantic_type
{
b4_user_stype
};],
[m4_if(b4_tag_seen_flag, 0,
[[ typedef int semantic_type;]],
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])[
# else
typedef ]b4_api_PREFIX[STYPE semantic_type;
# endif
/// Symbol locations.
typedef ]b4_percent_define_get([[api.location.type]],
[[location]])[ location_type;
/// Tokens.
struct token
{
]b4_token_enums(b4_tokens)[
};
/// Token type.
typedef token::yytokentype token_type;
/// Build a parser object.
]b4_parser_class_name[ (]b4_parse_param_decl[);
virtual ~]b4_parser_class_name[ ();
/// Parse.
/// \returns 0 iff parsing succeeded.
virtual int parse ();
/// The current debugging stream.
std::ostream& debug_stream () const;
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);
/// Type for debugging levels.
typedef int debug_level_type;
/// The current debugging level.
debug_level_type debug_level () const;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
private:
public:
/// Report a syntax error.
/// \param loc where the syntax error is found.
/// \param msg a description of the syntax error.
virtual void error (const location_type& loc, const std::string& msg);
private:
# if ]b4_api_PREFIX[DEBUG
public:
/// \brief Report a symbol value on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
/// \brief Report a symbol on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
virtual void yy_symbol_print_ (int yytype,
const semantic_type* yyvaluep,
const location_type* yylocationp);
private:
/* Debugging. */
std::ostream* yycdebug_;
# endif
]b4_parse_param_vars[
};
]dnl Redirections for glr.c.
b4_percent_define_flag_if([[global_tokens_and_yystype]],
[b4_token_defines(b4_tokens)])
[
#ifndef ]b4_api_PREFIX[STYPE
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
#endif
#ifndef ]b4_api_PREFIX[LTYPE
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type
#endif
]b4_namespace_close[
]b4_percent_code_get([[provides]])[
]b4_cpp_guard_close([b4_spec_defines_file])[
]b4_output_end()

@ -1,26 +0,0 @@
-*- Autoconf -*-
# Java skeleton dispatching for Bison.
# Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]])
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
m4_include(b4_used_skeleton)

@ -1,304 +0,0 @@
-*- Autoconf -*-
# Java language support for Bison
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_include(b4_pkgdatadir/[c-like.m4])
# b4_comment(TEXT)
# ----------------
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
], [
]) */])
# b4_list2(LIST1, LIST2)
# --------------------------
# Join two lists with a comma if necessary.
m4_define([b4_list2],
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
# b4_percent_define_get3(DEF, PRE, POST, NOT)
# -------------------------------------------
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
# otherwise NOT.
m4_define([b4_percent_define_get3],
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
# b4_flag_value(BOOLEAN-FLAG)
# ---------------------------
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
# b4_public_if(TRUE, FALSE)
# -------------------------
b4_percent_define_default([[public]], [[false]])
m4_define([b4_public_if],
[b4_percent_define_flag_if([public], [$1], [$2])])
# b4_abstract_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[abstract]], [[false]])
m4_define([b4_abstract_if],
[b4_percent_define_flag_if([abstract], [$1], [$2])])
# b4_final_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[final]], [[false]])
m4_define([b4_final_if],
[b4_percent_define_flag_if([final], [$1], [$2])])
# b4_strictfp_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[strictfp]], [[false]])
m4_define([b4_strictfp_if],
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
# b4_lexer_if(TRUE, FALSE)
# ------------------------
m4_define([b4_lexer_if],
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
# b4_identification
# -----------------
m4_define([b4_identification],
[ /** Version number for the Bison executable that generated this parser. */
public static final String bisonVersion = "b4_version";
/** Name of the skeleton that generated this parser. */
public static final String bisonSkeleton = b4_skeleton;
])
## ------------ ##
## Data types. ##
## ------------ ##
# b4_int_type(MIN, MAX)
# ---------------------
# Return the smallest int type able to handle numbers ranging from
# MIN to MAX (included).
m4_define([b4_int_type],
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
b4_ints_in($@, [-32768], [32767]), [1], [short],
[int])])
# b4_int_type_for(NAME)
# ---------------------
# Return the smallest int type able to handle numbers ranging from
# `NAME_min' to `NAME_max' (included).
m4_define([b4_int_type_for],
[b4_int_type($1_min, $1_max)])
# b4_null
# -------
m4_define([b4_null], [null])
## ------------------------- ##
## Assigning token numbers. ##
## ------------------------- ##
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
# ---------------------------------------
# Output the definition of this token as an enum.
m4_define([b4_token_enum],
[ /** Token number, to be returned by the scanner. */
public static final int $1 = $2;
])
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[m4_if([$#$1], [1], [],
[/* Tokens. */
m4_map([b4_token_enum], [$@])])
])
# b4-case(ID, CODE)
# -----------------
# We need to fool Java's stupid unreachable code detection.
m4_define([b4_case], [ case $1:
if (yyn == $1)
$2;
break;
])
## ---------------- ##
## Default values. ##
## ---------------- ##
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
b4_percent_define_default([[stype]], [[Object]])
# %name-prefix
m4_define_default([b4_prefix], [[YY]])
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
b4_percent_define_default([[throws]], [])
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
b4_percent_define_default([[api.location.type]], [Location])
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
b4_percent_define_default([[api.position.type]], [Position])
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
## ----------------- ##
## Semantic Values. ##
## ----------------- ##
# b4_lhs_value([TYPE])
# --------------------
# Expansion of $<TYPE>$.
m4_define([b4_lhs_value], [yyval])
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
# --------------------------------------
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS.
#
# In this simple implementation, %token and %type have class names
# between the angle brackets.
m4_define([b4_rhs_value],
[(m4_ifval($3, [($3)])[](yystack.valueAt ($1-($2))))])
# b4_lhs_location()
# -----------------
# Expansion of @$.
m4_define([b4_lhs_location],
[(yyloc)])
# b4_rhs_location(RULE-LENGTH, NUM)
# ---------------------------------
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS.
m4_define([b4_rhs_location],
[yystack.locationAt ($1-($2))])
# b4_lex_param
# b4_parse_param
# --------------
# If defined, b4_lex_param arrives double quoted, but below we prefer
# it to be single quoted. Same for b4_parse_param.
# TODO: should be in bison.m4
m4_define_default([b4_lex_param], [[]])
m4_define([b4_lex_param], b4_lex_param)
m4_define([b4_parse_param], b4_parse_param)
# b4_lex_param_decl
# -------------------
# Extra formal arguments of the constructor.
m4_define([b4_lex_param_decl],
[m4_ifset([b4_lex_param],
[b4_remove_comma([$1],
b4_param_decls(b4_lex_param))],
[$1])])
m4_define([b4_param_decls],
[m4_map([b4_param_decl], [$@])])
m4_define([b4_param_decl], [, $1])
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
# b4_parse_param_decl
# -------------------
# Extra formal arguments of the constructor.
m4_define([b4_parse_param_decl],
[m4_ifset([b4_parse_param],
[b4_remove_comma([$1],
b4_param_decls(b4_parse_param))],
[$1])])
# b4_lex_param_call
# -------------------
# Delegating the lexer parameters to the lexer constructor.
m4_define([b4_lex_param_call],
[m4_ifset([b4_lex_param],
[b4_remove_comma([$1],
b4_param_calls(b4_lex_param))],
[$1])])
m4_define([b4_param_calls],
[m4_map([b4_param_call], [$@])])
m4_define([b4_param_call], [, $2])
# b4_parse_param_cons
# -------------------
# Extra initialisations of the constructor.
m4_define([b4_parse_param_cons],
[m4_ifset([b4_parse_param],
[b4_constructor_calls(b4_parse_param)])])
m4_define([b4_constructor_calls],
[m4_map([b4_constructor_call], [$@])])
m4_define([b4_constructor_call],
[this.$2 = $2;
])
# b4_parse_param_vars
# -------------------
# Extra instance variables.
m4_define([b4_parse_param_vars],
[m4_ifset([b4_parse_param],
[
/* User arguments. */
b4_var_decls(b4_parse_param)])])
m4_define([b4_var_decls],
[m4_map_sep([b4_var_decl], [
], [$@])])
m4_define([b4_var_decl],
[ protected final $1;])
# b4_maybe_throws(THROWS)
# -----------------------
# Expand to either an empty string or "throws THROWS".
m4_define([b4_maybe_throws],
[m4_ifval($1, [throws $1])])

File diff suppressed because it is too large Load Diff

@ -1,927 +0,0 @@
# Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_include(b4_pkgdatadir/[java.m4])
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], [b4_skeleton])])
m4_ifval(m4_defn([b4_symbol_destructors]),
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
[])
b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2012])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */
]b4_pre_prologue
b4_percent_code_get([[imports]])
[/**
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
*
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
*/
]b4_public_if([public ])dnl
b4_abstract_if([abstract ])dnl
b4_final_if([final ])dnl
b4_strictfp_if([strictfp ])dnl
[class ]b4_parser_class_name[]dnl
b4_percent_define_get3([extends], [ extends ])dnl
b4_percent_define_get3([implements], [ implements ])[
{
]b4_identification[
/** True if verbose error messages are enabled. */
public boolean errorVerbose = ]b4_flag_value([error_verbose]);
b4_locations_if([[
/**
* A class defining a pair of positions. Positions, defined by the
* <code>]b4_position_type[</code> class, denote a point in the input.
* Locations represent a part of the input through the beginning
* and ending positions. */
public class ]b4_location_type[ {
/** The first, inclusive, position in the range. */
public ]b4_position_type[ begin;
/** The first position beyond the range. */
public ]b4_position_type[ end;
/**
* Create a <code>]b4_location_type[</code> denoting an empty range located at
* a given point.
* @@param loc The position at which the range is anchored. */
public ]b4_location_type[ (]b4_position_type[ loc) {
this.begin = this.end = loc;
}
/**
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
* @@param begin The first position included in the range.
* @@param end The first position beyond the range. */
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
this.begin = begin;
this.end = end;
}
/**
* Print a representation of the location. For this to be correct,
* <code>]b4_position_type[</code> should override the <code>equals</code>
* method. */
public String toString () {
if (begin.equals (end))
return begin.toString ();
else
return begin.toString () + "-" + end.toString ();
}
}
]])
[ /** Token returned by the scanner to signal the end of its input. */
public static final int EOF = 0;]
b4_token_enums(b4_tokens)
b4_locations_if([[
private ]b4_location_type[ yylloc (YYStack rhs, int n)
{
if (n > 0)
return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
else
return new ]b4_location_type[ (rhs.locationAt (0).end);
}]])[
/**
* Communication interface between the scanner and the Bison-generated
* parser <tt>]b4_parser_class_name[</tt>.
*/
public interface Lexer {
]b4_locations_if([[/**
* Method to retrieve the beginning position of the last scanned token.
* @@return the position at which the last scanned token starts. */
]b4_position_type[ getStartPos ();
/**
* Method to retrieve the ending position of the last scanned token.
* @@return the first position beyond the last scanned token. */
]b4_position_type[ getEndPos ();]])[
/**
* Method to retrieve the semantic value of the last scanned token.
* @@return the semantic value of the last scanned token. */
]b4_yystype[ getLVal ();
/**
* Entry point for the scanner. Returns the token identifier corresponding
* to the next token and prepares to return the semantic value
* ]b4_locations_if([and beginning/ending positions ])[of the token.
* @@return the token identifier corresponding to the next token. */
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
/**
* Entry point for error reporting. Emits an error
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
*
* ]b4_locations_if([[@@param loc The location of the element to which the
* error message is related]])[
* @@param s The string for the error message. */
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
}
b4_lexer_if([[private class YYLexer implements Lexer {
]b4_percent_code_get([[lexer]])[
}
]])[/** The object doing lexical analysis for us. */
private Lexer yylexer;
]
b4_parse_param_vars
b4_lexer_if([[
/**
* Instantiates the Bison-generated parser.
*/
public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) {
this.yylexer = new YYLexer(]b4_lex_param_call[);
]b4_parse_param_cons[
}
]])
/**
* Instantiates the Bison-generated parser.
* @@param yylexer The scanner that will supply tokens to the parser.
*/
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
this.yylexer = yylexer;
]b4_parse_param_cons[
}
private java.io.PrintStream yyDebugStream = System.err;
/**
* Return the <tt>PrintStream</tt> on which the debugging output is
* printed.
*/
public final java.io.PrintStream getDebugStream () { return yyDebugStream; }
/**
* Set the <tt>PrintStream</tt> on which the debug output is printed.
* @@param s The stream that is used for debugging output.
*/
public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; }
private int yydebug = 0;
/**
* Answer the verbosity of the debugging output; 0 means that all kinds of
* output from the parser are suppressed.
*/
public final int getDebugLevel() { return yydebug; }
/**
* Set the verbosity of the debugging output; 0 means that all kinds of
* output from the parser are suppressed.
* @@param level The verbosity level for debugging output.
*/
public final void setDebugLevel(int level) { yydebug = level; }
private final int yylex () ]b4_maybe_throws([b4_lex_throws]) [{
return yylexer.yylex ();
}
protected final void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s) {
yylexer.yyerror (]b4_locations_if([loc, ])[s);
}
]b4_locations_if([
protected final void yyerror (String s) {
yylexer.yyerror ((]b4_location_type[)null, s);
}
protected final void yyerror (]b4_position_type[ loc, String s) {
yylexer.yyerror (new ]b4_location_type[ (loc), s);
}])
[protected final void yycdebug (String s) {
if (yydebug > 0)
yyDebugStream.println (s);
}
private final class YYStack {
private int[] stateStack = new int[16];
]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
public int size = 16;
public int height = -1;
public final void push (int state, ]b4_yystype[ value]dnl
b4_locations_if([, ]b4_location_type[ loc])[) {
height++;
if (size == height)
{
int[] newStateStack = new int[size * 2];
System.arraycopy (stateStack, 0, newStateStack, 0, height);
stateStack = newStateStack;
]b4_locations_if([[
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
System.arraycopy (locStack, 0, newLocStack, 0, height);
locStack = newLocStack;]])
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
System.arraycopy (valueStack, 0, newValueStack, 0, height);
valueStack = newValueStack;
size *= 2;
}
stateStack[height] = state;
]b4_locations_if([[locStack[height] = loc;]])[
valueStack[height] = value;
}
public final void pop () {
pop (1);
}
public final void pop (int num) {
// Avoid memory leaks... garbage collection is a white lie!
if (num > 0) {
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
}
height -= num;
}
public final int stateAt (int i) {
return stateStack[height - i];
}
]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) {
return locStack[height - i];
}
]])[public final ]b4_yystype[ valueAt (int i) {
return valueStack[height - i];
}
// Print the state stack on the debug stream.
public void print (java.io.PrintStream out)
{
out.print ("Stack now");
for (int i = 0; i <= height; i++)
{
out.print (' ');
out.print (stateStack[i]);
}
out.println ();
}
}
/**
* Returned by a Bison action in order to stop the parsing process and
* return success (<tt>true</tt>). */
public static final int YYACCEPT = 0;
/**
* Returned by a Bison action in order to stop the parsing process and
* return failure (<tt>false</tt>). */
public static final int YYABORT = 1;
/**
* Returned by a Bison action in order to start error recovery without
* printing an error message. */
public static final int YYERROR = 2;
// Internal return codes that are not supported for user semantic
// actions.
private static final int YYERRLAB = 3;
private static final int YYNEWSTATE = 4;
private static final int YYDEFAULT = 5;
private static final int YYREDUCE = 6;
private static final int YYERRLAB1 = 7;
private static final int YYRETURN = 8;
private int yyerrstatus_ = 0;
/**
* Return whether error recovery is being done. In this state, the parser
* reads token until it reaches a known state, and then restarts normal
* operation. */
public final boolean recovering ()
{
return yyerrstatus_ == 0;
}
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
{
]b4_yystype[ yyval;
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'. Otherwise, use the top of the stack.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. */
if (yylen > 0)
yyval = yystack.valueAt (yylen - 1);
else
yyval = yystack.valueAt (0);
yy_reduce_print (yyn, yystack);
switch (yyn)
{
]b4_user_actions[
default: break;
}
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
yystack.pop (yylen);
yylen = 0;
/* Shift the result of the reduction. */
yyn = yyr1_[yyn];
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
if (0 <= yystate && yystate <= yylast_
&& yycheck_[yystate] == yystack.stateAt (0))
yystate = yytable_[yystate];
else
yystate = yydefgoto_[yyn - yyntokens_];
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
return YYNEWSTATE;
}
/* Return YYSTR after stripping away unnecessary quotes and
backslashes, so that it's suitable for yyerror. The heuristic is
that double-quoting is unnecessary unless the string contains an
apostrophe, a comma, or backslash (other than backslash-backslash).
YYSTR is taken from yytname. */
private final String yytnamerr_ (String yystr)
{
if (yystr.charAt (0) == '"')
{
StringBuffer yyr = new StringBuffer ();
strip_quotes: for (int i = 1; i < yystr.length (); i++)
switch (yystr.charAt (i))
{
case '\'':
case ',':
break strip_quotes;
case '\\':
if (yystr.charAt(++i) != '\\')
break strip_quotes;
/* Fall through. */
default:
yyr.append (yystr.charAt (i));
break;
case '"':
return yyr.toString ();
}
}
else if (yystr.equals ("$end"))
return "end of input";
return yystr;
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
private void yy_symbol_print (String s, int yytype,
]b4_yystype[ yyvaluep]dnl
b4_locations_if([, Object yylocationp])[)
{
if (yydebug > 0)
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
+ yytname_[yytype] + " ("]b4_locations_if([
+ yylocationp + ": "])[
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
}
/**
* Parse input from the scanner that was specified at object construction
* time. Return whether the end of the input was reached successfully.
*
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
* imply that there were no syntax errors.
*/
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
{
/// Lookahead and lookahead in internal form.
int yychar = yyempty_;
int yytoken = 0;
/* State. */
int yyn = 0;
int yylen = 0;
int yystate = 0;
YYStack yystack = new YYStack ();
/* Error handling. */
int yynerrs_ = 0;
]b4_locations_if([/// The location where the error started.
]b4_location_type[ yyerrloc = null;
/// ]b4_location_type[ of the lookahead.
]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
/// @@$.
]b4_location_type[ yyloc;])
/// Semantic value of the lookahead.
b4_yystype[ yylval = null;
yycdebug ("Starting parse\n");
yyerrstatus_ = 0;
]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yylval], [], [yylloc])dnl
/* User initialization code. */
b4_user_initial_action
b4_dollar_popdef])[]dnl
[ /* Initialize the stack. */
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
int label = YYNEWSTATE;
for (;;)
switch (label)
{
/* New state. Unlike in the C/C++ skeletons, the state is already
pushed when we come here. */
case YYNEWSTATE:
yycdebug ("Entering state " + yystate + "\n");
if (yydebug > 0)
yystack.print (yyDebugStream);
/* Accept? */
if (yystate == yyfinal_)
return true;
/* Take a decision. First try without lookahead. */
yyn = yypact_[yystate];
if (yy_pact_value_is_default_ (yyn))
{
label = YYDEFAULT;
break;
}
/* Read a lookahead token. */
if (yychar == yyempty_)
{
yycdebug ("Reading a token: ");
yychar = yylex ();]
b4_locations_if([[
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
yylexer.getEndPos ());]])
yylval = yylexer.getLVal ();[
}
/* Convert token to internal form. */
if (yychar <= EOF)
{
yychar = yytoken = EOF;
yycdebug ("Now at end of input.\n");
}
else
{
yytoken = yytranslate_ (yychar);
yy_symbol_print ("Next token is", yytoken,
yylval]b4_locations_if([, yylloc])[);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
label = YYDEFAULT;
/* <= 0 means reduce or error. */
else if ((yyn = yytable_[yyn]) <= 0)
{
if (yy_table_value_is_error_ (yyn))
label = YYERRLAB;
else
{
yyn = -yyn;
label = YYREDUCE;
}
}
else
{
/* Shift the lookahead token. */
yy_symbol_print ("Shifting", yytoken,
yylval]b4_locations_if([, yylloc])[);
/* Discard the token being shifted. */
yychar = yyempty_;
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus_ > 0)
--yyerrstatus_;
yystate = yyn;
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
label = YYNEWSTATE;
}
break;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
case YYDEFAULT:
yyn = yydefact_[yystate];
if (yyn == 0)
label = YYERRLAB;
else
label = YYREDUCE;
break;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
case YYREDUCE:
yylen = yyr2_[yyn];
label = yyaction (yyn, yystack, yylen);
yystate = yystack.stateAt (0);
break;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
case YYERRLAB:
/* If not already recovering from an error, report this error. */
if (yyerrstatus_ == 0)
{
++yynerrs_;
if (yychar == yyempty_)
yytoken = yyempty_;
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
}
]b4_locations_if([yyerrloc = yylloc;])[
if (yyerrstatus_ == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= EOF)
{
/* Return failure if at end of input. */
if (yychar == EOF)
return false;
}
else
yychar = yyempty_;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
label = YYERRLAB1;
break;
/*---------------------------------------------------.
| errorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
case YYERROR:
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
yystack.pop (yylen);
yylen = 0;
yystate = yystack.stateAt (0);
label = YYERRLAB1;
break;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
case YYERRLAB1:
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact_[yystate];
if (!yy_pact_value_is_default_ (yyn))
{
yyn += yyterror_;
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
{
yyn = yytable_[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yystack.height == 0)
return false;
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
yystack.pop ();
yystate = yystack.stateAt (0);
if (yydebug > 0)
yystack.print (yyDebugStream);
}
]b4_locations_if([
/* Muck with the stack to setup for yylloc. */
yystack.push (0, null, yylloc);
yystack.push (0, null, yyerrloc);
yyloc = yylloc (yystack, 2);
yystack.pop (2);])[
/* Shift the error token. */
yy_symbol_print ("Shifting", yystos_[yyn],
yylval]b4_locations_if([, yyloc])[);
yystate = yyn;
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
label = YYNEWSTATE;
break;
/* Accept. */
case YYACCEPT:
return true;
/* Abort. */
case YYABORT:
return false;
}
}
// Generate an error message.
private String yysyntax_error (int yystate, int tok)
{
if (errorVerbose)
{
/* There are many possibilities here to consider:
- Assume YYFAIL is not used. It's too flawed to consider.
See
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
for details. YYERROR is fine as it does not invoke this
function.
- If this state is a consistent state with a default action,
then the only way this function was invoked is if the
default action is an error action. In that case, don't
check for expected tokens because there are none.
- The only way there can be no lookahead present (in tok) is
if this state is a consistent state with a default action.
Thus, detecting the absence of a lookahead is sufficient to
determine that there is no unexpected or expected token to
report. In that case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this
state is a consistent state with a default action. There
might have been a previous inconsistent state, consistent
state with a non-default action, or user semantic action
that manipulated yychar. (However, yychar is currently out
of scope during semantic actions.)
- Of course, the expected token list depends on states to
have correct lookahead information, and it depends on the
parser not to perform extra reductions after fetching a
lookahead from the scanner and before detecting a syntax
error. Thus, state merging (from LALR or IELR) and default
reductions corrupt the expected token list. However, the
list is correct for canonical LR with one exception: it
will still contain any token that will not be accepted due
to an error action in a later state.
*/
if (tok != yyempty_)
{
// FIXME: This method of building the message is not compatible
// with internationalization.
StringBuffer res =
new StringBuffer ("syntax error, unexpected ");
res.append (yytnamerr_ (yytname_[tok]));
int yyn = yypact_[yystate];
if (!yy_pact_value_is_default_ (yyn))
{
/* Start YYX at -YYN if negative to avoid negative
indexes in YYCHECK. In other words, skip the first
-YYN actions for this state because they are default
actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = yylast_ - yyn + 1;
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
int count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
if (yycheck_[x + yyn] == x && x != yyterror_
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
++count;
if (count < 5)
{
count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
if (yycheck_[x + yyn] == x && x != yyterror_
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
{
res.append (count++ == 0 ? ", expecting " : " or ");
res.append (yytnamerr_ (yytname_[x]));
}
}
}
return res.toString ();
}
}
return "syntax error";
}
/**
* Whether the given <code>yypact_</code> value indicates a defaulted state.
* @@param yyvalue the value to check
*/
private static boolean yy_pact_value_is_default_ (int yyvalue)
{
return yyvalue == yypact_ninf_;
}
/**
* Whether the given <code>yytable_</code> value indicates a syntax error.
* @@param yyvalue the value to check
*/
private static boolean yy_table_value_is_error_ (int yyvalue)
{
return yyvalue == yytable_ninf_;
}
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
private static final ]b4_int_type_for([b4_pact])[ yypact_[] =
{
]b4_pact[
};
/* YYDEFACT[S] -- default reduction number in state S. Performed when
YYTABLE doesn't specify something else to do. Zero means the
default is an error. */
private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
{
]b4_defact[
};
/* YYPGOTO[NTERM-NUM]. */
private static final ]b4_int_type_for([b4_pgoto])[ yypgoto_[] =
{
]b4_pgoto[
};
/* YYDEFGOTO[NTERM-NUM]. */
private static final ]b4_int_type_for([b4_defgoto])[
yydefgoto_[] =
{
]b4_defgoto[
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If YYTABLE_NINF_, syntax error. */
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
private static final ]b4_int_type_for([b4_table])[
yytable_[] =
{
]b4_table[
};
/* YYCHECK. */
private static final ]b4_int_type_for([b4_check])[
yycheck_[] =
{
]b4_check[
};
/* STOS_[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
private static final ]b4_int_type_for([b4_stos])[
yystos_[] =
{
]b4_stos[
};
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
to YYLEX-NUM. */
private static final ]b4_int_type_for([b4_toknum])[
yytoken_number_[] =
{
]b4_toknum[
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
private static final ]b4_int_type_for([b4_r1])[
yyr1_[] =
{
]b4_r1[
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
private static final ]b4_int_type_for([b4_r2])[
yyr2_[] =
{
]b4_r2[
};
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
private static final String yytname_[] =
{
]b4_tname[
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
private static final ]b4_int_type_for([b4_rhs])[ yyrhs_[] =
{
]b4_rhs[
};
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
private static final ]b4_int_type_for([b4_prhs])[ yyprhs_[] =
{
]b4_prhs[
};
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
private static final ]b4_int_type_for([b4_rline])[ yyrline_[] =
{
]b4_rline[
};
// Report on the debug stream that the rule yyrule is going to be reduced.
private void yy_reduce_print (int yyrule, YYStack yystack)
{
if (yydebug == 0)
return;
int yylno = yyrline_[yyrule];
int yynrhs = yyr2_[yyrule];
/* Print the symbols being reduced, and their result. */
yycdebug ("Reducing stack by rule " + (yyrule - 1)
+ " (line " + yylno + "), ");
/* The symbols being reduced. */
for (int yyi = 0; yyi < yynrhs; yyi++)
yy_symbol_print (" $" + (yyi + 1) + " =",
yyrhs_[yyprhs_[yyrule] + yyi],
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
b4_rhs_location(yynrhs, yyi + 1)])[);
}
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
private static final ]b4_int_type_for([b4_translate])[ yytranslate_table_[] =
{
]b4_translate[
};
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
{
if (t >= 0 && t <= yyuser_token_number_max_)
return yytranslate_table_[t];
else
return yyundef_token_;
}
private static final int yylast_ = ]b4_last[;
private static final int yynnts_ = ]b4_nterms_number[;
private static final int yyempty_ = -2;
private static final int yyfinal_ = ]b4_final_state_number[;
private static final int yyterror_ = 1;
private static final int yyerrcode_ = 256;
private static final int yyntokens_ = ]b4_tokens_number[;
private static final int yyuser_token_number_max_ = ]b4_user_token_number_max[;
private static final int yyundef_token_ = ]b4_undef_token_number[;
]/* User implementation code. */
b4_percent_code_get[]dnl
}
b4_epilogue
b4_output_end()

@ -1,299 +0,0 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2007, 2009-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
b4_output_begin([b4_dir_prefix[]position.hh])
b4_copyright([Positions for Bison parsers in C++],
[2002-2007, 2009-2012])[
/**
** \file ]b4_dir_prefix[position.hh
** Define the ]b4_namespace_ref[::position class.
*/
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
# include <algorithm> // std::max
# include <iostream>
# include <string>
]b4_null_define[
]b4_namespace_open[
/// Abstract a position.
class position
{
public:
]m4_ifdef([b4_location_constructors], [[
/// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
: filename (f)
, line (l)
, column (c)
{
}
]])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
{
filename = fn;
line = l;
column = c;
}
/** \name Line and Column related manipulators
** \{ */
/// (line related) Advance to the COUNT next lines.
void lines (int count = 1)
{
column = ]b4_location_initial_column[u;
line += count;
}
/// (column related) Advance to the COUNT next columns.
void columns (int count = 1)
{
column = std::max (]b4_location_initial_column[u, column + count);
}
/** \} */
/// File name to which this position refers.
]b4_percent_define_get([[filename_type]])[* filename;
/// Current line number.
unsigned int line;
/// Current column number.
unsigned int column;
};
/// Add and assign a position.
inline position&
operator+= (position& res, const int width)
{
res.columns (width);
return res;
}
/// Add two position objects.
inline const position
operator+ (const position& begin, const int width)
{
position res = begin;
return res += width;
}
/// Add and assign a position.
inline position&
operator-= (position& res, const int width)
{
return res += -width;
}
/// Add two position objects.
inline const position
operator- (const position& begin, const int width)
{
return begin + -width;
}
]b4_percent_define_flag_if([[define_location_comparison]], [[
/// Compare two position objects.
inline bool
operator== (const position& pos1, const position& pos2)
{
return (pos1.line == pos2.line
&& pos1.column == pos2.column
&& (pos1.filename == pos2.filename
|| (pos1.filename && pos2.filename
&& *pos1.filename == *pos2.filename)));
}
/// Compare two position objects.
inline bool
operator!= (const position& pos1, const position& pos2)
{
return !(pos1 == pos2);
}
]])[
/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param pos a reference to the position to redirect
*/
template <typename YYChar>
inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
{
if (pos.filename)
ostr << *pos.filename << ':';
return ostr << pos.line << '.' << pos.column;
}
]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
b4_output_end()
b4_output_begin([b4_dir_prefix[]location.hh])
b4_copyright([Locations for Bison parsers in C++],
[2002-2007, 2009-2012])[
/**
** \file ]b4_dir_prefix[location.hh
** Define the ]b4_namespace_ref[::location class.
*/
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
# include "position.hh"
]b4_namespace_open[
/// Abstract a location.
class location
{
public:
]m4_ifdef([b4_location_constructors], [
/// Construct a location from \a b to \a e.
location (const position& b, const position& e)
: begin (b)
, end (e)
{
}
/// Construct a 0-width location in \a p.
explicit location (const position& p = position ())
: begin (p)
, end (p)
{
}
/// Construct a 0-width location in \a f, \a l, \a c.
explicit location (]b4_percent_define_get([[filename_type]])[* f,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
: begin (f, l, c)
, end (f, l, c)
{
}
])[
/// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u)
{
begin.initialize (f, l, c);
end = begin;
}
/** \name Line and Column related manipulators
** \{ */
public:
/// Reset initial location to final location.
void step ()
{
begin = end;
}
/// Extend the current location to the COUNT next columns.
void columns (unsigned int count = 1)
{
end += count;
}
/// Extend the current location to the COUNT next lines.
void lines (unsigned int count = 1)
{
end.lines (count);
}
/** \} */
public:
/// Beginning of the located region.
position begin;
/// End of the located region.
position end;
};
/// Join two location objects to create a location.
inline const location operator+ (const location& begin, const location& end)
{
location res = begin;
res.end = end.end;
return res;
}
/// Add two location objects.
inline const location operator+ (const location& begin, unsigned int width)
{
location res = begin;
res.columns (width);
return res;
}
/// Add and assign a location.
inline location& operator+= (location& res, unsigned int width)
{
res.columns (width);
return res;
}
]b4_percent_define_flag_if([[define_location_comparison]], [[
/// Compare two location objects.
inline bool
operator== (const location& loc1, const location& loc2)
{
return loc1.begin == loc2.begin && loc1.end == loc2.end;
}
/// Compare two location objects.
inline bool
operator!= (const location& loc1, const location& loc2)
{
return !(loc1 == loc2);
}
]])[
/** \brief Intercept output stream redirection.
** \param ostr the destination output stream
** \param loc a reference to the location to redirect
**
** Avoid duplicate information.
*/
template <typename YYChar>
inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{
position last = loc.end - 1;
ostr << loc.begin;
if (last.filename
&& (!loc.begin.filename
|| *loc.begin.filename != *last.filename))
ostr << '-' << last;
else if (loc.begin.line != last.line)
ostr << '-' << last.line << '.' << last.column;
else if (loc.begin.column != last.column)
ostr << '-' << last.column;
return ostr;
}
]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
b4_output_end()

@ -1,362 +0,0 @@
# -*- Autoconf -*-
# This file is part of Autoconf.
# foreach-based replacements for recursive functions.
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
# GNU M4 1.6 by requiring more memory and macro expansions.
#
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
# This file is part of Autoconf. This program is free
# software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Under Section 7 of GPL version 3, you are granted additional
# permissions described in the Autoconf Configure Script Exception,
# version 3.0, as published by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License
# and a copy of the Autoconf Configure Script Exception along with
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
# respectively. If not, see <http://www.gnu.org/licenses/>.
# Written by Eric Blake.
# In M4 1.4.x, every byte of $@ is rescanned. This means that an
# algorithm on n arguments that recurses with one less argument each
# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time. In
# M4 1.6, this was fixed so that $@ is only scanned once, then
# back-references are made to information stored about the scan.
# Thus, n iterations need only scan n arguments, for O(n) time.
# Additionally, in M4 1.4.x, recursive algorithms did not clean up
# memory very well, requiring O(n^2) memory rather than O(n) for n
# iterations.
#
# This file is designed to overcome the quadratic nature of $@
# recursion by writing a variant of m4_foreach that uses m4_for rather
# than $@ recursion to operate on the list. This involves more macro
# expansions, but avoids the need to rescan a quadratic number of
# arguments, making these replacements very attractive for M4 1.4.x.
# On the other hand, in any version of M4, expanding additional macros
# costs additional time; therefore, in M4 1.6, where $@ recursion uses
# fewer macros, these replacements actually pessimize performance.
# Additionally, the use of $10 to mean the tenth argument violates
# POSIX; although all versions of m4 1.4.x support this meaning, a
# future m4 version may switch to take it as the first argument
# concatenated with a literal 0, so the implementations in this file
# are not future-proof. Thus, this file is conditionally included as
# part of m4_init(), only when it is detected that M4 probably has
# quadratic behavior (ie. it lacks the macro __m4_version__).
#
# Please keep this file in sync with m4sugar.m4.
# _m4_foreach(PRE, POST, IGNORED, ARG...)
# ---------------------------------------
# Form the common basis of the m4_foreach and m4_map macros. For each
# ARG, expand PRE[ARG]POST[]. The IGNORED argument makes recursion
# easier, and must be supplied rather than implicit.
#
# This version minimizes the number of times that $@ is evaluated by
# using m4_for to generate a boilerplate into _m4_f then passing $@ to
# that temporary macro. Thus, the recursion is done in m4_for without
# reparsing any user input, and is not quadratic. For an idea of how
# this works, note that m4_foreach(i,[1,2],[i]) calls
# _m4_foreach([m4_define([i],],[)i],[],[1],[2])
# which defines _m4_f:
# $1[$4]$2[]$1[$5]$2[]_m4_popdef([_m4_f])
# then calls _m4_f([m4_define([i],],[)i],[],[1],[2]) for a net result:
# m4_define([i],[1])i[]m4_define([i],[2])i[]_m4_popdef([_m4_f]).
m4_define([_m4_foreach],
[m4_if([$#], [3], [],
[m4_pushdef([_m4_f], _m4_for([4], [$#], [1],
[$0_([1], [2],], [)])[_m4_popdef([_m4_f])])_m4_f($@)])])
m4_define([_m4_foreach_],
[[$$1[$$3]$$2[]]])
# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
# -----------------------------------------------------------
# Find the first VAL that SWITCH matches, and expand the corresponding
# IF-VAL. If there are no matches, expand DEFAULT.
#
# Use m4_for to create a temporary macro in terms of a boilerplate
# m4_if with final cleanup. If $# is even, we have DEFAULT; if it is
# odd, then rounding the last $# up in the temporary macro is
# harmless. For example, both m4_case(1,2,3,4,5) and
# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being
# m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6])
m4_define([m4_case],
[m4_if(m4_eval([$# <= 2]), [1], [$2],
[m4_pushdef([_$0], [m4_if(]_m4_for([2], m4_eval([($# - 1) / 2 * 2]), [2],
[_$0_(], [)])[_m4_popdef(
[_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])])
m4_define([_m4_case_],
[$0_([1], [$1], m4_incr([$1]))])
m4_define([_m4_case__],
[[[$$1],[$$2],[$$3],]])
# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
# -----------------------------------------------------
# m4 equivalent of
#
# if (SWITCH =~ RE1)
# VAL1;
# elif (SWITCH =~ RE2)
# VAL2;
# elif ...
# ...
# else
# DEFAULT
#
# We build the temporary macro _m4_b:
# m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
# _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
# then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
m4_define([m4_bmatch],
[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
[$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
[$#], 2, [$2],
[m4_pushdef([_m4_b], [m4_define([_m4_b],
_m4_defn([_$0]))]_m4_for([3], m4_eval([($# + 1) / 2 * 2 - 1]),
[2], [_$0_(], [)])[_m4_b([], [],]m4_dquote([$]m4_eval(
[($# + 1) / 2 * 2]))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
m4_define([_m4_bmatch],
[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])
m4_define([_m4_bmatch_],
[$0_([1], m4_decr([$1]), [$1])])
m4_define([_m4_bmatch__],
[[_m4_b([$$1], [$$2], [$$3])]])
# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
# -------------------------------------------------------------------
# Similar to m4_if, except that each TEST is expanded when encountered.
# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
# The result is DEFAULT if no tests passed. This macro allows
# short-circuiting of expensive tests, where it pays to arrange quick
# filter tests to run first.
#
# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n.
# We only have to speed up _m4_cond, by building the temporary _m4_c:
# m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)],
# [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)],
# [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)],
# [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c]))
# We invoke m4_unquote(_m4_c($@)), for concatenation with later text.
m4_define([_m4_cond],
[m4_pushdef([_m4_c], [m4_define([_m4_c],
_m4_defn([m4_unquote]))]_m4_for([2], m4_eval([$# / 3 * 3 - 1]), [3],
[$0_(], [)])[_m4_c(]m4_dquote(m4_dquote(
[$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))])
m4_define([_m4_cond_],
[$0_(m4_decr([$1]), [$1], m4_incr([$1]))])
m4_define([_m4_cond__],
[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]])
# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
# ----------------------------------------------------
# m4 equivalent of
#
# $_ = STRING;
# s/RE1/SUBST1/g;
# s/RE2/SUBST2/g;
# ...
#
# m4_bpatsubsts already validated an odd number of arguments; we only
# need to speed up _m4_bpatsubsts. To avoid nesting, we build the
# temporary _m4_p:
# m4_define([_m4_p], [$1])m4_define([_m4_p],
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p],
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],...
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote(
# _m4_defn([_m4_p])_m4_popdef([_m4_p]))
m4_define([_m4_bpatsubsts],
[m4_pushdef([_m4_p], [m4_define([_m4_p],
]m4_dquote([$]1)[)]_m4_for([3], [$#], [2], [$0_(],
[)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)])
m4_define([_m4_bpatsubsts_],
[$0_(m4_decr([$1]), [$1])])
m4_define([_m4_bpatsubsts__],
[[m4_define([_m4_p],
m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
#
# m4_shiftn already validated arguments; we only need to speed up
# _m4_shiftn. If N is 3, then we build the temporary _m4_s, defined as
# ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
# before calling m4_shift(_m4_s($@)).
m4_define([_m4_shiftn],
[m4_if(m4_incr([$1]), [$#], [], [m4_pushdef([_m4_s],
_m4_for(m4_eval([$1 + 2]), [$#], [1],
[[,]m4_dquote($], [)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
# m4_do(STRING, ...)
# ------------------
# This macro invokes all its arguments (in sequence, of course). It is
# useful for making your macros more structured and readable by dropping
# unnecessary dnl's and have the macros indented properly.
#
# Here, we use the temporary macro _m4_do, defined as
# $1[]$2[]...[]$n[]_m4_popdef([_m4_do])
m4_define([m4_do],
[m4_if([$#], [0], [],
[m4_pushdef([_$0], _m4_for([1], [$#], [1],
[$], [[[]]])[_m4_popdef([_$0])])_$0($@)])])
# m4_dquote_elt(ARGS)
# -------------------
# Return ARGS as an unquoted list of double-quoted arguments.
#
# _m4_foreach to the rescue.
m4_define([m4_dquote_elt],
[m4_if([$#], [0], [], [[[$1]]_m4_foreach([,m4_dquote(], [)], $@)])])
# m4_reverse(ARGS)
# ----------------
# Output ARGS in reverse order.
#
# Invoke _m4_r($@) with the temporary _m4_r built as
# [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r])
m4_define([m4_reverse],
[m4_if([$#], [0], [], [$#], [1], [[$1]],
[m4_pushdef([_m4_r], [[$$#]]_m4_for(m4_decr([$#]), [1], [-1],
[[, ]m4_dquote($], [)])[_m4_popdef([_m4_r])])_m4_r($@)])])
# m4_map_args_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
# -------------------------------------------------------------
# Perform a pairwise grouping of consecutive ARGs, by expanding
# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the
# final argument is expanded with END-EXPR([ARGn]).
#
# Build the temporary macro _m4_map_args_pair, with the $2([$m+1])
# only output if $# is odd:
# $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1],
# [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_map_args_pair])
m4_define([m4_map_args_pair],
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
[$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
[$#], [2], [],
[$#], [3], [m4_default([$2], [$1])([$3])[]],
[m4_pushdef([_$0], _m4_for([3],
m4_eval([$# / 2 * 2 - 1]), [2], [_$0_(], [)])_$0_end(
[1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])])
m4_define([_m4_map_args_pair_],
[$0_([1], [$1], m4_incr([$1]))])
m4_define([_m4_map_args_pair__],
[[$$1([$$2], [$$3])[]]])
m4_define([_m4_map_args_pair_end],
[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])])
# m4_join(SEP, ARG1, ARG2...)
# ---------------------------
# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG
# is the empty string. No expansion is performed on SEP or ARGs.
#
# Use a self-modifying separator, since we don't know how many
# arguments might be skipped before a separator is first printed, but
# be careful if the separator contains $. _m4_foreach to the rescue.
m4_define([m4_join],
[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl
[_m4_foreach([_$0([$1],], [)], $@)_m4_popdef([_m4_sep])])
m4_define([_m4_join],
[m4_if([$2], [], [], [_m4_sep([$1])[$2]])])
# m4_joinall(SEP, ARG1, ARG2...)
# ------------------------------
# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP.
# No expansion is performed on SEP or ARGs.
#
# A bit easier than m4_join. _m4_foreach to the rescue.
m4_define([m4_joinall],
[[$2]m4_if(m4_eval([$# <= 2]), [1], [],
[_m4_foreach([$1], [], m4_shift($@))])])
# m4_list_cmp(A, B)
# -----------------
# Compare the two lists of integer expressions A and B.
#
# m4_list_cmp takes care of any side effects; we only override
# _m4_list_cmp_raw, where we can safely expand lists multiple times.
# First, insert padding so that both lists are the same length; the
# trailing +0 is necessary to handle a missing list. Next, create a
# temporary macro to perform pairwise comparisons until an inequality
# is found. For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as
# m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])],
# m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])],
# [0]_m4_popdef([_m4_cmp]))
# then calls _m4_cmp([1+0], [0*2], [1], [2+0])
m4_define([_m4_list_cmp_raw],
[m4_if([$1], [$2], 0,
[_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)),
$2+0_m4_list_pad(m4_count($2), m4_count($1)))])])
m4_define([_m4_list_pad],
[m4_if(m4_eval($1 < $2), [1],
[_m4_for(m4_incr([$1]), [$2], [1], [,0*])])])
m4_define([_m4_list_cmp],
[m4_pushdef([_m4_cmp], [m4_if(]_m4_for(
[1], m4_eval([$# >> 1]), [1], [$0_(], [,]m4_eval([$# >> 1])[)])[
[0]_m4_popdef([_m4_cmp]))])_m4_cmp($@)])
m4_define([_m4_list_cmp_],
[$0_([$1], m4_eval([$1 + $2]))])
m4_define([_m4_list_cmp__],
[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])],
]])
# m4_max(EXPR, ...)
# m4_min(EXPR, ...)
# -----------------
# Return the decimal value of the maximum (or minimum) in a series of
# integer expressions.
#
# _m4_foreach to the rescue; we only need to replace _m4_minmax. Here,
# we need a temporary macro to track the best answer so far, so that
# the foreach expression is tractable.
m4_define([_m4_minmax],
[m4_pushdef([_m4_best], m4_eval([$2]))_m4_foreach(
[m4_define([_m4_best], $1(_m4_best,], [))], m4_shift($@))]dnl
[_m4_best[]_m4_popdef([_m4_best])])
# m4_set_add_all(SET, VALUE...)
# -----------------------------
# Add each VALUE into SET. This is O(n) in the number of VALUEs, and
# can be faster than calling m4_set_add for each VALUE.
#
# _m4_foreach to the rescue. If no deletions have occurred, then
# avoid the speed penalty of m4_set_add.
m4_define([m4_set_add_all],
[m4_if([$#], [0], [], [$#], [1], [],
[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
+ m4_len(_m4_foreach(m4_ifdef([_m4_set_cleanup($1)],
[[m4_set_add]], [[_$0]])[([$1],], [)], $@))))])])
m4_define([_m4_set_add_all],
[m4_ifdef([_m4_set([$1],$2)], [],
[m4_define([_m4_set([$1],$2)],
[1])m4_pushdef([_m4_set([$1])], [$2])-])])

File diff suppressed because it is too large Load Diff

@ -1,121 +0,0 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years],
[2002-2012])
b4_output_begin([b4_dir_prefix[]stack.hh])
b4_copyright([Stack handling for Bison parsers in C++],
[2002-2012])[
/**
** \file ]b4_dir_prefix[stack.hh
** Define the ]b4_namespace_ref[::stack class.
*/
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
# include <deque>
]b4_namespace_open[
template <class T, class S = std::deque<T> >
class stack
{
public:
// Hide our reversed order.
typedef typename S::reverse_iterator iterator;
typedef typename S::const_reverse_iterator const_iterator;
stack () : seq_ ()
{
}
stack (unsigned int n) : seq_ (n)
{
}
inline
T&
operator [] (unsigned int i)
{
return seq_[i];
}
inline
const T&
operator [] (unsigned int i) const
{
return seq_[i];
}
inline
void
push (const T& t)
{
seq_.push_front (t);
}
inline
void
pop (unsigned int n = 1)
{
for (; n; --n)
seq_.pop_front ();
}
inline
unsigned int
height () const
{
return seq_.size ();
}
inline const_iterator begin () const { return seq_.rbegin (); }
inline const_iterator end () const { return seq_.rend (); }
private:
S seq_;
};
/// Present a slice of the top of a stack.
template <class T, class S = stack<T> >
class slice
{
public:
slice (const S& stack, unsigned int range)
: stack_ (stack)
, range_ (range)
{
}
inline
const T&
operator [] (unsigned int i) const
{
return stack_[range_ - i];
}
private:
const S& stack_;
unsigned int range_;
};
]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
b4_output_end()
m4_popdef([b4_copyright_years])

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
bison.xsl - common templates for Bison XSLT.
Copyright (C) 2007-2012 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bison="http://www.gnu.org/software/bison/">
<xsl:key
name="bison:symbolByName"
match="/bison-xml-report/grammar/nonterminals/nonterminal"
use="@name"
/>
<xsl:key
name="bison:symbolByName"
match="/bison-xml-report/grammar/terminals/terminal"
use="@name"
/>
<xsl:key
name="bison:ruleByNumber"
match="/bison-xml-report/grammar/rules/rule"
use="@number"
/>
<xsl:key
name="bison:ruleByLhs"
match="/bison-xml-report/grammar/rules/rule[
@usefulness != 'useless-in-grammar']"
use="lhs"
/>
<xsl:key
name="bison:ruleByRhs"
match="/bison-xml-report/grammar/rules/rule[
@usefulness != 'useless-in-grammar']"
use="rhs/symbol"
/>
<!-- For the specified state, output: #sr-conflicts,#rr-conflicts -->
<xsl:template match="state" mode="bison:count-conflicts">
<xsl:variable name="transitions" select="actions/transitions"/>
<xsl:variable name="reductions" select="actions/reductions"/>
<xsl:variable
name="terminals"
select="
$transitions/transition[@type='shift']/@symbol
| $reductions/reduction/@symbol
"
/>
<xsl:variable name="conflict-data">
<xsl:for-each select="$terminals">
<xsl:variable name="name" select="."/>
<xsl:if test="generate-id($terminals[. = $name][1]) = generate-id(.)">
<xsl:variable
name="shift-count"
select="count($transitions/transition[@symbol=$name])"
/>
<xsl:variable
name="reduce-count"
select="count($reductions/reduction[@symbol=$name])"
/>
<xsl:if test="$shift-count > 0 and $reduce-count > 0">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:if test="$reduce-count > 1">
<xsl:text>r</xsl:text>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="string-length(translate($conflict-data, 'r', ''))"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
</xsl:template>
<xsl:template name="space">
<xsl:param name="repeat">0</xsl:param>
<xsl:param name="fill" select="' '"/>
<xsl:if test="number($repeat) &gt;= 1">
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$repeat - 1"/>
<xsl:with-param name="fill" select="$fill"/>
</xsl:call-template>
<xsl:value-of select="$fill"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

@ -1,397 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
xml2dot.xsl - transform Bison XML Report into DOT.
Copyright (C) 2007-2012 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Written by Wojciech Polak <polak@gnu.org>.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bison="http://www.gnu.org/software/bison/">
<xsl:import href="bison.xsl"/>
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:apply-templates select="bison-xml-report"/>
</xsl:template>
<xsl:template match="bison-xml-report">
<xsl:text>// Generated by GNU Bison </xsl:text>
<xsl:value-of select="@version"/>
<xsl:text>.&#10;</xsl:text>
<xsl:text>// Report bugs to &lt;</xsl:text>
<xsl:value-of select="@bug-report"/>
<xsl:text>&gt;.&#10;</xsl:text>
<xsl:text>// Home page: &lt;</xsl:text>
<xsl:value-of select="@url"/>
<xsl:text>&gt;.&#10;&#10;</xsl:text>
<xsl:apply-templates select="automaton">
<xsl:with-param name="filename" select="filename"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="automaton">
<xsl:param name="filename"/>
<xsl:text>digraph "</xsl:text>
<xsl:call-template name="escape">
<xsl:with-param name="subject" select="$filename"/>
</xsl:call-template>
<xsl:text>"&#10;{
node [fontname = courier, shape = box, colorscheme = paired6]
edge [fontname = courier]
</xsl:text>
<xsl:apply-templates select="state"/>
<xsl:text>}&#10;</xsl:text>
</xsl:template>
<xsl:template match="automaton/state">
<xsl:call-template name="output-node">
<xsl:with-param name="number" select="@number"/>
<xsl:with-param name="label">
<xsl:apply-templates select="itemset/item"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="actions/transitions"/>
<xsl:apply-templates select="actions/reductions">
<xsl:with-param name="staten">
<xsl:value-of select="@number"/>
</xsl:with-param>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="actions/reductions">
<xsl:param name="staten"/>
<xsl:for-each select='reduction'>
<!-- These variables are needed because the current context can't be
refered to directly in XPath expressions. -->
<xsl:variable name="rul">
<xsl:value-of select="@rule"/>
</xsl:variable>
<xsl:variable name="ena">
<xsl:value-of select="@enabled"/>
</xsl:variable>
<!-- The foreach's body is protected by this, so that we are actually
going to iterate once per reduction rule, and not per lookahead. -->
<xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
<xsl:variable name="rule">
<xsl:choose>
<!-- The acceptation state is refered to as 'accept' in the XML, but
just as '0' in the DOT. -->
<xsl:when test="@rule='accept'">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@rule"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- The edge's beginning -->
<xsl:call-template name="reduction-edge-start">
<xsl:with-param name="state" select="$staten"/>
<xsl:with-param name="rule" select="$rule"/>
<xsl:with-param name="enabled" select="@enabled"/>
</xsl:call-template>
<!-- The edge's tokens -->
<!-- Don't show labels for the default action. In other cases, there will
always be at least one token, so 'label="[]"' will not occur. -->
<xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
<xsl:text>label="[</xsl:text>
<xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
<xsl:call-template name="escape">
<xsl:with-param name="subject" select="@symbol"/>
</xsl:call-template>
<xsl:if test="position() != last ()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>]", </xsl:text>
</xsl:if>
<!-- The edge's end -->
<xsl:text>style=solid]&#10;</xsl:text>
<!-- The diamond representing the reduction -->
<xsl:call-template name="reduction-node">
<xsl:with-param name="state" select="$staten"/>
<xsl:with-param name="rule" select="$rule"/>
<xsl:with-param name="color">
<xsl:choose>
<xsl:when test='@enabled="true"'>
<xsl:text>3</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>5</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="actions/transitions">
<xsl:apply-templates select="transition"/>
</xsl:template>
<xsl:template match="item">
<xsl:param name="prev-rule-number"
select="preceding-sibling::item[1]/@rule-number"/>
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
<xsl:with-param name="point" select="@point"/>
<xsl:with-param name="num" select="@rule-number"/>
<xsl:with-param name="prev-lhs"
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
/>
</xsl:apply-templates>
<xsl:apply-templates select="lookaheads"/>
</xsl:template>
<xsl:template match="rule">
<xsl:param name="point"/>
<xsl:param name="num"/>
<xsl:param name="prev-lhs"/>
<xsl:text>&#10;</xsl:text>
<xsl:choose>
<xsl:when test="$num &lt; 10">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="$num &lt; 100">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text></xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$num"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="$prev-lhs = lhs[text()]">
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="'|'"/>
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="lhs"/>
<xsl:text>:</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$point = 0">
<xsl:text> .</xsl:text>
</xsl:if>
<xsl:for-each select="rhs/symbol|rhs/empty">
<xsl:apply-templates select="."/>
<xsl:if test="$point = position()">
<xsl:text> .</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="symbol">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="empty"/>
<xsl:template match="lookaheads">
<xsl:text> [</xsl:text>
<xsl:apply-templates select="symbol"/>
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="lookaheads/symbol">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="reduction-edge-start">
<xsl:param name="state"/>
<xsl:param name="rule"/>
<xsl:param name="enabled"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$state"/>
<xsl:text> -> "</xsl:text>
<xsl:value-of select="$state"/>
<xsl:text>R</xsl:text>
<xsl:value-of select="$rule"/>
<xsl:if test='$enabled = "false"'>
<xsl:text>d</xsl:text>
</xsl:if>
<xsl:text>" [</xsl:text>
</xsl:template>
<xsl:template name="reduction-node">
<xsl:param name="state"/>
<xsl:param name="rule"/>
<xsl:param name="color"/>
<xsl:text> "</xsl:text>
<xsl:value-of select="$state"/>
<xsl:text>R</xsl:text>
<xsl:value-of select="$rule"/>
<xsl:if test="$color = 5">
<xsl:text>d</xsl:text>
</xsl:if>
<xsl:text>" [label="</xsl:text>
<xsl:choose>
<xsl:when test="$rule = 0">
<xsl:text>Acc", fillcolor=1</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>R</xsl:text>
<xsl:value-of select="$rule"/>
<xsl:text>", fillcolor=</xsl:text>
<xsl:value-of select="$color"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>, shape=diamond, style=filled]&#10;</xsl:text>
</xsl:template>
<xsl:template match="transition">
<xsl:call-template name="output-edge">
<xsl:with-param name="src" select="../../../@number"/>
<xsl:with-param name="dst" select="@state"/>
<xsl:with-param name="style">
<xsl:choose>
<xsl:when test="@symbol = 'error'">
<xsl:text>dotted</xsl:text>
</xsl:when>
<xsl:when test="@type = 'shift'">
<xsl:text>solid</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>dashed</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="label">
<xsl:if test="not(@symbol = 'error')">
<xsl:value-of select="@symbol"/>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="output-node">
<xsl:param name="number"/>
<xsl:param name="label"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$number"/>
<xsl:text> [label="</xsl:text>
<xsl:text>State </xsl:text>
<xsl:value-of select="$number"/>
<xsl:text>\n</xsl:text>
<xsl:call-template name="escape">
<xsl:with-param name="subject" select="$label"/>
</xsl:call-template>
<xsl:text>\l"]&#10;</xsl:text>
</xsl:template>
<xsl:template name="output-edge">
<xsl:param name="src"/>
<xsl:param name="dst"/>
<xsl:param name="style"/>
<xsl:param name="label"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$src"/>
<xsl:text> -> </xsl:text>
<xsl:value-of select="$dst"/>
<xsl:text> [style=</xsl:text>
<xsl:value-of select="$style"/>
<xsl:if test="$label and $label != ''">
<xsl:text> label="</xsl:text>
<xsl:call-template name="escape">
<xsl:with-param name="subject" select="$label"/>
</xsl:call-template>
<xsl:text>"</xsl:text>
</xsl:if>
<xsl:text>]&#10;</xsl:text>
</xsl:template>
<xsl:template name="escape">
<xsl:param name="subject"/> <!-- required -->
<xsl:call-template name="string-replace">
<xsl:with-param name="subject">
<xsl:call-template name="string-replace">
<xsl:with-param name="subject">
<xsl:call-template name="string-replace">
<xsl:with-param name="subject" select="$subject"/>
<xsl:with-param name="search" select="'\'"/>
<xsl:with-param name="replace" select="'\\'"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="search" select="'&quot;'"/>
<xsl:with-param name="replace" select="'\&quot;'"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="search" select="'&#10;'"/>
<xsl:with-param name="replace" select="'\l'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="string-replace">
<xsl:param name="subject"/>
<xsl:param name="search"/>
<xsl:param name="replace"/>
<xsl:choose>
<xsl:when test="contains($subject, $search)">
<xsl:variable name="before" select="substring-before($subject, $search)"/>
<xsl:variable name="after" select="substring-after($subject, $search)"/>
<xsl:value-of select="$before"/>
<xsl:value-of select="$replace"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="subject" select="$after"/>
<xsl:with-param name="search" select="$search"/>
<xsl:with-param name="replace" select="$replace"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$subject"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="lpad">
<xsl:param name="str" select="''"/>
<xsl:param name="pad" select="0"/>
<xsl:variable name="diff" select="$pad - string-length($str)" />
<xsl:choose>
<xsl:when test="$diff &lt; 0">
<xsl:value-of select="$str"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$diff"/>
</xsl:call-template>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

@ -1,569 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
xml2text.xsl - transform Bison XML Report into plain text.
Copyright (C) 2007-2012 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Written by Wojciech Polak <polak@gnu.org>.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bison="http://www.gnu.org/software/bison/">
<xsl:import href="bison.xsl"/>
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:apply-templates select="bison-xml-report"/>
</xsl:template>
<xsl:template match="bison-xml-report">
<xsl:apply-templates select="grammar" mode="reductions"/>
<xsl:apply-templates select="grammar" mode="useless-in-parser"/>
<xsl:apply-templates select="automaton" mode="conflicts"/>
<xsl:apply-templates select="grammar"/>
<xsl:apply-templates select="automaton"/>
</xsl:template>
<xsl:template match="grammar" mode="reductions">
<xsl:apply-templates select="nonterminals" mode="useless-in-grammar"/>
<xsl:apply-templates select="terminals" mode="unused-in-grammar"/>
<xsl:apply-templates select="rules" mode="useless-in-grammar"/>
</xsl:template>
<xsl:template match="nonterminals" mode="useless-in-grammar">
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
<xsl:text>Nonterminals useless in grammar&#10;&#10;</xsl:text>
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="terminals" mode="unused-in-grammar">
<xsl:if test="terminal[@usefulness='unused-in-grammar']">
<xsl:text>Terminals unused in grammar&#10;&#10;</xsl:text>
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
<xsl:sort select="@symbol-number" data-type="number"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="rules" mode="useless-in-grammar">
<xsl:variable name="set" select="rule[@usefulness='useless-in-grammar']"/>
<xsl:if test="$set">
<xsl:text>Rules useless in grammar&#10;</xsl:text>
<xsl:call-template name="style-rule-set">
<xsl:with-param name="rule-set" select="$set"/>
</xsl:call-template>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="grammar" mode="useless-in-parser">
<xsl:variable
name="set" select="rules/rule[@usefulness='useless-in-parser']"
/>
<xsl:if test="$set">
<xsl:text>Rules useless in parser due to conflicts&#10;</xsl:text>
<xsl:call-template name="style-rule-set">
<xsl:with-param name="rule-set" select="$set"/>
</xsl:call-template>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="grammar">
<xsl:text>Grammar&#10;</xsl:text>
<xsl:call-template name="style-rule-set">
<xsl:with-param
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
/>
</xsl:call-template>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:apply-templates select="terminals"/>
<xsl:apply-templates select="nonterminals"/>
</xsl:template>
<xsl:template name="style-rule-set">
<xsl:param name="rule-set"/>
<xsl:for-each select="$rule-set">
<xsl:apply-templates select=".">
<xsl:with-param name="pad" select="'3'"/>
<xsl:with-param name="prev-lhs">
<xsl:if test="position()>1">
<xsl:variable name="position" select="position()"/>
<xsl:value-of select="$rule-set[$position - 1]/lhs"/>
</xsl:if>
</xsl:with-param>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template match="grammar/terminals">
<xsl:text>Terminals, with rules where they appear&#10;&#10;</xsl:text>
<xsl:apply-templates select="terminal"/>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:template>
<xsl:template match="grammar/nonterminals">
<xsl:text>Nonterminals, with rules where they appear&#10;&#10;</xsl:text>
<xsl:apply-templates select="nonterminal[@usefulness!='useless-in-grammar']"/>
</xsl:template>
<xsl:template match="terminal">
<xsl:value-of select="@name"/>
<xsl:call-template name="line-wrap">
<xsl:with-param name="first-line-length">
<xsl:choose>
<xsl:when test="string-length(@name) &gt; 66">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="66 - string-length(@name)" />
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="line-length" select="66" />
<xsl:with-param name="text">
<xsl:value-of select="concat(' (', @token-number, ')')"/>
<xsl:for-each select="key('bison:ruleByRhs', @name)">
<xsl:value-of select="concat(' ', @number)"/>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="nonterminal">
<xsl:value-of select="@name"/>
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
<xsl:text>&#10;</xsl:text>
<xsl:variable name="output">
<xsl:call-template name="line-wrap">
<xsl:with-param name="line-length" select="66" />
<xsl:with-param name="text">
<xsl:text> </xsl:text>
<xsl:if test="key('bison:ruleByLhs', @name)">
<xsl:text>on@left:</xsl:text>
<xsl:for-each select="key('bison:ruleByLhs', @name)">
<xsl:value-of select="concat(' ', @number)"/>
</xsl:for-each>
</xsl:if>
<xsl:if test="key('bison:ruleByRhs', @name)">
<xsl:if test="key('bison:ruleByLhs', @name)">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:text>on@right:</xsl:text>
<xsl:for-each select="key('bison:ruleByRhs', @name)">
<xsl:value-of select="concat(' ', @number)"/>
</xsl:for-each>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="translate($output, '@', ' ')" />
</xsl:template>
<xsl:template match="automaton" mode="conflicts">
<xsl:variable name="conflict-report">
<xsl:apply-templates select="state" mode="conflicts"/>
</xsl:variable>
<xsl:if test="string-length($conflict-report) != 0">
<xsl:value-of select="$conflict-report"/>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="state" mode="conflicts">
<xsl:variable name="conflict-counts">
<xsl:apply-templates select="." mode="bison:count-conflicts" />
</xsl:variable>
<xsl:variable
name="sr-count" select="substring-before($conflict-counts, ',')"
/>
<xsl:variable
name="rr-count" select="substring-after($conflict-counts, ',')"
/>
<xsl:if test="$sr-count > 0 or $rr-count > 0">
<xsl:value-of select="concat('State ', @number, ' conflicts:')"/>
<xsl:if test="$sr-count > 0">
<xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/>
<xsl:if test="$rr-count > 0">
<xsl:value-of select="(',')"/>
</xsl:if>
</xsl:if>
<xsl:if test="$rr-count > 0">
<xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/>
</xsl:if>
<xsl:value-of select="'&#10;'"/>
</xsl:if>
</xsl:template>
<xsl:template match="automaton">
<xsl:apply-templates select="state">
<xsl:with-param name="pad" select="'3'"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="automaton/state">
<xsl:param name="pad"/>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:text>State </xsl:text>
<xsl:value-of select="@number"/>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:apply-templates select="itemset/item">
<xsl:with-param name="pad" select="$pad"/>
</xsl:apply-templates>
<xsl:apply-templates select="actions/transitions">
<xsl:with-param name="type" select="'shift'"/>
</xsl:apply-templates>
<xsl:apply-templates select="actions/errors"/>
<xsl:apply-templates select="actions/reductions"/>
<xsl:apply-templates select="actions/transitions">
<xsl:with-param name="type" select="'goto'"/>
</xsl:apply-templates>
<xsl:apply-templates select="solved-conflicts"/>
</xsl:template>
<xsl:template match="actions/transitions">
<xsl:param name="type"/>
<xsl:if test="transition[@type = $type]">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="transition[@type = $type]">
<xsl:with-param name="pad">
<xsl:call-template name="max-width-symbol">
<xsl:with-param name="node" select="transition[@type = $type]"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="actions/errors">
<xsl:if test="error">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="error">
<xsl:with-param name="pad">
<xsl:call-template name="max-width-symbol">
<xsl:with-param name="node" select="error"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="actions/reductions">
<xsl:if test="reduction">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="reduction">
<xsl:with-param name="pad">
<xsl:call-template name="max-width-symbol">
<xsl:with-param name="node" select="reduction"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="item">
<xsl:param name="pad"/>
<xsl:param name="prev-rule-number"
select="preceding-sibling::item[1]/@rule-number"/>
<xsl:apply-templates
select="key('bison:ruleByNumber', current()/@rule-number)"
>
<xsl:with-param name="itemset" select="'true'"/>
<xsl:with-param name="pad" select="$pad"/>
<xsl:with-param
name="prev-lhs"
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
/>
<xsl:with-param name="point" select="@point"/>
<xsl:with-param name="lookaheads">
<xsl:apply-templates select="lookaheads"/>
</xsl:with-param>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="rule">
<xsl:param name="itemset"/>
<xsl:param name="pad"/>
<xsl:param name="prev-lhs"/>
<xsl:param name="point"/>
<xsl:param name="lookaheads"/>
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="string(@number)"/>
<xsl:with-param name="pad" select="number($pad)"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<!-- LHS -->
<xsl:choose>
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="'|'"/>
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="'|'"/>
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="lhs"/>
<xsl:text>:</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- RHS -->
<xsl:for-each select="rhs/*">
<xsl:if test="position() = $point + 1">
<xsl:text> .</xsl:text>
</xsl:if>
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="position() = last() and position() = $point">
<xsl:text> .</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="$lookaheads">
<xsl:value-of select="$lookaheads"/>
</xsl:if>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="symbol">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="empty">
<xsl:text> /* empty */</xsl:text>
</xsl:template>
<xsl:template match="lookaheads">
<xsl:text> [</xsl:text>
<xsl:apply-templates select="symbol"/>
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="lookaheads/symbol">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="transition">
<xsl:param name="pad"/>
<xsl:text> </xsl:text>
<xsl:call-template name="rpad">
<xsl:with-param name="str" select="string(@symbol)"/>
<xsl:with-param name="pad" select="number($pad) + 2"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@type = 'shift'">
<xsl:text>shift, and go to state </xsl:text>
<xsl:value-of select="@state"/>
</xsl:when>
<xsl:when test="@type = 'goto'">
<xsl:text>go to state </xsl:text>
<xsl:value-of select="@state"/>
</xsl:when>
</xsl:choose>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="error">
<xsl:param name="pad"/>
<xsl:text> </xsl:text>
<xsl:call-template name="rpad">
<xsl:with-param name="str" select="string(@symbol)"/>
<xsl:with-param name="pad" select="number($pad) + 2"/>
</xsl:call-template>
<xsl:text>error</xsl:text>
<xsl:text> (</xsl:text>
<xsl:value-of select="text()"/>
<xsl:text>)</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="reduction">
<xsl:param name="pad"/>
<xsl:text> </xsl:text>
<xsl:call-template name="rpad">
<xsl:with-param name="str" select="string(@symbol)"/>
<xsl:with-param name="pad" select="number($pad) + 2"/>
</xsl:call-template>
<xsl:if test="@enabled = 'false'">
<xsl:text>[</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="@rule = 'accept'">
<xsl:text>accept</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>reduce using rule </xsl:text>
<xsl:value-of select="@rule"/>
<xsl:text> (</xsl:text>
<xsl:value-of
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@enabled = 'false'">
<xsl:text>]</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="solved-conflicts">
<xsl:if test="resolution">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="resolution"/>
</xsl:if>
</xsl:template>
<xsl:template match="resolution">
<xsl:text> Conflict between rule </xsl:text>
<xsl:value-of select="@rule"/>
<xsl:text> and token </xsl:text>
<xsl:value-of select="@symbol"/>
<xsl:text> resolved as </xsl:text>
<xsl:if test="@type = 'error'">
<xsl:text>an </xsl:text>
</xsl:if>
<xsl:value-of select="@type"/>
<xsl:text> (</xsl:text>
<xsl:value-of select="."/>
<xsl:text>).&#10;</xsl:text>
</xsl:template>
<xsl:template name="max-width-symbol">
<xsl:param name="node"/>
<xsl:variable name="longest">
<xsl:for-each select="$node">
<xsl:sort data-type="number" select="string-length(@symbol)"
order="descending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="string-length(@symbol)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$longest"/>
</xsl:template>
<xsl:template name="lpad">
<xsl:param name="str" select="''"/>
<xsl:param name="pad" select="0"/>
<xsl:variable name="diff" select="$pad - string-length($str)" />
<xsl:choose>
<xsl:when test="$diff &lt; 0">
<xsl:value-of select="$str"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$diff"/>
</xsl:call-template>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="rpad">
<xsl:param name="str" select="''"/>
<xsl:param name="pad" select="0"/>
<xsl:variable name="diff" select="$pad - string-length($str)"/>
<xsl:choose>
<xsl:when test="$diff &lt; 0">
<xsl:value-of select="$str"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$diff"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="line-wrap">
<xsl:param name="line-length"/> <!-- required -->
<xsl:param name="first-line-length" select="$line-length"/>
<xsl:param name="text"/> <!-- required -->
<xsl:choose>
<xsl:when test="normalize-space($text) = ''" />
<xsl:when test="string-length($text) &lt;= $first-line-length">
<xsl:value-of select="concat($text, '&#10;')" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="break-pos">
<xsl:call-template name="ws-search">
<xsl:with-param name="text" select="$text" />
<xsl:with-param name="start" select="$first-line-length+1" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="substring($text, 1, $break-pos - 1)" />
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="line-wrap">
<xsl:with-param name="line-length" select="$line-length" />
<xsl:with-param
name="text" select="concat(' ', substring($text, $break-pos+1))"
/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="ws-search">
<xsl:param name="text"/> <!-- required -->
<xsl:param name="start"/> <!-- required -->
<xsl:variable name="search-text" select="substring($text, $start)" />
<xsl:choose>
<xsl:when test="not(contains($search-text, ' '))">
<xsl:value-of select="string-length($text)+1" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="$start + string-length(substring-before($search-text, ' '))"
/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

@ -1,745 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
xml2html.xsl - transform Bison XML Report into XHTML.
Copyright (C) 2007-2012 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Written by Wojciech Polak <polak@gnu.org>.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:bison="http://www.gnu.org/software/bison/">
<xsl:import href="bison.xsl"/>
<xsl:output method="xml" encoding="UTF-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="bison-xml-report/filename"/>
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
</title>
<style type="text/css"><![CDATA[
body {
font-family: "Nimbus Sans L", Arial, sans-serif;
font-size: 9pt;
}
a:link {
color: #1f00ff;
text-decoration: none;
}
a:visited {
color: #1f00ff;
text-decoration: none;
}
a:hover {
color: red;
}
#menu a {
text-decoration: underline;
}
.i {
font-style: italic;
}
.pre {
font-family: monospace;
white-space: pre;
}
ol.decimal {
list-style-type: decimal;
}
ol.lower-alpha {
list-style-type: lower-alpha;
}
.point {
color: #cc0000;
}
#footer {
margin-top: 3.5em;
font-size: 7pt;
}
]]></style>
</head>
<body>
<xsl:apply-templates select="bison-xml-report"/>
<xsl:text>&#10;&#10;</xsl:text>
<div id="footer"><hr />This document was generated using
<a href="http://www.gnu.org/software/bison/" title="GNU Bison">
GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a>
XML Automaton Report.<br />
<!-- default copying notice -->
Verbatim copying and distribution of this entire page is
permitted in any medium, provided this notice is preserved.</div>
</body>
</html>
</xsl:template>
<xsl:template match="bison-xml-report">
<h1>GNU Bison XML Automaton Report</h1>
<p>
input grammar: <span class="i"><xsl:value-of select="filename"/></span>
</p>
<xsl:text>&#10;&#10;</xsl:text>
<h3>Table of Contents</h3>
<ul id="menu">
<li>
<a href="#reductions">Reductions</a>
<ul class="lower-alpha">
<li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li>
<li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li>
<li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li>
<xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']">
<li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li>
</xsl:if>
</ul>
</li>
<li><a href="#conflicts">Conflicts</a></li>
<li>
<a href="#grammar">Grammar</a>
<ul class="lower-alpha">
<li><a href="#grammar">Itemset</a></li>
<li><a href="#terminals">Terminal symbols</a></li>
<li><a href="#nonterminals">Nonterminal symbols</a></li>
</ul>
</li>
<li><a href="#automaton">Automaton</a></li>
</ul>
<xsl:apply-templates select="grammar" mode="reductions"/>
<xsl:apply-templates select="grammar" mode="useless-in-parser"/>
<xsl:apply-templates select="automaton" mode="conflicts"/>
<xsl:apply-templates select="grammar"/>
<xsl:apply-templates select="automaton"/>
</xsl:template>
<xsl:template match="grammar" mode="reductions">
<h2>
<a name="reductions"/>
<xsl:text> Reductions</xsl:text>
</h2>
<xsl:apply-templates select="nonterminals" mode="useless-in-grammar"/>
<xsl:apply-templates select="terminals" mode="unused-in-grammar"/>
<xsl:apply-templates select="rules" mode="useless-in-grammar"/>
</xsl:template>
<xsl:template match="nonterminals" mode="useless-in-grammar">
<h3>
<a name="nonterminals_useless_in_grammar"/>
<xsl:text> Nonterminals useless in grammar</xsl:text>
</h3>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
<p class="pre">
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:text>&#10;&#10;</xsl:text>
</p>
</xsl:if>
</xsl:template>
<xsl:template match="terminals" mode="unused-in-grammar">
<h3>
<a name="terminals_unused_in_grammar"/>
<xsl:text> Terminals unused in grammar</xsl:text>
</h3>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:if test="terminal[@usefulness='unused-in-grammar']">
<p class="pre">
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
<xsl:sort select="@symbol-number" data-type="number"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:text>&#10;&#10;</xsl:text>
</p>
</xsl:if>
</xsl:template>
<xsl:template match="rules" mode="useless-in-grammar">
<h3>
<a name="rules_useless_in_grammar"/>
<xsl:text> Rules useless in grammar</xsl:text>
</h3>
<xsl:text>&#10;</xsl:text>
<xsl:variable name="set" select="rule[@usefulness='useless-in-grammar']"/>
<xsl:if test="$set">
<p class="pre">
<xsl:call-template name="style-rule-set">
<xsl:with-param name="rule-set" select="$set"/>
</xsl:call-template>
<xsl:text>&#10;&#10;</xsl:text>
</p>
</xsl:if>
</xsl:template>
<xsl:template match="grammar" mode="useless-in-parser">
<xsl:variable
name="set" select="rules/rule[@usefulness='useless-in-parser']"
/>
<xsl:if test="$set">
<h2>
<a name="rules_useless_in_parser"/>
<xsl:text> Rules useless in parser due to conflicts</xsl:text>
</h2>
<xsl:text>&#10;</xsl:text>
<p class="pre">
<xsl:call-template name="style-rule-set">
<xsl:with-param name="rule-set" select="$set"/>
</xsl:call-template>
</p>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="grammar">
<h2>
<a name="grammar"/>
<xsl:text> Grammar</xsl:text>
</h2>
<xsl:text>&#10;</xsl:text>
<p class="pre">
<xsl:call-template name="style-rule-set">
<xsl:with-param
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
/>
</xsl:call-template>
</p>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:apply-templates select="terminals"/>
<xsl:apply-templates select="nonterminals"/>
</xsl:template>
<xsl:template name="style-rule-set">
<xsl:param name="rule-set"/>
<xsl:for-each select="$rule-set">
<xsl:apply-templates select=".">
<xsl:with-param name="pad" select="'3'"/>
<xsl:with-param name="prev-lhs">
<xsl:if test="position()>1">
<xsl:variable name="position" select="position()"/>
<xsl:value-of select="$rule-set[$position - 1]/lhs"/>
</xsl:if>
</xsl:with-param>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template match="automaton" mode="conflicts">
<h2>
<a name="conflicts"/>
<xsl:text> Conflicts</xsl:text>
</h2>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:variable name="conflict-report">
<xsl:apply-templates select="state" mode="conflicts"/>
</xsl:variable>
<xsl:if test="string-length($conflict-report) != 0">
<p class="pre">
<xsl:copy-of select="$conflict-report"/>
<xsl:text>&#10;&#10;</xsl:text>
</p>
</xsl:if>
</xsl:template>
<xsl:template match="state" mode="conflicts">
<xsl:variable name="conflict-counts">
<xsl:apply-templates select="." mode="bison:count-conflicts" />
</xsl:variable>
<xsl:variable
name="sr-count" select="substring-before($conflict-counts, ',')"
/>
<xsl:variable
name="rr-count" select="substring-after($conflict-counts, ',')"
/>
<xsl:if test="$sr-count > 0 or $rr-count > 0">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#state_', @number)"/>
</xsl:attribute>
<xsl:value-of select="concat('State ', @number)"/>
</a>
<xsl:text> conflicts:</xsl:text>
<xsl:if test="$sr-count > 0">
<xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/>
<xsl:if test="$rr-count > 0">
<xsl:value-of select="(',')"/>
</xsl:if>
</xsl:if>
<xsl:if test="$rr-count > 0">
<xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/>
</xsl:if>
<xsl:value-of select="'&#10;'"/>
</xsl:if>
</xsl:template>
<xsl:template match="grammar/terminals">
<h3>
<a name="terminals"/>
<xsl:text> Terminals, with rules where they appear</xsl:text>
</h3>
<xsl:text>&#10;&#10;</xsl:text>
<p class="pre">
<xsl:apply-templates select="terminal"/>
</p>
<xsl:text>&#10;&#10;</xsl:text>
</xsl:template>
<xsl:template match="grammar/nonterminals">
<h3>
<a name="nonterminals"/>
<xsl:text> Nonterminals, with rules where they appear</xsl:text>
</h3>
<xsl:text>&#10;&#10;</xsl:text>
<p class="pre">
<xsl:apply-templates
select="nonterminal[@usefulness!='useless-in-grammar']"
/>
</p>
</xsl:template>
<xsl:template match="terminal">
<b><xsl:value-of select="@name"/></b>
<xsl:value-of select="concat(' (', @token-number, ')')"/>
<xsl:for-each select="key('bison:ruleByRhs', @name)">
<xsl:apply-templates select="." mode="number-link"/>
</xsl:for-each>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="nonterminal">
<b><xsl:value-of select="@name"/></b>
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
<xsl:text>&#10; </xsl:text>
<xsl:if test="key('bison:ruleByLhs', @name)">
<xsl:text>on left:</xsl:text>
<xsl:for-each select="key('bison:ruleByLhs', @name)">
<xsl:apply-templates select="." mode="number-link"/>
</xsl:for-each>
</xsl:if>
<xsl:if test="key('bison:ruleByRhs', @name)">
<xsl:if test="key('bison:ruleByLhs', @name)">
<xsl:text>&#10; </xsl:text>
</xsl:if>
<xsl:text>on right:</xsl:text>
<xsl:for-each select="key('bison:ruleByRhs', @name)">
<xsl:apply-templates select="." mode="number-link"/>
</xsl:for-each>
</xsl:if>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="rule" mode="number-link">
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#rule_', @number)"/>
</xsl:attribute>
<xsl:value-of select="@number"/>
</a>
</xsl:template>
<xsl:template match="automaton">
<h2>
<a name="automaton"/>
<xsl:text> Automaton</xsl:text>
</h2>
<xsl:apply-templates select="state">
<xsl:with-param name="pad" select="'3'"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="automaton/state">
<xsl:param name="pad"/>
<xsl:text>&#10;&#10;</xsl:text>
<h3>
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat('state_', @number)"/>
</xsl:attribute>
</a>
<xsl:text>state </xsl:text>
<xsl:value-of select="@number"/>
</h3>
<xsl:text>&#10;&#10;</xsl:text>
<p class="pre">
<xsl:apply-templates select="itemset/item">
<xsl:with-param name="pad" select="$pad"/>
</xsl:apply-templates>
<xsl:apply-templates select="actions/transitions">
<xsl:with-param name="type" select="'shift'"/>
</xsl:apply-templates>
<xsl:apply-templates select="actions/errors"/>
<xsl:apply-templates select="actions/reductions"/>
<xsl:apply-templates select="actions/transitions">
<xsl:with-param name="type" select="'goto'"/>
</xsl:apply-templates>
<xsl:apply-templates select="solved-conflicts"/>
</p>
</xsl:template>
<xsl:template match="actions/transitions">
<xsl:param name="type"/>
<xsl:if test="transition[@type = $type]">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="transition[@type = $type]">
<xsl:with-param name="pad">
<xsl:call-template name="max-width-symbol">
<xsl:with-param name="node" select="transition[@type = $type]"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="actions/errors">
<xsl:if test="error">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="error">
<xsl:with-param name="pad">
<xsl:call-template name="max-width-symbol">
<xsl:with-param name="node" select="error"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="actions/reductions">
<xsl:if test="reduction">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="reduction">
<xsl:with-param name="pad">
<xsl:call-template name="max-width-symbol">
<xsl:with-param name="node" select="reduction"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="item">
<xsl:param name="pad"/>
<xsl:param name="prev-rule-number"
select="preceding-sibling::item[1]/@rule-number"/>
<xsl:apply-templates
select="key('bison:ruleByNumber', current()/@rule-number)"
>
<xsl:with-param name="itemset" select="'true'"/>
<xsl:with-param name="pad" select="$pad"/>
<xsl:with-param name="prev-lhs"
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
/>
<xsl:with-param name="point" select="@point"/>
<xsl:with-param name="lookaheads">
<xsl:apply-templates select="lookaheads"/>
</xsl:with-param>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="rule">
<xsl:param name="itemset"/>
<xsl:param name="pad"/>
<xsl:param name="prev-lhs"/>
<xsl:param name="point"/>
<xsl:param name="lookaheads"/>
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat('rule_', @number)"/>
</xsl:attribute>
</a>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="$itemset = 'true'">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#rule_', @number)"/>
</xsl:attribute>
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="string(@number)"/>
<xsl:with-param name="pad" select="number($pad)"/>
</xsl:call-template>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="string(@number)"/>
<xsl:with-param name="pad" select="number($pad)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<!-- LHS -->
<xsl:choose>
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="'|'"/>
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
<xsl:call-template name="lpad">
<xsl:with-param name="str" select="'|'"/>
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<span class="i">
<xsl:value-of select="lhs"/>
</span>
<xsl:text> &#8594;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- RHS -->
<xsl:for-each select="rhs/*">
<xsl:if test="position() = $point + 1">
<xsl:text> </xsl:text>
<span class="point">.</span>
</xsl:if>
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="position() = last() and position() = $point">
<xsl:text> </xsl:text>
<span class="point">.</span>
</xsl:if>
</xsl:for-each>
<xsl:if test="$lookaheads">
<xsl:value-of select="$lookaheads"/>
</xsl:if>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="symbol">
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="name(key('bison:symbolByName', .)) = 'nonterminal'">
<span class="i"><xsl:value-of select="."/></span>
</xsl:when>
<xsl:otherwise>
<b><xsl:value-of select="."/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="empty">
<xsl:text> &#949;</xsl:text>
</xsl:template>
<xsl:template match="lookaheads">
<xsl:text> [</xsl:text>
<xsl:apply-templates select="symbol"/>
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="lookaheads/symbol">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="transition">
<xsl:param name="pad"/>
<xsl:text> </xsl:text>
<xsl:call-template name="rpad">
<xsl:with-param name="str" select="string(@symbol)"/>
<xsl:with-param name="pad" select="number($pad) + 2"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@type = 'shift'">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#state_', @state)"/>
</xsl:attribute>
<xsl:value-of select="concat('shift, and go to state ', @state)"/>
</a>
</xsl:when>
<xsl:when test="@type = 'goto'">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#state_', @state)"/>
</xsl:attribute>
<xsl:value-of select="concat('go to state ', @state)"/>
</a>
</xsl:when>
</xsl:choose>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="error">
<xsl:param name="pad"/>
<xsl:text> </xsl:text>
<xsl:call-template name="rpad">
<xsl:with-param name="str" select="string(@symbol)"/>
<xsl:with-param name="pad" select="number($pad) + 2"/>
</xsl:call-template>
<xsl:text>error</xsl:text>
<xsl:text> (</xsl:text>
<xsl:value-of select="text()"/>
<xsl:text>)</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="reduction">
<xsl:param name="pad"/>
<xsl:text> </xsl:text>
<xsl:call-template name="rpad">
<xsl:with-param name="str" select="string(@symbol)"/>
<xsl:with-param name="pad" select="number($pad) + 2"/>
</xsl:call-template>
<xsl:if test="@enabled = 'false'">
<xsl:text>[</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="@rule = 'accept'">
<xsl:text>accept</xsl:text>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#rule_', @rule)"/>
</xsl:attribute>
<xsl:value-of select="concat('reduce using rule ', @rule)"/>
</a>
<xsl:text> (</xsl:text>
<xsl:value-of
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"
/>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@enabled = 'false'">
<xsl:text>]</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="solved-conflicts">
<xsl:if test="resolution">
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="resolution"/>
</xsl:if>
</xsl:template>
<xsl:template match="resolution">
<xsl:text> Conflict between </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#rule_', @rule)"/>
</xsl:attribute>
<xsl:value-of select="concat('rule ',@rule)"/>
</a>
<xsl:text> and token </xsl:text>
<xsl:value-of select="@symbol"/>
<xsl:text> resolved as </xsl:text>
<xsl:if test="@type = 'error'">
<xsl:text>an </xsl:text>
</xsl:if>
<xsl:value-of select="@type"/>
<xsl:text> (</xsl:text>
<xsl:value-of select="."/>
<xsl:text>).&#10;</xsl:text>
</xsl:template>
<xsl:template name="max-width-symbol">
<xsl:param name="node"/>
<xsl:variable name="longest">
<xsl:for-each select="$node">
<xsl:sort data-type="number" select="string-length(@symbol)"
order="descending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="string-length(@symbol)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$longest"/>
</xsl:template>
<xsl:template name="lpad">
<xsl:param name="str" select="''"/>
<xsl:param name="pad" select="0"/>
<xsl:variable name="diff" select="$pad - string-length($str)" />
<xsl:choose>
<xsl:when test="$diff &lt; 0">
<xsl:value-of select="$str"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$diff"/>
</xsl:call-template>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="rpad">
<xsl:param name="str" select="''"/>
<xsl:param name="pad" select="0"/>
<xsl:variable name="diff" select="$pad - string-length($str)"/>
<xsl:choose>
<xsl:when test="$diff &lt; 0">
<xsl:value-of select="$str"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$diff"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="space">
<xsl:param name="repeat">0</xsl:param>
<xsl:param name="fill" select="' '"/>
<xsl:if test="number($repeat) &gt;= 1">
<xsl:call-template name="space">
<xsl:with-param name="repeat" select="$repeat - 1"/>
<xsl:with-param name="fill" select="$fill"/>
</xsl:call-template>
<xsl:value-of select="$fill"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

@ -1,3 +0,0 @@
// Icon Resource Definition
#define MAIN_ICON 102
MAIN_ICON ICON "icon.ico"

@ -1,4 +1,3 @@
#include <Windows.h>
#include <cli-parser.hpp>
#include <fstream>
#include <iostream>
@ -7,137 +6,139 @@
#include <xtils.hpp>
#include "compiler.h"
#include "gen_code.hpp"
#include "parser.h"
#include "parser.tab.h"
#include "vmprofiler.hpp"
#include "gen_code.hpp"
extern FILE *yyin;
extern "C" int yywrap()
{
return 1;
}
void yyerror( char *msg )
{
std::printf( "[!] parsing failure: %s\n", msg );
}
int __cdecl main( int argc, const char *argv[] )
{
argparse::argument_parser_t argp( "vmassembler", "virtual instruction assembler" );
argp.add_argument()
.names( { "--input", "--in" } )
.description( "path to a vasm file to be assembled..." )
.required( true );
argp.add_argument().names( { "--vmpbin", "--bin" } ).description( "path to protected binary..." ).required( true );
argp.add_argument().names( { "--vmentry", "--entry" } ).description( "rva to vm entry..." ).required( true );
argp.add_argument().names( { "--out", "--output" } ).description( "output file name and path..." ).required( true );
argp.enable_help();
auto err = argp.parse( argc, argv );
if ( err )
{
std::cout << err << std::endl;
return -1;
}
if ( argp.exists( "help" ) )
{
argp.print_help();
return 0;
extern "C" int yywrap() { return 1; }
void yyerror(char *msg) { std::printf("[!] parsing failure: %s\n", msg); }
int __cdecl main(int argc, const char *argv[]) {
argparse::argument_parser_t argp("vmassembler",
"virtual instruction assembler");
argp.add_argument()
.names({"--input", "--in"})
.description("path to a vasm file to be assembled...")
.required(true);
argp.add_argument()
.names({"--vmpbin", "--bin"})
.description("path to protected binary...")
.required(true);
argp.add_argument()
.names({"--vmentry", "--entry"})
.description("rva to vm entry...")
.required(true);
argp.add_argument()
.names({"--out", "--output"})
.description("output file name and path...")
.required(true);
argp.enable_help();
auto err = argp.parse(argc, argv);
if (err) {
std::cout << err << std::endl;
return -1;
}
if (argp.exists("help")) {
argp.print_help();
return 0;
}
//
// set yyin to the vasm file...
//
if ((yyin = fopen(argp.get<std::string>("input").c_str(), "r")) == nullptr) {
std::printf("[!] failed to open vasm file...\n");
return -1;
}
//
// parse vasm file for all of the instructions...
//
yyparse();
std::printf("[+] finished parsing vasm file...\n");
//
// init vm variables...
//
const auto module_base = reinterpret_cast<std::uintptr_t>(
LoadLibraryExA(argp.get<std::string>("vmpbin").c_str(), NULL,
DONT_RESOLVE_DLL_REFERENCES));
const auto vm_entry_rva =
std::strtoull(argp.get<std::string>("vmentry").c_str(), nullptr, 16);
const auto image_base = xtils::um_t::get_instance()->image_base(
argp.get<std::string>("vmpbin").c_str());
const auto image_size = NT_HEADER(module_base)->OptionalHeader.SizeOfImage;
vm::ctx_t vmctx(module_base, image_base, image_size, vm_entry_rva);
if (!vmctx.init()) {
std::printf(
"> failed to init vmctx... make sure all arguments are valid\n"
"and that the binary you are providing is unpacked and protected\n"
"by VMProtect 2...\n");
return -1;
}
std::printf("> flattened and deobfuscated vm entry...\n");
vm::util::print(vmctx.vm_entry);
std::printf("> extracted calc jmp from vm entry...\n");
vm::util::print(vmctx.calc_jmp);
vm::compiler_t compiler(&vmctx);
//
// encode virtual instructions...
//
auto virt_labels = compiler.encode();
std::printf("[+] finished encoding... encoded instructions below...\n");
for (auto &label : *virt_labels) {
for (const auto &vinstr : label.vinstrs) {
if (vinstr.imm_size)
std::printf("> 0x%x - 0x%x\n", vinstr.vm_handler, vinstr.operand);
else
std::printf("> 0x%x\n", vinstr.vm_handler);
}
}
//
// set yyin to the vasm file...
//
if ( ( yyin = fopen( argp.get< std::string >( "input" ).c_str(), "r" ) ) == nullptr )
{
std::printf( "[!] failed to open vasm file...\n" );
return -1;
}
//
// encrypt virtual instructions...
//
//
// parse vasm file for all of the instructions...
//
auto compiled_labels = compiler.encrypt();
std::printf("[+] finished encrypting... encrypted labels below...\n");
yyparse();
std::printf( "[+] finished parsing vasm file...\n" );
for (const auto &label : compiled_labels) {
std::printf("> %s must be allocated at = 0x%p, encrypted rva = 0x%p\n",
label.label_name.c_str(), label.alloc_rva, label.enc_alloc_rva);
//
// init vm variables...
//
const auto module_base = reinterpret_cast< std::uintptr_t >(
LoadLibraryExA( argp.get< std::string >( "vmpbin" ).c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES ) );
const auto vm_entry_rva = std::strtoull( argp.get< std::string >( "vmentry" ).c_str(), nullptr, 16 );
const auto image_base = xtils::um_t::get_instance()->image_base( argp.get< std::string >( "vmpbin" ).c_str() );
const auto image_size = NT_HEADER( module_base )->OptionalHeader.SizeOfImage;
vm::ctx_t vmctx( module_base, image_base, image_size, vm_entry_rva );
if ( !vmctx.init() )
{
std::printf( "> failed to init vmctx... make sure all arguments are valid\n"
"and that the binary you are providing is unpacked and protected\n"
"by VMProtect 2...\n" );
return -1;
}
std::printf( "> flattened and deobfuscated vm entry...\n" );
vm::util::print( vmctx.vm_entry );
std::printf( "> extracted calc jmp from vm entry...\n" );
vm::util::print( vmctx.calc_jmp );
vm::compiler_t compiler( &vmctx );
//
// encode virtual instructions...
//
auto virt_labels = compiler.encode();
std::printf( "[+] finished encoding... encoded instructions below...\n" );
for ( auto &label : *virt_labels )
{
for ( const auto &vinstr : label.vinstrs )
{
if ( vinstr.imm_size )
std::printf( "> 0x%x - 0x%x\n", vinstr.vm_handler, vinstr.operand );
else
std::printf( "> 0x%x\n", vinstr.vm_handler );
}
}
//
// encrypt virtual instructions...
//
auto compiled_labels = compiler.encrypt();
std::printf( "[+] finished encrypting... encrypted labels below...\n" );
for ( const auto &label : compiled_labels )
std::printf("> ");
{
std::printf( "> %s must be allocated at = 0x%p, encrypted rva = 0x%p\n", label.label_name.c_str(),
label.alloc_rva, label.enc_alloc_rva );
std::printf( "> " );
{
for ( auto byte : label.vinstrs )
std::printf( "0x%x ", byte );
for (auto byte : label.vinstrs) std::printf("0x%x ", byte);
std::printf( "\n" );
}
std::printf("\n");
}
}
const auto cpp_result = gen::code( compiled_labels, argp.get< std::string >( "vmpbin" ), vmctx );
std::ofstream output( argp.get< std::string >( "out" ) );
output.write( cpp_result.data(), cpp_result.size() );
output.close();
const auto cpp_result =
gen::code(compiled_labels, argp.get<std::string>("vmpbin"), vmctx);
std::ofstream output(argp.get<std::string>("out"));
output.write(cpp_result.data(), cpp_result.size());
output.close();
std::printf( "> generated header file...\n" );
std::printf("> generated header file...\n");
}

@ -1,37 +1,28 @@
#include "parser.h"
parse_t::parse_t()
{
}
parse_t::parse_t() {}
auto parse_t::get_instance() -> parse_t *
{
static parse_t obj;
return &obj;
auto parse_t::get_instance() -> parse_t * {
static parse_t obj;
return &obj;
}
void parse_t::add_label( std::string label_name )
{
// remove ":" from the end of the label name...
label_name.erase( label_name.end() - 1 );
virt_labels.push_back( { label_name } );
void parse_t::add_label(std::string label_name) {
// remove ":" from the end of the label name...
label_name.erase(label_name.end() - 1);
virt_labels.push_back({label_name});
}
void parse_t::add_vinstr( std::string vinstr_name )
{
virt_labels.back().vinstrs.push_back( { vinstr_name, false, 0u } );
void parse_t::add_vinstr(std::string vinstr_name) {
virt_labels.back().vinstrs.push_back({vinstr_name, false, 0u});
}
void parse_t::add_vinstr( std::string vinstr_name, std::uintptr_t imm_val )
{
virt_labels.back().vinstrs.push_back( { vinstr_name, true, imm_val } );
void parse_t::add_vinstr(std::string vinstr_name, std::uintptr_t imm_val) {
virt_labels.back().vinstrs.push_back({vinstr_name, true, imm_val});
}
bool parse_t::for_each( callback_t callback )
{
for ( auto &entry : virt_labels )
if ( !callback( &entry ) )
return false;
return true;
bool parse_t::for_each(callback_t callback) {
for (auto &entry : virt_labels)
if (!callback(&entry)) return false;
return true;
}

@ -1,100 +0,0 @@
#pragma once
#include <cstdint>
#include <functional>
#include <iostream>
#include <vector>
/// <summary>
/// raw virtual instruction information extracted using lex and yacc...
/// </summary>
struct _vinstr_meta
{
/// <summary>
/// virtual instruction name...
/// </summary>
std::string name;
/// <summary>
/// if the virtual instruction has a second operand or not (imm)...
/// </summary>
bool has_imm;
/// <summary>
/// the imm if any...
/// </summary>
std::uintptr_t imm;
};
/// <summary>
/// raw label containing raw virtual instruction data extracted using lex and yacc...
/// </summary>
struct _vlabel_meta
{
/// <summary>
/// label name...
/// </summary>
std::string label_name;
/// <summary>
/// vector of raw virtual instruction data...
/// </summary>
std::vector< _vinstr_meta > vinstrs;
};
/// <summary>
/// used for parse_t::for_each...
/// </summary>
using callback_t = std::function< bool( _vlabel_meta * ) >;
/// <summary>
/// this singleton class contains all the information for parsed virtual instructions...
/// </summary>
class parse_t
{
public:
/// <summary>
/// gets the one and only instance of this class...
/// </summary>
/// <returns>returns a pointer to the one and only instance of this class...</returns>
static auto get_instance() -> parse_t *;
/// <summary>
/// used by yacc file to add new labels...
/// </summary>
/// <param name="label_name">label name, no pass by reference since a new std::string object must be
/// created...</param>
void add_label( std::string label_name );
/// <summary>
/// used by yacc file to add new virtual instruction with no imm...
/// </summary>
/// <param name="vinstr_name">virtual instruction name, no pass by reference since a new std::string object must be
/// created...</param>
void add_vinstr( std::string vinstr_name );
/// <summary>
/// used by yacc file to add new virtual instruction with an imm...
/// </summary>
/// <param name="vinstr_name">virtual instruction name, no pass by reference since a new std::string object must
/// be created...</param>
/// <param name="imm_val">imm value...</param>
void add_vinstr( std::string vinstr_name, std::uintptr_t imm_val );
/// <summary>
/// used to loop over every single label...
/// </summary>
/// <param name="callback">lambda to call back given the label structure...</param>
/// <returns>returns true if all labels were looped through...</returns>
bool for_each( callback_t callback );
private:
/// <summary>
/// vector of raw virtual labels...
/// </summary>
std::vector< _vlabel_meta > virt_labels;
/// <summary>
/// default constructor... private...
/// </summary>
parse_t();
};

@ -20,7 +20,7 @@ unsigned long long imm_val;
%%
PROGRAM:
LABEL { parse_t::get_instance()->add_label($1); }
| PROGRAM LABEL { parse_t::get_instance()->add_label($2); }
| PROGRAM LABEL { parse_t::get_instance()->add_label($2); }
| PROGRAM VINSTRS
|
;

@ -1,159 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6ac977ff-bd53-4a74-8452-69b3500924e8}</ProjectGuid>
<RootNamespace>vmassembler</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="custom_build_rules\win_flex_bison_custom_build.props" />
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\dependencies\vmprofiler\include\;$(ProjectDir)..\dependencies\vmprofiler\dependencies\zydis\include;$(ProjectDir)..\dependencies\vmprofiler\dependencies\zydis\msvc;$(ProjectDir)..\dependencies\vmprofiler\dependencies\zydis\dependencies\zycore\include;$(ProjectDir)..\dependencies\cli-parser\;$(ProjectDir)..\dependencies\xtils\;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpplatest</LanguageStandard>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<AssemblyDebug>true</AssemblyDebug>
</Link>
<Bison />
<Bison>
<AdditionalOptions>
</AdditionalOptions>
</Bison>
<Flex />
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="compiler.cpp" />
<ClCompile Include="lexer.flex.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="parser.cpp" />
<ClCompile Include="parser.tab.cpp" />
</ItemGroup>
<ItemGroup>
<Flex Include="lexer.l">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
</Flex>
</ItemGroup>
<ItemGroup>
<Bison Include="parser.y" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\dependencies\cli-parser\cli-parser.hpp" />
<ClInclude Include="..\dependencies\vmprofiler\include\transform.hpp" />
<ClInclude Include="..\dependencies\vmprofiler\include\vm.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\vmctx.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\vmp2.hpp" />
<ClInclude Include="..\dependencies\vmprofiler\include\vmprofiler.hpp" />
<ClInclude Include="..\dependencies\vmprofiler\include\vmutils.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\ZycoreExportConfig.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Allocator.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Memory.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Process.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Synchronization.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Terminal.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Thread.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\ArgParse.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Bitset.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Comparison.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Defines.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Format.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\LibC.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\List.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Object.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Status.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\String.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Types.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Vector.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Zycore.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\ZydisExportConfig.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Decoder.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\DecoderTypes.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Formatter.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\FormatterBuffer.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumInstructionCategory.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumISAExt.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumISASet.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumMnemonic.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumRegister.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\DecoderData.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\FormatterATT.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\FormatterBase.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\FormatterIntel.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\SharedData.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\String.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\MetaInfo.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Mnemonic.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Register.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\SharedTypes.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\ShortString.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Status.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Utils.h" />
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Zydis.h" />
<ClInclude Include="..\dependencies\xtils\xtils.hpp" />
<ClInclude Include="compiler.h" />
<ClInclude Include="gen_code.hpp" />
<ClInclude Include="parser.h" />
<ClInclude Include="parser.tab.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\dependencies\vmprofiler\dependencies\zydis\msvc\zydis\Zydis.vcxproj">
<Project>{88a23124-5640-35a0-b890-311d7a67a7d2}</Project>
</ProjectReference>
<ProjectReference Include="..\dependencies\vmprofiler\vmprofiler.vcxproj">
<Project>{d0b6092a-9944-4f24-9486-4b7dae372619}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\.clang-format" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="custom_build_rules\win_flex_bison_custom_build.targets" />
</ImportGroup>
</Project>

@ -1,250 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Grammer Files">
<UniqueIdentifier>{588916a0-07de-47a7-8441-90c069dce494}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\vmprofiler">
<UniqueIdentifier>{f85b7642-b2f1-4e4a-b0f7-12bf32019ea5}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\vmprofiler\Zydis">
<UniqueIdentifier>{a6446cc2-eff0-4347-89a4-e49bfb61fc97}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\vmprofiler\Zydis\Generated">
<UniqueIdentifier>{29199b7a-1038-4779-8865-1e07e47242f1}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\vmprofiler\Zydis\Internal">
<UniqueIdentifier>{56b7bb3b-daad-492d-a59d-7531b8aecfde}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\vmprofiler\Zycore">
<UniqueIdentifier>{68c2cdf5-2680-4dba-9f55-1a2ca991b49f}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\vmprofiler\Zycore\API">
<UniqueIdentifier>{64515351-6807-48cf-a795-ee2538e1b999}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="parser.tab.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="lexer.flex.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="compiler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Bison Include="parser.y">
<Filter>Grammer Files</Filter>
</Bison>
</ItemGroup>
<ItemGroup>
<Flex Include="lexer.l">
<Filter>Grammer Files</Filter>
</Flex>
</ItemGroup>
<ItemGroup>
<ClInclude Include="parser.tab.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="compiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Memory.h">
<Filter>Header Files\vmprofiler\Zycore\API</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Process.h">
<Filter>Header Files\vmprofiler\Zycore\API</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Synchronization.h">
<Filter>Header Files\vmprofiler\Zycore\API</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Terminal.h">
<Filter>Header Files\vmprofiler\Zycore\API</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\API\Thread.h">
<Filter>Header Files\vmprofiler\Zycore\API</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Allocator.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\ArgParse.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Bitset.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Comparison.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Defines.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Format.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\LibC.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\List.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Object.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Status.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\String.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Types.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Vector.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zycore\Zycore.h">
<Filter>Header Files\vmprofiler\Zycore</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumInstructionCategory.h">
<Filter>Header Files\vmprofiler\Zydis\Generated</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumISAExt.h">
<Filter>Header Files\vmprofiler\Zydis\Generated</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumISASet.h">
<Filter>Header Files\vmprofiler\Zydis\Generated</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumMnemonic.h">
<Filter>Header Files\vmprofiler\Zydis\Generated</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Generated\EnumRegister.h">
<Filter>Header Files\vmprofiler\Zydis\Generated</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\DecoderData.h">
<Filter>Header Files\vmprofiler\Zydis\Internal</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\FormatterATT.h">
<Filter>Header Files\vmprofiler\Zydis\Internal</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\FormatterBase.h">
<Filter>Header Files\vmprofiler\Zydis\Internal</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\FormatterIntel.h">
<Filter>Header Files\vmprofiler\Zydis\Internal</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\SharedData.h">
<Filter>Header Files\vmprofiler\Zydis\Internal</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Internal\String.h">
<Filter>Header Files\vmprofiler\Zydis\Internal</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Decoder.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\DecoderTypes.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Formatter.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\FormatterBuffer.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\MetaInfo.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Mnemonic.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Register.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\SharedTypes.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\ShortString.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Status.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Utils.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\Zydis\Zydis.h">
<Filter>Header Files\vmprofiler\Zydis</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\transform.hpp">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\vm.h">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\vmctx.h">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\vmp2.hpp">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\vmprofiler.hpp">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\vmutils.h">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\ZycoreExportConfig.h">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\vmprofiler\include\ZydisExportConfig.h">
<Filter>Header Files\vmprofiler</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\xtils\xtils.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\cli-parser\cli-parser.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gen_code.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="..\.clang-format">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

Binary file not shown.

Binary file not shown.

@ -1,266 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmassembler", "src\vmassembler.vcxproj", "{6AC977FF-BD53-4A74-8452-69B3500924E8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zydis", "dependencies\vmprofiler\dependencies\zydis\msvc\zydis\Zydis.vcxproj", "{88A23124-5640-35A0-B890-311D7A67A7D2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmprofiler", "dependencies\vmprofiler\vmprofiler.vcxproj", "{D0B6092A-9944-4F24-9486-4B7DAE372619}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo", "demo\demo.vcxproj", "{1DC5C971-7D10-488D-A4BF-8702FA804559}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dependencies", "dependencies", "{78C20558-6361-4C90-BE9E-273885FFA6C5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DBG|x64 = DBG|x64
DBG|x86 = DBG|x86
Debug Kernel|x64 = Debug Kernel|x64
Debug Kernel|x86 = Debug Kernel|x86
Debug MD DLL|x64 = Debug MD DLL|x64
Debug MD DLL|x86 = Debug MD DLL|x86
Debug MD|x64 = Debug MD|x64
Debug MD|x86 = Debug MD|x86
Debug MT DLL|x64 = Debug MT DLL|x64
Debug MT DLL|x86 = Debug MT DLL|x86
Debug MT|x64 = Debug MT|x64
Debug MT|x86 = Debug MT|x86
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release Kernel|x64 = Release Kernel|x64
Release Kernel|x86 = Release Kernel|x86
Release MD DLL|x64 = Release MD DLL|x64
Release MD DLL|x86 = Release MD DLL|x86
Release MD|x64 = Release MD|x64
Release MD|x86 = Release MD|x86
Release MT DLL|x64 = Release MT DLL|x64
Release MT DLL|x86 = Release MT DLL|x86
Release MT|x64 = Release MT|x64
Release MT|x86 = Release MT|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6AC977FF-BD53-4A74-8452-69B3500924E8}.DBG|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.DBG|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.DBG|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.DBG|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug Kernel|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug Kernel|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug Kernel|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug Kernel|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD DLL|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD DLL|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD DLL|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD DLL|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MD|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT DLL|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT DLL|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT DLL|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT DLL|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug MT|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Debug|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release Kernel|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release Kernel|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release Kernel|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release Kernel|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD DLL|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD DLL|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD DLL|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD DLL|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MD|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT DLL|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT DLL|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT DLL|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT DLL|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT|x86.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release MT|x86.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release|x64.ActiveCfg = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release|x64.Build.0 = Release|x64
{6AC977FF-BD53-4A74-8452-69B3500924E8}.Release|x86.ActiveCfg = Release|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x64.ActiveCfg = Debug MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x64.Build.0 = Debug MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x86.ActiveCfg = Debug MT|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.DBG|x86.Build.0 = Debug MT|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug Kernel|x64.ActiveCfg = Debug Kernel|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug Kernel|x64.Build.0 = Debug Kernel|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug Kernel|x64.Deploy.0 = Debug Kernel|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug Kernel|x86.ActiveCfg = Debug Kernel|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug Kernel|x86.Build.0 = Debug Kernel|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug Kernel|x86.Deploy.0 = Debug Kernel|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD DLL|x64.ActiveCfg = Debug MD DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD DLL|x64.Build.0 = Debug MD DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD DLL|x86.ActiveCfg = Debug MD DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD DLL|x86.Build.0 = Debug MD DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD|x64.ActiveCfg = Debug MD|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD|x64.Build.0 = Debug MD|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD|x86.ActiveCfg = Debug MD|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MD|x86.Build.0 = Debug MD|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT DLL|x64.ActiveCfg = Debug MT DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT DLL|x64.Build.0 = Debug MT DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT DLL|x86.ActiveCfg = Debug MT DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT DLL|x86.Build.0 = Debug MT DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT|x64.ActiveCfg = Debug MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT|x64.Build.0 = Debug MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT|x86.ActiveCfg = Debug MT|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug MT|x86.Build.0 = Debug MT|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug|x64.ActiveCfg = Debug MD DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug|x64.Build.0 = Debug MD DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug|x86.ActiveCfg = Debug MD DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Debug|x86.Build.0 = Debug MD DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release Kernel|x64.ActiveCfg = Release Kernel|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release Kernel|x64.Build.0 = Release Kernel|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release Kernel|x64.Deploy.0 = Release Kernel|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release Kernel|x86.ActiveCfg = Release Kernel|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release Kernel|x86.Build.0 = Release Kernel|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release Kernel|x86.Deploy.0 = Release Kernel|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD DLL|x64.ActiveCfg = Release MD DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD DLL|x64.Build.0 = Release MD DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD DLL|x86.ActiveCfg = Release MD DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD DLL|x86.Build.0 = Release MD DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD|x64.ActiveCfg = Release MD|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD|x64.Build.0 = Release MD|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD|x86.ActiveCfg = Release MD|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MD|x86.Build.0 = Release MD|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT DLL|x64.ActiveCfg = Release MT DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT DLL|x64.Build.0 = Release MT DLL|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT DLL|x86.ActiveCfg = Release MT DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT DLL|x86.Build.0 = Release MT DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT|x64.ActiveCfg = Release MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT|x64.Build.0 = Release MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT|x86.ActiveCfg = Release MT|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release MT|x86.Build.0 = Release MT|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x64.ActiveCfg = Release MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x64.Build.0 = Release MT|x64
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x86.ActiveCfg = Release MT DLL|Win32
{88A23124-5640-35A0-B890-311D7A67A7D2}.Release|x86.Build.0 = Release MT DLL|Win32
{D0B6092A-9944-4F24-9486-4B7DAE372619}.DBG|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.DBG|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.DBG|x86.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug Kernel|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug Kernel|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug Kernel|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug Kernel|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD DLL|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD DLL|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD DLL|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD DLL|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MD|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT DLL|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT DLL|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT DLL|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT DLL|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug MT|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug|x64.ActiveCfg = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug|x64.Build.0 = DBG|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Debug|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release Kernel|x64.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release Kernel|x64.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release Kernel|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release Kernel|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD DLL|x64.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD DLL|x64.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD DLL|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD DLL|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD|x64.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD|x64.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MD|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT DLL|x64.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT DLL|x64.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT DLL|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT DLL|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT|x64.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT|x64.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT|x86.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release MT|x86.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release|x64.ActiveCfg = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release|x64.Build.0 = Release|x64
{D0B6092A-9944-4F24-9486-4B7DAE372619}.Release|x86.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.DBG|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.DBG|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.DBG|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.DBG|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug Kernel|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug Kernel|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug Kernel|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug Kernel|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD DLL|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD DLL|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD DLL|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD DLL|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MD|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT DLL|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT DLL|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT DLL|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT DLL|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug MT|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug|x64.ActiveCfg = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug|x64.Build.0 = Debug|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug|x86.ActiveCfg = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Debug|x86.Build.0 = Debug|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release Kernel|x64.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release Kernel|x64.Build.0 = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release Kernel|x86.ActiveCfg = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release Kernel|x86.Build.0 = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD DLL|x64.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD DLL|x64.Build.0 = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD DLL|x86.ActiveCfg = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD DLL|x86.Build.0 = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD|x64.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD|x64.Build.0 = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD|x86.ActiveCfg = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MD|x86.Build.0 = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT DLL|x64.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT DLL|x64.Build.0 = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT DLL|x86.ActiveCfg = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT DLL|x86.Build.0 = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT|x64.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT|x64.Build.0 = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT|x86.ActiveCfg = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release MT|x86.Build.0 = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release|x64.ActiveCfg = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release|x64.Build.0 = Release|x64
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release|x86.ActiveCfg = Release|Win32
{1DC5C971-7D10-488D-A4BF-8702FA804559}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{88A23124-5640-35A0-B890-311D7A67A7D2} = {78C20558-6361-4C90-BE9E-273885FFA6C5}
{D0B6092A-9944-4F24-9486-4B7DAE372619} = {78C20558-6361-4C90-BE9E-273885FFA6C5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BDC537F0-DE8E-4744-A03B-BD9FD0B98C60}
EndGlobalSection
EndGlobal
Loading…
Cancel
Save