ref: 1c9faa24f4c93f37db2bddf84d973c02f090bc31
parent: 74b7881f93ea9d2df51931debba10770b7fa9cbc
author: Andrew Chambers <ac@acha.ninja>
date: Thu Apr 7 15:20:39 CDT 2022
Tidy, work on migrating tests.
--- /dev/null
+++ b/LICENSE
@@ -1,0 +1,14 @@
+Copyright (c) 2007-2013, Ian Piumarta
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the 'Software'), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies or substantial portions of the Software. Inclusion of the
+above copyright notice(s) and this permission notice in supporting
+documentation would be appreciated but is not required.
+
+THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
--- a/LICENSE.txt
+++ /dev/null
@@ -1,14 +1,0 @@
-Copyright (c) 2007-2013, Ian Piumarta
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the 'Software'), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, and/or sell copies of the
-Software, and to permit persons to whom the Software is furnished to do so,
-provided that the above copyright notice(s) and this permission notice appear
-in all copies or substantial portions of the Software. Inclusion of the
-above copyright notice(s) and this permission notice in supporting
-documentation would be appreciated but is not required.
-
-THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,10 @@
CFLAGS = -g -Wall $(OFLAGS) $(XFLAGS) -Isrc
OFLAGS = -O3 -DNDEBUG
-#OFLAGS = -pg
OBJS = tree.o compile.o
-all : peg leg
+all : leg
-peg : peg.o $(OBJS)
- $(CC) $(CFLAGS) -o $@-new peg.o $(OBJS)
- mv $@-new $@
-
leg : leg.o $(OBJS)
$(CC) $(CFLAGS) -o $@-new leg.o $(OBJS)
mv $@-new $@
@@ -19,7 +14,7 @@
BINDIR = $(ROOT)$(PREFIX)/bin
MANDIR = $(ROOT)$(PREFIX)/man/man1
-install : $(BINDIR) $(BINDIR)/peg $(BINDIR)/leg $(MANDIR) $(MANDIR)/peg.1
+install : $(BINDIR) $(BINDIR)/leg $(MANDIR) $(MANDIR)/peg.1
$(BINDIR) :
mkdir -p $(BINDIR)
@@ -35,7 +30,6 @@
cp -p $< $@
uninstall : .FORCE
- rm -f $(BINDIR)/peg
rm -f $(BINDIR)/leg
rm -f $(MANDIR)/peg.1
@@ -42,46 +36,26 @@
%.o : src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
-peg.o : src/peg.c src/peg.peg-c
-
leg.o : src/leg.c
-check : check-peg check-leg
+check : check-leg
-check-peg : peg.peg-c .FORCE
- diff src/peg.peg-c peg.peg-c
-
check-leg : leg.c .FORCE
diff src/leg.c leg.c
-peg.peg-c : src/peg.peg peg
- ./peg -o $@ $<
-
leg.c : src/leg.leg leg
./leg -o $@ $<
-new : newpeg newleg
+new : newleg
-newpeg : peg.peg-c
- mv src/peg.peg-c src/peg.peg-c-
- mv peg.peg-c src/.
-
newleg : leg.c
mv src/leg.c src/leg.c-
mv leg.c src/.
-test examples : peg leg .FORCE
+test examples : leg .FORCE
$(SHELL) -ec '(cd examples; $(MAKE))'
clean : .FORCE
- rm -f src/*~ *~ *.o *.peg.[cd] *.leg.[cd] peg.peg-c leg.c
- $(SHELL) -ec '(cd examples; $(MAKE) $@)'
-
-spotless : clean .FORCE
- rm -f src/*-
- rm -rf build
- rm -f peg
- rm -f leg
- $(SHELL) -ec '(cd examples; $(MAKE) $@)'
+ rm -f leg *.o
.FORCE :
--- a/README.txt
+++ /dev/null
@@ -1,42 +1,0 @@
-Building on a Unix-like system
-------------------------------
-
-Type 'make' or 'make test'.
-
-The latter builds all the examples and runs them, comparing their
-output with the expected output.
-
-Type 'make install' to install the binaries and manual page under
-/usr/local. (Type 'make uninstall' to remove them.) You may have to
-do this using 'sudo' or while logged in as root.
-
-Edit 'Makefile' to change the way things are built and/or the places
-where things are installed.
-
-
-Building on MacOS X
--------------------
-
-Run the 'build-mac.sh' script from a terminal or by double-clicking on
-it in the Finder.
-
-You will need Xcode. The provided project is known to work with Xcode
-versions 3.2.6 and 4.3.2.
-
-Modify build-mac.sh and/or peg.xcodeproj to change the way things are
-built.
-
-
-Building on Windows
--------------------
-
-Run the 'build-win.cmd' script.
-
-You will need Visual Studio 2010 Express.
-
-Modify build-win.cmd, leg.vcxproj, leg.vcxproj.filters, peg.gyp,
-peg.sln, peg.vcxproj and/or peg.vcxproj.filters to change the way
-things are built.
-
-Local implementations of getopt() and basename() are provided in the
-'win' directory.
--- a/build-mac.sh
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/bash
-
-xcodebuild -project peg.xcodeproj -configuration Release
-
-cp build/Release/peg ./
-cp build/Release/leg ./
--- a/build-win.cmd
+++ /dev/null
@@ -1,5 +1,0 @@
-@echo off
-call "%VS100COMNTOOLS%vsvars32.bat"
-msbuild peg.sln /p:Configuration=Release
-
-xcopy /Y /D Release\*.exe .\
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -8,7 +8,7 @@
all : $(EXAMPLES)
test : .FORCE
- ../peg -o test.peg.c test.peg
+ ../leg -o test.leg.c test.leg
$(CC) $(CFLAGS) -o test test.c
echo 'ab.ac.ad.ae.afg.afh.afg.afh.afi.afj.' | ./$@ | $(TEE) $@.out
$(DIFF) $@.ref $@.out
@@ -16,7 +16,7 @@
@echo
rule : .FORCE
- ../peg -o rule.peg.c rule.peg
+ ../peg -o rule.leg.c rule.leg
$(CC) $(CFLAGS) -o rule rule.c
echo 'abcbcdabcbcdabcbcdabcbcd' | ./$@ | $(TEE) $@.out
$(DIFF) $@.ref $@.out
@@ -24,7 +24,7 @@
@echo
accept : .FORCE
- ../peg -o accept.peg.c accept.peg
+ ../peg -o accept.leg.c accept.leg
$(CC) $(CFLAGS) -o accept accept.c
echo 'abcbcdabcbcdabcbcdabcbcd' | ./$@ | $(TEE) $@.out
$(DIFF) $@.ref $@.out
@@ -40,7 +40,7 @@
@echo
dc : .FORCE
- ../peg -o dc.peg.c dc.peg
+ ../peg -o dc.leg.c dc.leg
$(CC) $(CFLAGS) -o dc dc.c
echo ' 2 *3 *(3+ 4) ' | ./dc | $(TEE) $@.out
$(DIFF) $@.ref $@.out
@@ -48,7 +48,7 @@
@echo
dcv : .FORCE
- ../peg -o dcv.peg.c dcv.peg
+ ../peg -o dcv.leg.c dcv.leg
$(CC) $(CFLAGS) -o dcv dcv.c
echo 'a = 6; b = 7; a * b' | ./dcv | $(TEE) $@.out
$(DIFF) $@.ref $@.out
@@ -72,7 +72,7 @@
@echo
localpeg : .FORCE
- ../peg -o test.peg.c test.peg
+ ../peg -o test.leg.c test.leg
$(CC) $(CFLAGS) -o localpeg localpeg.c
echo 'ab.ac.ad.ae.afg.afh.afg.afh.afi.afj.' | ./$@ | $(TEE) $@.out
$(DIFF) $@.ref $@.out
--- /dev/null
+++ b/examples/test.leg
@@ -1,0 +1,13 @@
+start = body '.' { printf(".\n"); };
+
+body = 'a' { printf("a1 "); } 'b' { printf("ab1 "); }
+
+ | 'a' { printf("a2 "); } 'c' { printf("ac2 "); }
+
+ | 'a' { printf("a3 "); } ( 'd' { printf("ad3 "); } | 'e' { printf("ae3 "); } )
+
+ | 'a' { printf("a4 "); } ( 'f' { printf("af4 "); } 'g' { printf("afg4 "); }
+ | 'f' { printf("af5 "); } 'h' { printf("afh5 "); } )
+
+ | 'a' { printf("a6 "); } ( 'f' &{ printf("af6 ") } 'i' &{ printf("afi6 ") }
+ | 'f' &{ printf("af7 ") } 'j' &{ printf("afj7 ") } );
--- a/examples/test.peg
+++ /dev/null
@@ -1,13 +1,0 @@
-start <- body '.' { printf(".\n"); }
-
-body <- 'a' { printf("a1 "); } 'b' { printf("ab1 "); }
-
- / 'a' { printf("a2 "); } 'c' { printf("ac2 "); }
-
- / 'a' { printf("a3 "); } ( 'd' { printf("ad3 "); } / 'e' { printf("ae3 "); } )
-
- / 'a' { printf("a4 "); } ( 'f' { printf("af4 "); } 'g' { printf("afg4 "); }
- / 'f' { printf("af5 "); } 'h' { printf("afh5 "); } )
-
- / 'a' { printf("a6 "); } ( 'f' &{ printf("af6 ") } 'i' &{ printf("afi6 ") }
- / 'f' &{ printf("af7 ") } 'j' &{ printf("afj7 ") } )
--- a/leg.vcxproj
+++ /dev/null
@@ -1,75 +1,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" 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>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>leg</RootNamespace>
- <TargetName>$(ProjectName)</TargetName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings" />
- <ImportGroup Label="PropertySheets">
- <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\.\bin\;$(MSBuildProjectDirectory)\.\bin\</ExecutablePath>
- <IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
- <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
- <SubSystem>Console</SubSystem>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
- <SubSystem>Console</SubSystem>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <None Include="peg.gyp" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\compile.c" />
- <ClCompile Include="src\leg.c" />
- <ClCompile Include="src\tree.c" />
- <ClCompile Include="win\getopt.c" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets" />
-</Project>
\ No newline at end of file
--- a/leg.vcxproj.filters
+++ /dev/null
@@ -1,19 +1,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="win">
- <UniqueIdentifier>{47FC5EC4-15EB-E92F-89D7-AFE51CF838A9}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <None Include="peg.gyp" />
- <ClCompile Include="win\getopt.c">
- <Filter>win</Filter>
- </ClCompile>
- <ClCompile Include="src\compile.c" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\leg.c" />
- <ClCompile Include="src\tree.c" />
- </ItemGroup>
-</Project>
\ No newline at end of file
--- a/peg.gyp
+++ /dev/null
@@ -1,81 +1,0 @@
-{
- 'targets': [
- {
- 'target_name': 'peg',
- 'type': 'executable',
- 'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',
- 'sources': [
- 'peg.c',
- 'tree.c',
- 'compile.c',
- ],
- 'conditions': [
- ['OS=="win"', {
- 'include_dirs': [
- 'win',
- ],
- 'sources': [
- 'win/getopt.c',
- ],
- }],
- ],
- },
- {
- 'target_name': 'leg',
- 'type': 'executable',
- 'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66',
- 'sources': [
- 'leg.c',
- 'tree.c',
- 'compile.c',
- ],
- 'conditions': [
- ['OS=="win"', {
- 'include_dirs': [
- 'win',
- ],
- 'sources': [
- 'win/getopt.c',
- ],
- }],
- ],
- },
- ],
-
- 'target_defaults': {
- 'configurations': {
- 'Debug': {
- 'defines': [
- 'DEBUG',
- ],
- },
- 'Release': {
- 'defines': [
- 'NDEBUG',
- ],
- },
- },
- },
-
- # define default project settings
- 'conditions': [
- ['OS=="win"', {
- 'target_defaults': {
- 'defines': [
- 'WIN32',
- '_WINDOWS',
- ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'GenerateDebugInformation': 'true',
- # SubSystem values:
- # 0 == not set
- # 1 == /SUBSYSTEM:CONSOLE
- # 2 == /SUBSYSTEM:WINDOWS
- 'SubSystem': '1',
- },
- },
- },
- }],
- ],
-}
--- a/peg.sln
+++ /dev/null
@@ -1,27 +1,0 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "leg", "leg.vcxproj", "{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "peg", "peg.vcxproj", "{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}.Debug|Win32.ActiveCfg = Debug|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}.Debug|Win32.Build.0 = Debug|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}.Release|Win32.ActiveCfg = Release|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}.Release|Win32.Build.0 = Release|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66}.Debug|Win32.ActiveCfg = Debug|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66}.Debug|Win32.Build.0 = Debug|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66}.Release|Win32.ActiveCfg = Release|Win32
- {5ECEC9E5-8F23-47B6-93E0-C3B328B3BE66}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- EndGlobalSection
-EndGlobal
--- a/peg.vcxproj
+++ /dev/null
@@ -1,75 +1,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" 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>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>peg</RootNamespace>
- <TargetName>$(ProjectName)</TargetName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings" />
- <ImportGroup Label="PropertySheets">
- <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\.\bin\;$(MSBuildProjectDirectory)\.\bin\</ExecutablePath>
- <IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
- <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
- <SubSystem>Console</SubSystem>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
- <SubSystem>Console</SubSystem>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <None Include="peg.gyp" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\compile.c" />
- <ClCompile Include="src\peg.c" />
- <ClCompile Include="src\tree.c" />
- <ClCompile Include="win\getopt.c" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets" />
-</Project>
\ No newline at end of file
--- a/peg.vcxproj.filters
+++ /dev/null
@@ -1,19 +1,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="win">
- <UniqueIdentifier>{47FC5EC4-15EB-E92F-89D7-AFE51CF838A9}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <None Include="peg.gyp" />
- <ClCompile Include="win\getopt.c">
- <Filter>win</Filter>
- </ClCompile>
- <ClCompile Include="src\compile.c" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\peg.c" />
- <ClCompile Include="src\tree.c" />
- </ItemGroup>
-</Project>
\ No newline at end of file
--- a/peg.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,317 +1,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 45;
- objects = {
-
-/* Begin PBXAggregateTarget section */
- EFBC7368F96EACB75989C21D /* All */ = {
- isa = PBXAggregateTarget;
- buildConfigurationList = 007E1122105A105C63F8A59F /* Build configuration list for PBXAggregateTarget "All" */;
- buildPhases = (
- );
- dependencies = (
- B85F90055126E00C1334834C /* PBXTargetDependency */,
- 3DF530CEA77A591E4DFBFF2F /* PBXTargetDependency */,
- );
- name = All;
- productName = All;
- };
-/* End PBXAggregateTarget section */
-
-/* Begin PBXBuildFile section */
- 2D4E663DE432A398FC78635B /* compile.c in Sources */ = {isa = PBXBuildFile; fileRef = D4BAF07C3AF28E51DD58E853 /* compile.c */; };
- 3FE25C706AB45972C102CBB4 /* tree.c in Sources */ = {isa = PBXBuildFile; fileRef = E503317C684EFEB3E7E03861 /* tree.c */; };
- 4D30CEABCD51397A50F65058 /* compile.c in Sources */ = {isa = PBXBuildFile; fileRef = D4BAF07C3AF28E51DD58E853 /* compile.c */; };
- 7921C7C2AD25A4A4C02470F5 /* peg.c in Sources */ = {isa = PBXBuildFile; fileRef = 27FA3C119507A9A914A66936 /* peg.c */; };
- 8B61C6AE75A1750C17350E64 /* tree.c in Sources */ = {isa = PBXBuildFile; fileRef = E503317C684EFEB3E7E03861 /* tree.c */; };
- D8C3FFD80B6642D8BB341B90 /* leg.c in Sources */ = {isa = PBXBuildFile; fileRef = 454F9F599E7B65F90C62CF9C /* leg.c */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
- 12CD2CA862C5C1693300D7EF /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = D23EA86C97C1C940E2591A06 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 84A1E5C1231D1E337ED0FC84;
- remoteInfo = leg;
- };
- 22C9A5E8EF76D4B801BB24E5 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = D23EA86C97C1C940E2591A06 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 050EA9DBA8F5C296C3E39B8A;
- remoteInfo = peg;
- };
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
- 27FA3C119507A9A914A66936 /* peg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = src/peg.c; sourceTree = "<group>"; };
- 4165F882B6F541E12DBD6A0D /* peg */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = peg; sourceTree = BUILT_PRODUCTS_DIR; };
- 454F9F599E7B65F90C62CF9C /* leg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = src/leg.c; sourceTree = "<group>"; };
- 5C991B5472A7498A982B7350 /* peg.gyp */ = {isa = PBXFileReference; lastKnownFileType = text; path = peg.gyp; sourceTree = "<group>"; };
- C9B3F1D07DD720C50DE87DC5 /* leg */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = leg; sourceTree = BUILT_PRODUCTS_DIR; };
- D4BAF07C3AF28E51DD58E853 /* compile.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = src/compile.c; sourceTree = "<group>"; };
- E503317C684EFEB3E7E03861 /* tree.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = src/tree.c; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 3DF86BD64E76AD4F8D892CF6 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 97D5812F2529A3E39CE17CDE /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 3854A05A8AE7E9B329F09174 /* Build */ = {
- isa = PBXGroup;
- children = (
- 5C991B5472A7498A982B7350 /* peg.gyp */,
- );
- name = Build;
- sourceTree = "<group>";
- };
- AB7FD4EAF4FFE1A1CE63E31B = {
- isa = PBXGroup;
- children = (
- E2D71C5771542F758C302162 /* Source */,
- AF64E60ED33C9E5DC5DB4C21 /* Products */,
- 3854A05A8AE7E9B329F09174 /* Build */,
- );
- sourceTree = "<group>";
- };
- AF64E60ED33C9E5DC5DB4C21 /* Products */ = {
- isa = PBXGroup;
- children = (
- 4165F882B6F541E12DBD6A0D /* peg */,
- C9B3F1D07DD720C50DE87DC5 /* leg */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- E2D71C5771542F758C302162 /* Source */ = {
- isa = PBXGroup;
- children = (
- D4BAF07C3AF28E51DD58E853 /* compile.c */,
- 454F9F599E7B65F90C62CF9C /* leg.c */,
- 27FA3C119507A9A914A66936 /* peg.c */,
- E503317C684EFEB3E7E03861 /* tree.c */,
- );
- name = Source;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 050EA9DBA8F5C296C3E39B8A /* peg */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = EF4B00311D83FC2C01B276A4 /* Build configuration list for PBXNativeTarget "peg" */;
- buildPhases = (
- 74AA795D8990365CCE282118 /* Sources */,
- 97D5812F2529A3E39CE17CDE /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = peg;
- productName = peg;
- productReference = 4165F882B6F541E12DBD6A0D /* peg */;
- productType = "com.apple.product-type.tool";
- };
- 84A1E5C1231D1E337ED0FC84 /* leg */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = F7568C4D321FF46C2F4B43FB /* Build configuration list for PBXNativeTarget "leg" */;
- buildPhases = (
- 915DAD0C515729956FE2BC69 /* Sources */,
- 3DF86BD64E76AD4F8D892CF6 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = leg;
- productName = leg;
- productReference = C9B3F1D07DD720C50DE87DC5 /* leg */;
- productType = "com.apple.product-type.tool";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- D23EA86C97C1C940E2591A06 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- BuildIndependentTargetsInParallel = YES;
- };
- buildConfigurationList = 283B121430353A60CB56914F /* Build configuration list for PBXProject "peg" */;
- compatibilityVersion = "Xcode 3.2";
- hasScannedForEncodings = 1;
- mainGroup = AB7FD4EAF4FFE1A1CE63E31B;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- EFBC7368F96EACB75989C21D /* All */,
- 050EA9DBA8F5C296C3E39B8A /* peg */,
- 84A1E5C1231D1E337ED0FC84 /* leg */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
- 74AA795D8990365CCE282118 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 7921C7C2AD25A4A4C02470F5 /* peg.c in Sources */,
- 8B61C6AE75A1750C17350E64 /* tree.c in Sources */,
- 4D30CEABCD51397A50F65058 /* compile.c in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 915DAD0C515729956FE2BC69 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- D8C3FFD80B6642D8BB341B90 /* leg.c in Sources */,
- 3FE25C706AB45972C102CBB4 /* tree.c in Sources */,
- 2D4E663DE432A398FC78635B /* compile.c in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
- 3DF530CEA77A591E4DFBFF2F /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 84A1E5C1231D1E337ED0FC84 /* leg */;
- targetProxy = 12CD2CA862C5C1693300D7EF /* PBXContainerItemProxy */;
- };
- B85F90055126E00C1334834C /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 050EA9DBA8F5C296C3E39B8A /* peg */;
- targetProxy = 22C9A5E8EF76D4B801BB24E5 /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
-/* Begin XCBuildConfiguration section */
- 05AA053A004215362908ED84 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- EXECUTABLE_PREFIX = "";
- GCC_PREPROCESSOR_DEFINITIONS = "\"NDEBUG\"";
- PRODUCT_NAME = peg;
- };
- name = Release;
- };
- 2CB45BB7949774F10834EB3B /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
- SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
- };
- name = Release;
- };
- 7C93F597151F1782DBAF2E6E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
- SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
- };
- name = Debug;
- };
- 879858F43394AA4CEFDC7263 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- EXECUTABLE_PREFIX = "";
- GCC_PREPROCESSOR_DEFINITIONS = "\"NDEBUG\"";
- PRODUCT_NAME = leg;
- };
- name = Release;
- };
- 8CF09EF6E825DDB8D49A6EA9 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = All;
- };
- name = Release;
- };
- DEFEA64AA5600BECDDA9A939 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = All;
- };
- name = Debug;
- };
- E2B1202070FAC019FA0BF2ED /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- EXECUTABLE_PREFIX = "";
- GCC_PREPROCESSOR_DEFINITIONS = "\"DEBUG\"";
- PRODUCT_NAME = leg;
- };
- name = Debug;
- };
- F41144D27A6369001B96C713 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- EXECUTABLE_PREFIX = "";
- GCC_PREPROCESSOR_DEFINITIONS = "\"DEBUG\"";
- PRODUCT_NAME = peg;
- };
- name = Debug;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 007E1122105A105C63F8A59F /* Build configuration list for PBXAggregateTarget "All" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- DEFEA64AA5600BECDDA9A939 /* Debug */,
- 8CF09EF6E825DDB8D49A6EA9 /* Release */,
- );
- defaultConfigurationIsVisible = 1;
- defaultConfigurationName = Debug;
- };
- 283B121430353A60CB56914F /* Build configuration list for PBXProject "peg" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 7C93F597151F1782DBAF2E6E /* Debug */,
- 2CB45BB7949774F10834EB3B /* Release */,
- );
- defaultConfigurationIsVisible = 1;
- defaultConfigurationName = Debug;
- };
- EF4B00311D83FC2C01B276A4 /* Build configuration list for PBXNativeTarget "peg" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- F41144D27A6369001B96C713 /* Debug */,
- 05AA053A004215362908ED84 /* Release */,
- );
- defaultConfigurationIsVisible = 1;
- defaultConfigurationName = Debug;
- };
- F7568C4D321FF46C2F4B43FB /* Build configuration list for PBXNativeTarget "leg" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- E2B1202070FAC019FA0BF2ED /* Debug */,
- 879858F43394AA4CEFDC7263 /* Release */,
- );
- defaultConfigurationIsVisible = 1;
- defaultConfigurationName = Debug;
- };
-/* End XCConfigurationList section */
- };
- rootObject = D23EA86C97C1C940E2591A06 /* Project object */;
-}
--- a/src/peg.c
+++ /dev/null
@@ -1,179 +1,0 @@
-/* Copyright (c) 2007 by Ian Piumarta
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the 'Software'),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, provided that the above copyright notice(s) and this
- * permission notice appear in all copies of the Software. Acknowledgement
- * of the use of this Software in supporting documentation would be
- * appreciated but is not required.
- *
- * THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
- *
- * Last edited: 2016-07-22 09:45:47 by piumarta on zora.local
- */
-
-#include "tree.h"
-#include "version.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <libgen.h>
-#include <assert.h>
-
-FILE *input= 0;
-
-int verboseFlag= 0;
-int nolinesFlag= 0;
-
-static int lineNumber= 0;
-static char *fileName= 0;
-
-void yyerror(char *message);
-
-#define YY_INPUT(buf, result, max) \
-{ \
- int c= getc(input); \
- if ('\n' == c || '\r' == c) ++lineNumber; \
- result= (EOF == c) ? 0 : (*(buf)= c, 1); \
-}
-
-#define YY_LOCAL(T) static T
-#define YY_RULE(T) static T
-
-#include "peg.peg-c"
-
-void yyerror(char *message)
-{
- fprintf(stderr, "%s:%d: %s", fileName, lineNumber, message);
- if (yyctx->__text[0]) fprintf(stderr, " near token '%s'", yyctx->__text);
- if (yyctx->__pos < yyctx->__limit || !feof(input))
- {
- yyctx->__buf[yyctx->__limit]= '\0';
- fprintf(stderr, " before text \"");
- while (yyctx->__pos < yyctx->__limit)
- {
- if ('\n' == yyctx->__buf[yyctx->__pos] || '\r' == yyctx->__buf[yyctx->__pos]) break;
- fputc(yyctx->__buf[yyctx->__pos++], stderr);
- }
- if (yyctx->__pos == yyctx->__limit)
- {
- int c;
- while (EOF != (c= fgetc(input)) && '\n' != c && '\r' != c)
- fputc(c, stderr);
- }
- fputc('\"', stderr);
- }
- fprintf(stderr, "\n");
- exit(1);
-}
-
-static void version(char *name)
-{
- printf("%s version %d.%d.%d\n", name, PEG_MAJOR, PEG_MINOR, PEG_LEVEL);
-}
-
-static void usage(char *name)
-{
- version(name);
- fprintf(stderr, "usage: %s [<option>...] [<file>...]\n", name);
- fprintf(stderr, "where <option> can be\n");
- fprintf(stderr, " -h print this help information\n");
- fprintf(stderr, " -o <ofile> write output to <ofile>\n");
- fprintf(stderr, " -P do not generate #line directives\n");
- fprintf(stderr, " -v be verbose\n");
- fprintf(stderr, " -V print version number and exit\n");
- fprintf(stderr, "if no <file> is given, input is read from stdin\n");
- fprintf(stderr, "if no <ofile> is given, output is written to stdout\n");
- exit(1);
-}
-
-int main(int argc, char **argv)
-{
- Node *n;
- int c;
-
- output= stdout;
- input= stdin;
- lineNumber= 1;
- fileName= "<stdin>";
-
- while (-1 != (c= getopt(argc, argv, "PVho:v")))
- {
- switch (c)
- {
- case 'V':
- version(basename(argv[0]));
- exit(0);
-
- case 'h':
- usage(basename(argv[0]));
- break;
-
- case 'o':
- if (!(output= fopen(optarg, "w")))
- {
- perror(optarg);
- exit(1);
- }
- break;
-
- case 'P':
- nolinesFlag= 1;
- break;
-
- case 'v':
- verboseFlag= 1;
- break;
-
- default:
- fprintf(stderr, "for usage try: %s -h\n", argv[0]);
- exit(1);
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc)
- {
- for (; argc; --argc, ++argv)
- {
- if (!strcmp(*argv, "-"))
- {
- input= stdin;
- fileName= "<stdin>";
- }
- else
- {
- if (!(input= fopen(*argv, "r")))
- {
- perror(*argv);
- exit(1);
- }
- fileName= *argv;
- }
- lineNumber= 1;
- if (!yyparse())
- yyerror("syntax error");
- if (input != stdin)
- fclose(input);
- }
- }
- else
- if (!yyparse())
- yyerror("syntax error");
-
- if (verboseFlag)
- for (n= rules; n; n= n->any.next)
- Rule_print(n);
-
- Rule_compile_c_header();
- if (rules) Rule_compile_c(rules, nolinesFlag);
-
- return 0;
-}
--- a/src/peg.peg
+++ /dev/null
@@ -1,77 +1,0 @@
-# PE Grammar for PE Grammars
-#
-# Adapted from [1] by Ian Piumarta <first-name at last-name point com>.
-#
-# Local modifications (marked '#ikp') to support:
-# C text in '{ ... }' copied verbatim to output as 'semantic action'
-# input consumed between '<' and '>' is 'char yytext[]' in semantic actions
-#
-# Best viewed using 140 columns monospaced with tabs every 8.
-#
-# [1] Bryan Ford. "Parsing Expression Grammars: A Recognition-Based Syntactic
-# Foundation." Symposium on Principles of Programming Languages,
-# January 14--16, 2004, Venice, Italy.
-#
-# Last edited: 2016-07-15 10:27:27 by piumarta on zora
-
-# Hierarchical syntax
-
-Grammar <- Spacing Definition+ EndOfFile
-
-Definition <- Identifier { if (push(beginRule(findRule(yytext)))->rule.expression) fprintf(stderr, "rule '%s' redefined\n", yytext); }
- LEFTARROW Expression { Node *e= pop(); Rule_setExpression(pop(), e); } &{ YYACCEPT }
-Expression <- Sequence (SLASH Sequence { Node *f= pop(); push(Alternate_append(pop(), f)); }
- )*
-Sequence <- Prefix (Prefix { Node *f= pop(); push(Sequence_append(pop(), f)); } #ikp expanded from 'Seq <- Prefix*'
- )*
- / { push(makePredicate("1")); } #ikp added
-Prefix <- AND Action { push(makePredicate(yytext)); } #ikp added
- / AND Suffix { push(makePeekFor(pop())); } #ikp expanded from 'Prefix <- (AND/NOT)? Suffix'
- / NOT Suffix { push(makePeekNot(pop())); }
- / Suffix
-Suffix <- Primary (QUESTION { push(makeQuery(pop())); }
- / STAR { push(makeStar (pop())); }
- / PLUS { push(makePlus (pop())); }
- )?
-Primary <- Identifier !LEFTARROW { push(makeName(findRule(yytext))); }
- / OPEN Expression CLOSE
- / Literal { push(makeString(yytext)); }
- / Class { push(makeClass(yytext)); }
- / DOT { push(makeDot()); }
- / Action { push(makeAction(0, yytext)); } #ikp added
- / BEGIN { push(makePredicate("YY_BEGIN")); } #ikp added
- / END { push(makePredicate("YY_END")); } #ikp added
-
-# Lexical syntax
-
-Identifier <- < IdentStart IdentCont* > Spacing #ikp inserted < ... >
-IdentStart <- [a-zA-Z_]
-IdentCont <- IdentStart / [0-9]
-Literal <- ['] < (!['] Char )* > ['] Spacing #ikp inserted < ... >
- / ["] < (!["] Char )* > ["] Spacing #ikp inserted < ... >
-Class <- '[' < (!']' Range)* > ']' Spacing #ikp inserted < ... >
-Range <- Char '-' Char / Char
-Char <- '\\' [abefnrtv'"\[\]\\] #ikp added missing ANSI escapes: abefv
- / '\\' [0-3][0-7][0-7]
- / '\\' [0-7][0-7]?
- / '\\' '-' #ikp added
- / !'\\' .
-LEFTARROW <- '<-' Spacing
-SLASH <- '/' Spacing
-AND <- '&' Spacing
-NOT <- '!' Spacing
-QUESTION <- '?' Spacing
-STAR <- '*' Spacing
-PLUS <- '+' Spacing
-OPEN <- '(' Spacing
-CLOSE <- ')' Spacing
-DOT <- '.' Spacing
-Spacing <- (Space / Comment)*
-Comment <- '#' (!EndOfLine .)* EndOfLine
-Space <- ' ' / '\t' / EndOfLine
-EndOfLine <- '\r\n' / '\n' / '\r'
-EndOfFile <- !.
-
-Action <- '{' < [^}]* > '}' Spacing #ikp added
-BEGIN <- '<' Spacing #ikp added
-END <- '>' Spacing #ikp added
--- a/src/peg.peg-c
+++ /dev/null
@@ -1,1086 +1,0 @@
-/* A recursive-descent parser generated by peg 0.1.18 */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define YYRULECOUNT 32
-#ifndef YY_MALLOC
-#define YY_MALLOC(C, N) malloc(N)
-#endif
-#ifndef YY_REALLOC
-#define YY_REALLOC(C, P, N) realloc(P, N)
-#endif
-#ifndef YY_FREE
-#define YY_FREE(C, P) free(P)
-#endif
-#ifndef YY_LOCAL
-#define YY_LOCAL(T) static T
-#endif
-#ifndef YY_ACTION
-#define YY_ACTION(T) static T
-#endif
-#ifndef YY_RULE
-#define YY_RULE(T) static T
-#endif
-#ifndef YY_PARSE
-#define YY_PARSE(T) T
-#endif
-#ifndef YYPARSE
-#define YYPARSE yyparse
-#endif
-#ifndef YYPARSEFROM
-#define YYPARSEFROM yyparsefrom
-#endif
-#ifndef YYRELEASE
-#define YYRELEASE yyrelease
-#endif
-#ifndef YY_BEGIN
-#define YY_BEGIN ( yy->__begin= yy->__pos, 1)
-#endif
-#ifndef YY_END
-#define YY_END ( yy->__end= yy->__pos, 1)
-#endif
-#ifdef YY_DEBUG
-# define yyprintf(args) fprintf args
-#else
-# define yyprintf(args)
-#endif
-#ifndef YYSTYPE
-#define YYSTYPE int
-#endif
-#ifndef YY_STACK_SIZE
-#define YY_STACK_SIZE 128
-#endif
-
-#ifndef YY_BUFFER_SIZE
-#define YY_BUFFER_SIZE 1024
-#endif
-
-#ifndef YY_PART
-
-typedef struct _yycontext yycontext;
-typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng);
-typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;
-
-struct _yycontext {
- char *__buf;
- int __buflen;
- int __pos;
- int __limit;
- char *__text;
- int __textlen;
- int __begin;
- int __end;
- int __textmax;
- yythunk *__thunks;
- int __thunkslen;
- int __thunkpos;
- YYSTYPE __;
- YYSTYPE *__val;
- YYSTYPE *__vals;
- int __valslen;
-#ifdef YY_CTX_MEMBERS
- YY_CTX_MEMBERS
-#endif
-};
-
-#ifdef YY_CTX_LOCAL
-#define YY_CTX_PARAM_ yycontext *yyctx,
-#define YY_CTX_PARAM yycontext *yyctx
-#define YY_CTX_ARG_ yyctx,
-#define YY_CTX_ARG yyctx
-#ifndef YY_INPUT
-#define YY_INPUT(yy, buf, result, max_size) \
- { \
- int yyc= getchar(); \
- result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \
- yyprintf((stderr, "<%c>", yyc)); \
- }
-#endif
-#else
-#define YY_CTX_PARAM_
-#define YY_CTX_PARAM
-#define YY_CTX_ARG_
-#define YY_CTX_ARG
-yycontext _yyctx= { 0, 0 };
-yycontext *yyctx= &_yyctx;
-#ifndef YY_INPUT
-#define YY_INPUT(buf, result, max_size) \
- { \
- int yyc= getchar(); \
- result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \
- yyprintf((stderr, "<%c>", yyc)); \
- }
-#endif
-#endif
-
-YY_LOCAL(int) yyrefill(yycontext *yy)
-{
- int yyn;
- while (yy->__buflen - yy->__pos < 512)
- {
- yy->__buflen *= 2;
- yy->__buf= (char *)YY_REALLOC(yy, yy->__buf, yy->__buflen);
- }
-#ifdef YY_CTX_LOCAL
- YY_INPUT(yy, (yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos));
-#else
- YY_INPUT((yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos));
-#endif
- if (!yyn) return 0;
- yy->__limit += yyn;
- return 1;
-}
-
-YY_LOCAL(int) yymatchDot(yycontext *yy)
-{
- if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
- ++yy->__pos;
- return 1;
-}
-
-YY_LOCAL(int) yymatchChar(yycontext *yy, int c)
-{
- if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
- if ((unsigned char)yy->__buf[yy->__pos] == c)
- {
- ++yy->__pos;
- yyprintf((stderr, " ok yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos));
- return 1;
- }
- yyprintf((stderr, " fail yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos));
- return 0;
-}
-
-YY_LOCAL(int) yymatchString(yycontext *yy, const char *s)
-{
- int yysav= yy->__pos;
- while (*s)
- {
- if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
- if (yy->__buf[yy->__pos] != *s)
- {
- yy->__pos= yysav;
- return 0;
- }
- ++s;
- ++yy->__pos;
- }
- return 1;
-}
-
-YY_LOCAL(int) yymatchClass(yycontext *yy, unsigned char *bits)
-{
- int c;
- if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
- c= (unsigned char)yy->__buf[yy->__pos];
- if (bits[c >> 3] & (1 << (c & 7)))
- {
- ++yy->__pos;
- yyprintf((stderr, " ok yymatchClass @ %s\n", yy->__buf+yy->__pos));
- return 1;
- }
- yyprintf((stderr, " fail yymatchClass @ %s\n", yy->__buf+yy->__pos));
- return 0;
-}
-
-YY_LOCAL(void) yyDo(yycontext *yy, yyaction action, int begin, int end)
-{
- while (yy->__thunkpos >= yy->__thunkslen)
- {
- yy->__thunkslen *= 2;
- yy->__thunks= (yythunk *)YY_REALLOC(yy, yy->__thunks, sizeof(yythunk) * yy->__thunkslen);
- }
- yy->__thunks[yy->__thunkpos].begin= begin;
- yy->__thunks[yy->__thunkpos].end= end;
- yy->__thunks[yy->__thunkpos].action= action;
- ++yy->__thunkpos;
-}
-
-YY_LOCAL(int) yyText(yycontext *yy, int begin, int end)
-{
- int yyleng= end - begin;
- if (yyleng <= 0)
- yyleng= 0;
- else
- {
- while (yy->__textlen < (yyleng + 1))
- {
- yy->__textlen *= 2;
- yy->__text= (char *)YY_REALLOC(yy, yy->__text, yy->__textlen);
- }
- memcpy(yy->__text, yy->__buf + begin, yyleng);
- }
- yy->__text[yyleng]= '\0';
- return yyleng;
-}
-
-YY_LOCAL(void) yyDone(yycontext *yy)
-{
- int pos;
- for (pos= 0; pos < yy->__thunkpos; ++pos)
- {
- yythunk *thunk= &yy->__thunks[pos];
- int yyleng= thunk->end ? yyText(yy, thunk->begin, thunk->end) : thunk->begin;
- yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yy->__text));
- thunk->action(yy, yy->__text, yyleng);
- }
- yy->__thunkpos= 0;
-}
-
-YY_LOCAL(void) yyCommit(yycontext *yy)
-{
- if ((yy->__limit -= yy->__pos))
- {
- memmove(yy->__buf, yy->__buf + yy->__pos, yy->__limit);
- }
- yy->__begin -= yy->__pos;
- yy->__end -= yy->__pos;
- yy->__pos= yy->__thunkpos= 0;
-}
-
-YY_LOCAL(int) yyAccept(yycontext *yy, int tp0)
-{
- if (tp0)
- {
- fprintf(stderr, "accept denied at %d\n", tp0);
- return 0;
- }
- else
- {
- yyDone(yy);
- yyCommit(yy);
- }
- return 1;
-}
-
-YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count)
-{
- yy->__val += count;
- while (yy->__valslen <= yy->__val - yy->__vals)
- {
- long offset= yy->__val - yy->__vals;
- yy->__valslen *= 2;
- yy->__vals= (YYSTYPE *)YY_REALLOC(yy, yy->__vals, sizeof(YYSTYPE) * yy->__valslen);
- yy->__val= yy->__vals + offset;
- }
-}
-YY_LOCAL(void) yyPop(yycontext *yy, char *text, int count) { yy->__val -= count; }
-YY_LOCAL(void) yySet(yycontext *yy, char *text, int count) { yy->__val[count]= yy->__; }
-
-#endif /* YY_PART */
-
-#define YYACCEPT yyAccept(yy, yythunkpos0)
-
-YY_RULE(int) yy_EndOfLine(yycontext *yy); /* 32 */
-YY_RULE(int) yy_Comment(yycontext *yy); /* 31 */
-YY_RULE(int) yy_Space(yycontext *yy); /* 30 */
-YY_RULE(int) yy_Range(yycontext *yy); /* 29 */
-YY_RULE(int) yy_Char(yycontext *yy); /* 28 */
-YY_RULE(int) yy_IdentCont(yycontext *yy); /* 27 */
-YY_RULE(int) yy_IdentStart(yycontext *yy); /* 26 */
-YY_RULE(int) yy_END(yycontext *yy); /* 25 */
-YY_RULE(int) yy_BEGIN(yycontext *yy); /* 24 */
-YY_RULE(int) yy_DOT(yycontext *yy); /* 23 */
-YY_RULE(int) yy_Class(yycontext *yy); /* 22 */
-YY_RULE(int) yy_Literal(yycontext *yy); /* 21 */
-YY_RULE(int) yy_CLOSE(yycontext *yy); /* 20 */
-YY_RULE(int) yy_OPEN(yycontext *yy); /* 19 */
-YY_RULE(int) yy_PLUS(yycontext *yy); /* 18 */
-YY_RULE(int) yy_STAR(yycontext *yy); /* 17 */
-YY_RULE(int) yy_QUESTION(yycontext *yy); /* 16 */
-YY_RULE(int) yy_Primary(yycontext *yy); /* 15 */
-YY_RULE(int) yy_NOT(yycontext *yy); /* 14 */
-YY_RULE(int) yy_Suffix(yycontext *yy); /* 13 */
-YY_RULE(int) yy_Action(yycontext *yy); /* 12 */
-YY_RULE(int) yy_AND(yycontext *yy); /* 11 */
-YY_RULE(int) yy_Prefix(yycontext *yy); /* 10 */
-YY_RULE(int) yy_SLASH(yycontext *yy); /* 9 */
-YY_RULE(int) yy_Sequence(yycontext *yy); /* 8 */
-YY_RULE(int) yy_Expression(yycontext *yy); /* 7 */
-YY_RULE(int) yy_LEFTARROW(yycontext *yy); /* 6 */
-YY_RULE(int) yy_Identifier(yycontext *yy); /* 5 */
-YY_RULE(int) yy_EndOfFile(yycontext *yy); /* 4 */
-YY_RULE(int) yy_Definition(yycontext *yy); /* 3 */
-YY_RULE(int) yy_Spacing(yycontext *yy); /* 2 */
-YY_RULE(int) yy_Grammar(yycontext *yy); /* 1 */
-
-YY_ACTION(void) yy_7_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_7_Primary\n"));
- {
-#line 0
- push(makePredicate("YY_END")); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_6_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_6_Primary\n"));
- {
-#line 0
- push(makePredicate("YY_BEGIN")); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_5_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_5_Primary\n"));
- {
-#line 0
- push(makeAction(0, yytext)); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_4_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_4_Primary\n"));
- {
-#line 0
- push(makeDot()); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_3_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_3_Primary\n"));
- {
-#line 0
- push(makeClass(yytext)); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_2_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_2_Primary\n"));
- {
-#line 0
- push(makeString(yytext)); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_1_Primary(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_1_Primary\n"));
- {
-#line 0
- push(makeName(findRule(yytext))); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_3_Suffix(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_3_Suffix\n"));
- {
-#line 0
- push(makePlus (pop())); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_2_Suffix(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_2_Suffix\n"));
- {
-#line 0
- push(makeStar (pop())); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_1_Suffix(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_1_Suffix\n"));
- {
-#line 0
- push(makeQuery(pop())); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_3_Prefix(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_3_Prefix\n"));
- {
-#line 0
- push(makePeekNot(pop())); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_2_Prefix(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_2_Prefix\n"));
- {
-#line 0
- push(makePeekFor(pop())); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_1_Prefix(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_1_Prefix\n"));
- {
-#line 0
- push(makePredicate(yytext)); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_2_Sequence(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_2_Sequence\n"));
- {
-#line 0
- push(makePredicate("1")); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_1_Sequence(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_1_Sequence\n"));
- {
-#line 0
- Node *f= pop(); push(Sequence_append(pop(), f)); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_1_Expression(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_1_Expression\n"));
- {
-#line 0
- Node *f= pop(); push(Alternate_append(pop(), f)); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_2_Definition(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_2_Definition\n"));
- {
-#line 0
- Node *e= pop(); Rule_setExpression(pop(), e); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-YY_ACTION(void) yy_1_Definition(yycontext *yy, char *yytext, int yyleng)
-{
-#define __ yy->__
-#define yypos yy->__pos
-#define yythunkpos yy->__thunkpos
- yyprintf((stderr, "do yy_1_Definition\n"));
- {
-#line 0
- if (push(beginRule(findRule(yytext)))->rule.expression) fprintf(stderr, "rule '%s' redefined\n", yytext); ;
- }
-#undef yythunkpos
-#undef yypos
-#undef yy
-}
-
-YY_RULE(int) yy_EndOfLine(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "EndOfLine"));
- { int yypos2= yy->__pos, yythunkpos2= yy->__thunkpos; if (!yymatchString(yy, "\r\n")) goto l3; goto l2;
- l3:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchChar(yy, '\n')) goto l4; goto l2;
- l4:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchChar(yy, '\r')) goto l1;
- }
- l2:;
- yyprintf((stderr, " ok %s @ %s\n", "EndOfLine", yy->__buf+yy->__pos));
- return 1;
- l1:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "EndOfLine", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Comment(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Comment")); if (!yymatchChar(yy, '#')) goto l5;
- l6:;
- { int yypos7= yy->__pos, yythunkpos7= yy->__thunkpos;
- { int yypos8= yy->__pos, yythunkpos8= yy->__thunkpos; if (!yy_EndOfLine(yy)) goto l8; goto l7;
- l8:; yy->__pos= yypos8; yy->__thunkpos= yythunkpos8;
- } if (!yymatchDot(yy)) goto l7; goto l6;
- l7:; yy->__pos= yypos7; yy->__thunkpos= yythunkpos7;
- } if (!yy_EndOfLine(yy)) goto l5;
- yyprintf((stderr, " ok %s @ %s\n", "Comment", yy->__buf+yy->__pos));
- return 1;
- l5:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Comment", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Space(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Space"));
- { int yypos10= yy->__pos, yythunkpos10= yy->__thunkpos; if (!yymatchChar(yy, ' ')) goto l11; goto l10;
- l11:; yy->__pos= yypos10; yy->__thunkpos= yythunkpos10; if (!yymatchChar(yy, '\t')) goto l12; goto l10;
- l12:; yy->__pos= yypos10; yy->__thunkpos= yythunkpos10; if (!yy_EndOfLine(yy)) goto l9;
- }
- l10:;
- yyprintf((stderr, " ok %s @ %s\n", "Space", yy->__buf+yy->__pos));
- return 1;
- l9:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Space", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Range(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Range"));
- { int yypos14= yy->__pos, yythunkpos14= yy->__thunkpos; if (!yy_Char(yy)) goto l15; if (!yymatchChar(yy, '-')) goto l15; if (!yy_Char(yy)) goto l15; goto l14;
- l15:; yy->__pos= yypos14; yy->__thunkpos= yythunkpos14; if (!yy_Char(yy)) goto l13;
- }
- l14:;
- yyprintf((stderr, " ok %s @ %s\n", "Range", yy->__buf+yy->__pos));
- return 1;
- l13:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Range", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Char(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Char"));
- { int yypos17= yy->__pos, yythunkpos17= yy->__thunkpos; if (!yymatchChar(yy, '\\')) goto l18; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\204\000\000\000\000\000\000\070\146\100\124\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l18; goto l17;
- l18:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17; if (!yymatchChar(yy, '\\')) goto l19; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l19; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l19; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l19; goto l17;
- l19:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17; if (!yymatchChar(yy, '\\')) goto l20; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l20;
- { int yypos21= yy->__pos, yythunkpos21= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l21; goto l22;
- l21:; yy->__pos= yypos21; yy->__thunkpos= yythunkpos21;
- }
- l22:; goto l17;
- l20:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17; if (!yymatchChar(yy, '\\')) goto l23; if (!yymatchChar(yy, '-')) goto l23; goto l17;
- l23:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17;
- { int yypos24= yy->__pos, yythunkpos24= yy->__thunkpos; if (!yymatchChar(yy, '\\')) goto l24; goto l16;
- l24:; yy->__pos= yypos24; yy->__thunkpos= yythunkpos24;
- } if (!yymatchDot(yy)) goto l16;
- }
- l17:;
- yyprintf((stderr, " ok %s @ %s\n", "Char", yy->__buf+yy->__pos));
- return 1;
- l16:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Char", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_IdentCont(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "IdentCont"));
- { int yypos26= yy->__pos, yythunkpos26= yy->__thunkpos; if (!yy_IdentStart(yy)) goto l27; goto l26;
- l27:; yy->__pos= yypos26; yy->__thunkpos= yythunkpos26; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25;
- }
- l26:;
- yyprintf((stderr, " ok %s @ %s\n", "IdentCont", yy->__buf+yy->__pos));
- return 1;
- l25:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "IdentCont", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_IdentStart(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "IdentStart")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l28;
- yyprintf((stderr, " ok %s @ %s\n", "IdentStart", yy->__buf+yy->__pos));
- return 1;
- l28:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "IdentStart", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_END(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "END")); if (!yymatchChar(yy, '>')) goto l29; if (!yy_Spacing(yy)) goto l29;
- yyprintf((stderr, " ok %s @ %s\n", "END", yy->__buf+yy->__pos));
- return 1;
- l29:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "END", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_BEGIN(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "BEGIN")); if (!yymatchChar(yy, '<')) goto l30; if (!yy_Spacing(yy)) goto l30;
- yyprintf((stderr, " ok %s @ %s\n", "BEGIN", yy->__buf+yy->__pos));
- return 1;
- l30:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "BEGIN", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_DOT(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "DOT")); if (!yymatchChar(yy, '.')) goto l31; if (!yy_Spacing(yy)) goto l31;
- yyprintf((stderr, " ok %s @ %s\n", "DOT", yy->__buf+yy->__pos));
- return 1;
- l31:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "DOT", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Class(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Class")); if (!yymatchChar(yy, '[')) goto l32; yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_BEGIN)) goto l32;
-#undef yytext
-#undef yyleng
- }
- l33:;
- { int yypos34= yy->__pos, yythunkpos34= yy->__thunkpos;
- { int yypos35= yy->__pos, yythunkpos35= yy->__thunkpos; if (!yymatchChar(yy, ']')) goto l35; goto l34;
- l35:; yy->__pos= yypos35; yy->__thunkpos= yythunkpos35;
- } if (!yy_Range(yy)) goto l34; goto l33;
- l34:; yy->__pos= yypos34; yy->__thunkpos= yythunkpos34;
- } yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_END)) goto l32;
-#undef yytext
-#undef yyleng
- } if (!yymatchChar(yy, ']')) goto l32; if (!yy_Spacing(yy)) goto l32;
- yyprintf((stderr, " ok %s @ %s\n", "Class", yy->__buf+yy->__pos));
- return 1;
- l32:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Class", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Literal(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Literal"));
- { int yypos37= yy->__pos, yythunkpos37= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l38; yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_BEGIN)) goto l38;
-#undef yytext
-#undef yyleng
- }
- l39:;
- { int yypos40= yy->__pos, yythunkpos40= yy->__thunkpos;
- { int yypos41= yy->__pos, yythunkpos41= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l41; goto l40;
- l41:; yy->__pos= yypos41; yy->__thunkpos= yythunkpos41;
- } if (!yy_Char(yy)) goto l40; goto l39;
- l40:; yy->__pos= yypos40; yy->__thunkpos= yythunkpos40;
- } yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_END)) goto l38;
-#undef yytext
-#undef yyleng
- } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l38; if (!yy_Spacing(yy)) goto l38; goto l37;
- l38:; yy->__pos= yypos37; yy->__thunkpos= yythunkpos37; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l36; yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_BEGIN)) goto l36;
-#undef yytext
-#undef yyleng
- }
- l42:;
- { int yypos43= yy->__pos, yythunkpos43= yy->__thunkpos;
- { int yypos44= yy->__pos, yythunkpos44= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l44; goto l43;
- l44:; yy->__pos= yypos44; yy->__thunkpos= yythunkpos44;
- } if (!yy_Char(yy)) goto l43; goto l42;
- l43:; yy->__pos= yypos43; yy->__thunkpos= yythunkpos43;
- } yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_END)) goto l36;
-#undef yytext
-#undef yyleng
- } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l36; if (!yy_Spacing(yy)) goto l36;
- }
- l37:;
- yyprintf((stderr, " ok %s @ %s\n", "Literal", yy->__buf+yy->__pos));
- return 1;
- l36:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Literal", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_CLOSE(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(yy, ')')) goto l45; if (!yy_Spacing(yy)) goto l45;
- yyprintf((stderr, " ok %s @ %s\n", "CLOSE", yy->__buf+yy->__pos));
- return 1;
- l45:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "CLOSE", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_OPEN(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar(yy, '(')) goto l46; if (!yy_Spacing(yy)) goto l46;
- yyprintf((stderr, " ok %s @ %s\n", "OPEN", yy->__buf+yy->__pos));
- return 1;
- l46:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "OPEN", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_PLUS(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar(yy, '+')) goto l47; if (!yy_Spacing(yy)) goto l47;
- yyprintf((stderr, " ok %s @ %s\n", "PLUS", yy->__buf+yy->__pos));
- return 1;
- l47:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "PLUS", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_STAR(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "STAR")); if (!yymatchChar(yy, '*')) goto l48; if (!yy_Spacing(yy)) goto l48;
- yyprintf((stderr, " ok %s @ %s\n", "STAR", yy->__buf+yy->__pos));
- return 1;
- l48:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "STAR", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_QUESTION(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "QUESTION")); if (!yymatchChar(yy, '?')) goto l49; if (!yy_Spacing(yy)) goto l49;
- yyprintf((stderr, " ok %s @ %s\n", "QUESTION", yy->__buf+yy->__pos));
- return 1;
- l49:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "QUESTION", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Primary(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Primary"));
- { int yypos51= yy->__pos, yythunkpos51= yy->__thunkpos; if (!yy_Identifier(yy)) goto l52;
- { int yypos53= yy->__pos, yythunkpos53= yy->__thunkpos; if (!yy_LEFTARROW(yy)) goto l53; goto l52;
- l53:; yy->__pos= yypos53; yy->__thunkpos= yythunkpos53;
- } yyDo(yy, yy_1_Primary, yy->__begin, yy->__end); goto l51;
- l52:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_OPEN(yy)) goto l54; if (!yy_Expression(yy)) goto l54; if (!yy_CLOSE(yy)) goto l54; goto l51;
- l54:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_Literal(yy)) goto l55; yyDo(yy, yy_2_Primary, yy->__begin, yy->__end); goto l51;
- l55:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_Class(yy)) goto l56; yyDo(yy, yy_3_Primary, yy->__begin, yy->__end); goto l51;
- l56:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_DOT(yy)) goto l57; yyDo(yy, yy_4_Primary, yy->__begin, yy->__end); goto l51;
- l57:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_Action(yy)) goto l58; yyDo(yy, yy_5_Primary, yy->__begin, yy->__end); goto l51;
- l58:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_BEGIN(yy)) goto l59; yyDo(yy, yy_6_Primary, yy->__begin, yy->__end); goto l51;
- l59:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yy_END(yy)) goto l50; yyDo(yy, yy_7_Primary, yy->__begin, yy->__end);
- }
- l51:;
- yyprintf((stderr, " ok %s @ %s\n", "Primary", yy->__buf+yy->__pos));
- return 1;
- l50:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Primary", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_NOT(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "NOT")); if (!yymatchChar(yy, '!')) goto l60; if (!yy_Spacing(yy)) goto l60;
- yyprintf((stderr, " ok %s @ %s\n", "NOT", yy->__buf+yy->__pos));
- return 1;
- l60:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "NOT", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Suffix(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Suffix")); if (!yy_Primary(yy)) goto l61;
- { int yypos62= yy->__pos, yythunkpos62= yy->__thunkpos;
- { int yypos64= yy->__pos, yythunkpos64= yy->__thunkpos; if (!yy_QUESTION(yy)) goto l65; yyDo(yy, yy_1_Suffix, yy->__begin, yy->__end); goto l64;
- l65:; yy->__pos= yypos64; yy->__thunkpos= yythunkpos64; if (!yy_STAR(yy)) goto l66; yyDo(yy, yy_2_Suffix, yy->__begin, yy->__end); goto l64;
- l66:; yy->__pos= yypos64; yy->__thunkpos= yythunkpos64; if (!yy_PLUS(yy)) goto l62; yyDo(yy, yy_3_Suffix, yy->__begin, yy->__end);
- }
- l64:; goto l63;
- l62:; yy->__pos= yypos62; yy->__thunkpos= yythunkpos62;
- }
- l63:;
- yyprintf((stderr, " ok %s @ %s\n", "Suffix", yy->__buf+yy->__pos));
- return 1;
- l61:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Suffix", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Action(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Action")); if (!yymatchChar(yy, '{')) goto l67; yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_BEGIN)) goto l67;
-#undef yytext
-#undef yyleng
- }
- l68:;
- { int yypos69= yy->__pos, yythunkpos69= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\337\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l69; goto l68;
- l69:; yy->__pos= yypos69; yy->__thunkpos= yythunkpos69;
- } yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_END)) goto l67;
-#undef yytext
-#undef yyleng
- } if (!yymatchChar(yy, '}')) goto l67; if (!yy_Spacing(yy)) goto l67;
- yyprintf((stderr, " ok %s @ %s\n", "Action", yy->__buf+yy->__pos));
- return 1;
- l67:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Action", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_AND(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "AND")); if (!yymatchChar(yy, '&')) goto l70; if (!yy_Spacing(yy)) goto l70;
- yyprintf((stderr, " ok %s @ %s\n", "AND", yy->__buf+yy->__pos));
- return 1;
- l70:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "AND", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Prefix(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Prefix"));
- { int yypos72= yy->__pos, yythunkpos72= yy->__thunkpos; if (!yy_AND(yy)) goto l73; if (!yy_Action(yy)) goto l73; yyDo(yy, yy_1_Prefix, yy->__begin, yy->__end); goto l72;
- l73:; yy->__pos= yypos72; yy->__thunkpos= yythunkpos72; if (!yy_AND(yy)) goto l74; if (!yy_Suffix(yy)) goto l74; yyDo(yy, yy_2_Prefix, yy->__begin, yy->__end); goto l72;
- l74:; yy->__pos= yypos72; yy->__thunkpos= yythunkpos72; if (!yy_NOT(yy)) goto l75; if (!yy_Suffix(yy)) goto l75; yyDo(yy, yy_3_Prefix, yy->__begin, yy->__end); goto l72;
- l75:; yy->__pos= yypos72; yy->__thunkpos= yythunkpos72; if (!yy_Suffix(yy)) goto l71;
- }
- l72:;
- yyprintf((stderr, " ok %s @ %s\n", "Prefix", yy->__buf+yy->__pos));
- return 1;
- l71:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Prefix", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_SLASH(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "SLASH")); if (!yymatchChar(yy, '/')) goto l76; if (!yy_Spacing(yy)) goto l76;
- yyprintf((stderr, " ok %s @ %s\n", "SLASH", yy->__buf+yy->__pos));
- return 1;
- l76:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "SLASH", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Sequence(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Sequence"));
- { int yypos78= yy->__pos, yythunkpos78= yy->__thunkpos; if (!yy_Prefix(yy)) goto l79;
- l80:;
- { int yypos81= yy->__pos, yythunkpos81= yy->__thunkpos; if (!yy_Prefix(yy)) goto l81; yyDo(yy, yy_1_Sequence, yy->__begin, yy->__end); goto l80;
- l81:; yy->__pos= yypos81; yy->__thunkpos= yythunkpos81;
- } goto l78;
- l79:; yy->__pos= yypos78; yy->__thunkpos= yythunkpos78; yyDo(yy, yy_2_Sequence, yy->__begin, yy->__end);
- }
- l78:;
- yyprintf((stderr, " ok %s @ %s\n", "Sequence", yy->__buf+yy->__pos));
- return 1;
- l77:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Sequence", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Expression(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Expression")); if (!yy_Sequence(yy)) goto l82;
- l83:;
- { int yypos84= yy->__pos, yythunkpos84= yy->__thunkpos; if (!yy_SLASH(yy)) goto l84; if (!yy_Sequence(yy)) goto l84; yyDo(yy, yy_1_Expression, yy->__begin, yy->__end); goto l83;
- l84:; yy->__pos= yypos84; yy->__thunkpos= yythunkpos84;
- }
- yyprintf((stderr, " ok %s @ %s\n", "Expression", yy->__buf+yy->__pos));
- return 1;
- l82:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Expression", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_LEFTARROW(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "LEFTARROW")); if (!yymatchString(yy, "<-")) goto l85; if (!yy_Spacing(yy)) goto l85;
- yyprintf((stderr, " ok %s @ %s\n", "LEFTARROW", yy->__buf+yy->__pos));
- return 1;
- l85:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "LEFTARROW", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Identifier(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Identifier")); yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_BEGIN)) goto l86;
-#undef yytext
-#undef yyleng
- } if (!yy_IdentStart(yy)) goto l86;
- l87:;
- { int yypos88= yy->__pos, yythunkpos88= yy->__thunkpos; if (!yy_IdentCont(yy)) goto l88; goto l87;
- l88:; yy->__pos= yypos88; yy->__thunkpos= yythunkpos88;
- } yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!(YY_END)) goto l86;
-#undef yytext
-#undef yyleng
- } if (!yy_Spacing(yy)) goto l86;
- yyprintf((stderr, " ok %s @ %s\n", "Identifier", yy->__buf+yy->__pos));
- return 1;
- l86:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Identifier", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_EndOfFile(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "EndOfFile"));
- { int yypos90= yy->__pos, yythunkpos90= yy->__thunkpos; if (!yymatchDot(yy)) goto l90; goto l89;
- l90:; yy->__pos= yypos90; yy->__thunkpos= yythunkpos90;
- }
- yyprintf((stderr, " ok %s @ %s\n", "EndOfFile", yy->__buf+yy->__pos));
- return 1;
- l89:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "EndOfFile", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Definition(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Definition")); if (!yy_Identifier(yy)) goto l91; yyDo(yy, yy_1_Definition, yy->__begin, yy->__end); if (!yy_LEFTARROW(yy)) goto l91; if (!yy_Expression(yy)) goto l91; yyDo(yy, yy_2_Definition, yy->__begin, yy->__end); yyText(yy, yy->__begin, yy->__end); {
-#define yytext yy->__text
-#define yyleng yy->__textlen
-if (!( YYACCEPT )) goto l91;
-#undef yytext
-#undef yyleng
- }
- yyprintf((stderr, " ok %s @ %s\n", "Definition", yy->__buf+yy->__pos));
- return 1;
- l91:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Definition", yy->__buf+yy->__pos));
- return 0;
-}
-YY_RULE(int) yy_Spacing(yycontext *yy)
-{
- yyprintf((stderr, "%s\n", "Spacing"));
- l93:;
- { int yypos94= yy->__pos, yythunkpos94= yy->__thunkpos;
- { int yypos95= yy->__pos, yythunkpos95= yy->__thunkpos; if (!yy_Space(yy)) goto l96; goto l95;
- l96:; yy->__pos= yypos95; yy->__thunkpos= yythunkpos95; if (!yy_Comment(yy)) goto l94;
- }
- l95:; goto l93;
- l94:; yy->__pos= yypos94; yy->__thunkpos= yythunkpos94;
- }
- yyprintf((stderr, " ok %s @ %s\n", "Spacing", yy->__buf+yy->__pos));
- return 1;
-}
-YY_RULE(int) yy_Grammar(yycontext *yy)
-{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
- yyprintf((stderr, "%s\n", "Grammar")); if (!yy_Spacing(yy)) goto l97; if (!yy_Definition(yy)) goto l97;
- l98:;
- { int yypos99= yy->__pos, yythunkpos99= yy->__thunkpos; if (!yy_Definition(yy)) goto l99; goto l98;
- l99:; yy->__pos= yypos99; yy->__thunkpos= yythunkpos99;
- } if (!yy_EndOfFile(yy)) goto l97;
- yyprintf((stderr, " ok %s @ %s\n", "Grammar", yy->__buf+yy->__pos));
- return 1;
- l97:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Grammar", yy->__buf+yy->__pos));
- return 0;
-}
-
-#ifndef YY_PART
-
-typedef int (*yyrule)(yycontext *yy);
-
-YY_PARSE(int) YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart)
-{
- int yyok;
- if (!yyctx->__buflen)
- {
- yyctx->__buflen= YY_BUFFER_SIZE;
- yyctx->__buf= (char *)YY_MALLOC(yyctx, yyctx->__buflen);
- yyctx->__textlen= YY_BUFFER_SIZE;
- yyctx->__text= (char *)YY_MALLOC(yyctx, yyctx->__textlen);
- yyctx->__thunkslen= YY_STACK_SIZE;
- yyctx->__thunks= (yythunk *)YY_MALLOC(yyctx, sizeof(yythunk) * yyctx->__thunkslen);
- yyctx->__valslen= YY_STACK_SIZE;
- yyctx->__vals= (YYSTYPE *)YY_MALLOC(yyctx, sizeof(YYSTYPE) * yyctx->__valslen);
- yyctx->__begin= yyctx->__end= yyctx->__pos= yyctx->__limit= yyctx->__thunkpos= 0;
- }
- yyctx->__begin= yyctx->__end= yyctx->__pos;
- yyctx->__thunkpos= 0;
- yyctx->__val= yyctx->__vals;
- yyok= yystart(yyctx);
- if (yyok) yyDone(yyctx);
- yyCommit(yyctx);
- return yyok;
-}
-
-YY_PARSE(int) YYPARSE(YY_CTX_PARAM)
-{
- return YYPARSEFROM(YY_CTX_ARG_ yy_Grammar);
-}
-
-YY_PARSE(yycontext *) YYRELEASE(yycontext *yyctx)
-{
- if (yyctx->__buflen)
- {
- yyctx->__buflen= 0;
- YY_FREE(yyctx, yyctx->__buf);
- YY_FREE(yyctx, yyctx->__text);
- YY_FREE(yyctx, yyctx->__thunks);
- YY_FREE(yyctx, yyctx->__vals);
- }
- return yyctx;
-}
-
-#endif
--- a/win/getopt.c
+++ /dev/null
@@ -1,562 +1,0 @@
-/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */
-/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
-
-/*
- * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Sponsored in part by the Defense Advanced Research Projects
- * Agency (DARPA) and Air Force Research Laboratory, Air Force
- * Materiel Command, USAF, under agreement number F39502-99-1-0512.
- */
-/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <windows.h>
-
-#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
-
-#ifdef REPLACE_GETOPT
-int opterr = 1; /* if error message should be printed */
-int optind = 1; /* index into parent argv vector */
-int optopt = '?'; /* character checked for validity */
-#undef optreset /* see getopt.h */
-#define optreset __mingw_optreset
-int optreset; /* reset getopt */
-char *optarg; /* argument associated with option */
-#endif
-
-#define PRINT_ERROR ((opterr) && (*options != ':'))
-
-#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */
-#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */
-#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
-
-/* return values */
-#define BADCH (int)'?'
-#define BADARG ((*options == ':') ? (int)':' : (int)'?')
-#define INORDER (int)1
-
-#ifndef __CYGWIN__
-#define __progname __argv[0]
-#else
-extern char __declspec(dllimport) *__progname;
-#endif
-
-#ifdef __CYGWIN__
-static char EMSG[] = "";
-#else
-#define EMSG ""
-#endif
-
-static int getopt_internal(int, char * const *, const char *,
- const struct option *, int *, int);
-static int parse_long_options(char * const *, const char *,
- const struct option *, int *, int);
-static int gcd(int, int);
-static void permute_args(int, int, int, char * const *);
-
-static char *place = EMSG; /* option letter processing */
-
-/* XXX: set optreset to 1 rather than these two */
-static int nonopt_start = -1; /* first non option argument (for permute) */
-static int nonopt_end = -1; /* first option after non options (for permute) */
-
-/* Error messages */
-static const char recargchar[] = "option requires an argument -- %c";
-static const char recargstring[] = "option requires an argument -- %s";
-static const char ambig[] = "ambiguous option -- %.*s";
-static const char noarg[] = "option doesn't take an argument -- %.*s";
-static const char illoptchar[] = "unknown option -- %c";
-static const char illoptstring[] = "unknown option -- %s";
-
-static void
-_vwarnx(const char *fmt,va_list ap)
-{
- (void)fprintf(stderr,"%s: ",__progname);
- if (fmt != NULL)
- (void)vfprintf(stderr,fmt,ap);
- (void)fprintf(stderr,"\n");
-}
-
-static void
-warnx(const char *fmt,...)
-{
- va_list ap;
- va_start(ap,fmt);
- _vwarnx(fmt,ap);
- va_end(ap);
-}
-
-/*
- * Compute the greatest common divisor of a and b.
- */
-static int
-gcd(int a, int b)
-{
- int c;
-
- c = a % b;
- while (c != 0) {
- a = b;
- b = c;
- c = a % b;
- }
-
- return (b);
-}
-
-/*
- * Exchange the block from nonopt_start to nonopt_end with the block
- * from nonopt_end to opt_end (keeping the same order of arguments
- * in each block).
- */
-static void
-permute_args(int panonopt_start, int panonopt_end, int opt_end,
- char * const *nargv)
-{
- int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
- char *swap;
-
- /*
- * compute lengths of blocks and number and size of cycles
- */
- nnonopts = panonopt_end - panonopt_start;
- nopts = opt_end - panonopt_end;
- ncycle = gcd(nnonopts, nopts);
- cyclelen = (opt_end - panonopt_start) / ncycle;
-
- for (i = 0; i < ncycle; i++) {
- cstart = panonopt_end+i;
- pos = cstart;
- for (j = 0; j < cyclelen; j++) {
- if (pos >= panonopt_end)
- pos -= nnonopts;
- else
- pos += nopts;
- swap = nargv[pos];
- /* LINTED const cast */
- ((char **) nargv)[pos] = nargv[cstart];
- /* LINTED const cast */
- ((char **)nargv)[cstart] = swap;
- }
- }
-}
-
-/*
- * parse_long_options --
- * Parse long options in argc/argv argument vector.
- * Returns -1 if short_too is set and the option does not match long_options.
- */
-static int
-parse_long_options(char * const *nargv, const char *options,
- const struct option *long_options, int *idx, int short_too)
-{
- char *current_argv, *has_equal;
- size_t current_argv_len;
- int i, ambiguous, match;
-
-#define IDENTICAL_INTERPRETATION(_x, _y) \
- (long_options[(_x)].has_arg == long_options[(_y)].has_arg && \
- long_options[(_x)].flag == long_options[(_y)].flag && \
- long_options[(_x)].val == long_options[(_y)].val)
-
- current_argv = place;
- match = -1;
- ambiguous = 0;
-
- optind++;
-
- if ((has_equal = strchr(current_argv, '=')) != NULL) {
- /* argument found (--option=arg) */
- current_argv_len = has_equal - current_argv;
- has_equal++;
- } else
- current_argv_len = strlen(current_argv);
-
- for (i = 0; long_options[i].name; i++) {
- /* find matching long option */
- if (strncmp(current_argv, long_options[i].name,
- current_argv_len))
- continue;
-
- if (strlen(long_options[i].name) == current_argv_len) {
- /* exact match */
- match = i;
- ambiguous = 0;
- break;
- }
- /*
- * If this is a known short option, don't allow
- * a partial match of a single character.
- */
- if (short_too && current_argv_len == 1)
- continue;
-
- if (match == -1) /* partial match */
- match = i;
- else if (!IDENTICAL_INTERPRETATION(i, match))
- ambiguous = 1;
- }
- if (ambiguous) {
- /* ambiguous abbreviation */
- if (PRINT_ERROR)
- warnx(ambig, (int)current_argv_len,
- current_argv);
- optopt = 0;
- return (BADCH);
- }
- if (match != -1) { /* option found */
- if (long_options[match].has_arg == no_argument
- && has_equal) {
- if (PRINT_ERROR)
- warnx(noarg, (int)current_argv_len,
- current_argv);
- /*
- * XXX: GNU sets optopt to val regardless of flag
- */
- if (long_options[match].flag == NULL)
- optopt = long_options[match].val;
- else
- optopt = 0;
- return (BADARG);
- }
- if (long_options[match].has_arg == required_argument ||
- long_options[match].has_arg == optional_argument) {
- if (has_equal)
- optarg = has_equal;
- else if (long_options[match].has_arg ==
- required_argument) {
- /*
- * optional argument doesn't use next nargv
- */
- optarg = nargv[optind++];
- }
- }
- if ((long_options[match].has_arg == required_argument)
- && (optarg == NULL)) {
- /*
- * Missing argument; leading ':' indicates no error
- * should be generated.
- */
- if (PRINT_ERROR)
- warnx(recargstring,
- current_argv);
- /*
- * XXX: GNU sets optopt to val regardless of flag
- */
- if (long_options[match].flag == NULL)
- optopt = long_options[match].val;
- else
- optopt = 0;
- --optind;
- return (BADARG);
- }
- } else { /* unknown option */
- if (short_too) {
- --optind;
- return (-1);
- }
- if (PRINT_ERROR)
- warnx(illoptstring, current_argv);
- optopt = 0;
- return (BADCH);
- }
- if (idx)
- *idx = match;
- if (long_options[match].flag) {
- *long_options[match].flag = long_options[match].val;
- return (0);
- } else
- return (long_options[match].val);
-#undef IDENTICAL_INTERPRETATION
-}
-
-/*
- * getopt_internal --
- * Parse argc/argv argument vector. Called by user level routines.
- */
-static int
-getopt_internal(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx, int flags)
-{
- char *oli; /* option letter list index */
- int optchar, short_too;
- static int posixly_correct = -1;
-
- if (options == NULL)
- return (-1);
-
- /*
- * XXX Some GNU programs (like cvs) set optind to 0 instead of
- * XXX using optreset. Work around this braindamage.
- */
- if (optind == 0)
- optind = optreset = 1;
-
- /*
- * Disable GNU extensions if POSIXLY_CORRECT is set or options
- * string begins with a '+'.
- *
- * CV, 2009-12-14: Check POSIXLY_CORRECT anew if optind == 0 or
- * optreset != 0 for GNU compatibility.
- */
- if (posixly_correct == -1 || optreset != 0)
- posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
- if (*options == '-')
- flags |= FLAG_ALLARGS;
- else if (posixly_correct || *options == '+')
- flags &= ~FLAG_PERMUTE;
- if (*options == '+' || *options == '-')
- options++;
-
- optarg = NULL;
- if (optreset)
- nonopt_start = nonopt_end = -1;
-start:
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc) { /* end of argument vector */
- place = EMSG;
- if (nonopt_end != -1) {
- /* do permutation, if we have to */
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- optind -= nonopt_end - nonopt_start;
- }
- else if (nonopt_start != -1) {
- /*
- * If we skipped non-options, set optind
- * to the first of them.
- */
- optind = nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- return (-1);
- }
- if (*(place = nargv[optind]) != '-' ||
- (place[1] == '\0' && strchr(options, '-') == NULL)) {
- place = EMSG; /* found non-option */
- if (flags & FLAG_ALLARGS) {
- /*
- * GNU extension:
- * return non-option as argument to option 1
- */
- optarg = nargv[optind++];
- return (INORDER);
- }
- if (!(flags & FLAG_PERMUTE)) {
- /*
- * If no permutation wanted, stop parsing
- * at first non-option.
- */
- return (-1);
- }
- /* do permutation */
- if (nonopt_start == -1)
- nonopt_start = optind;
- else if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- nonopt_start = optind -
- (nonopt_end - nonopt_start);
- nonopt_end = -1;
- }
- optind++;
- /* process next argument */
- goto start;
- }
- if (nonopt_start != -1 && nonopt_end == -1)
- nonopt_end = optind;
-
- /*
- * If we have "-" do nothing, if "--" we are done.
- */
- if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
- optind++;
- place = EMSG;
- /*
- * We found an option (--), so if we skipped
- * non-options, we have to permute.
- */
- if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- optind -= nonopt_end - nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- return (-1);
- }
- }
-
- /*
- * Check long options if:
- * 1) we were passed some
- * 2) the arg is not just "-"
- * 3) either the arg starts with -- we are getopt_long_only()
- */
- if (long_options != NULL && place != nargv[optind] &&
- (*place == '-' || (flags & FLAG_LONGONLY))) {
- short_too = 0;
- if (*place == '-')
- place++; /* --foo long option */
- else if (*place != ':' && strchr(options, *place) != NULL)
- short_too = 1; /* could be short option too */
-
- optchar = parse_long_options(nargv, options, long_options,
- idx, short_too);
- if (optchar != -1) {
- place = EMSG;
- return (optchar);
- }
- }
-
- if ((optchar = (int)*place++) == (int)':' ||
- (optchar == (int)'-' && *place != '\0') ||
- (oli = strchr(options, optchar)) == NULL) {
- /*
- * If the user specified "-" and '-' isn't listed in
- * options, return -1 (non-option) as per POSIX.
- * Otherwise, it is an unknown option character (or ':').
- */
- if (optchar == (int)'-' && *place == '\0')
- return (-1);
- if (!*place)
- ++optind;
- if (PRINT_ERROR)
- warnx(illoptchar, optchar);
- optopt = optchar;
- return (BADCH);
- }
- if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
- /* -W long-option */
- if (*place) /* no space */
- /* NOTHING */;
- else if (++optind >= nargc) { /* no arg */
- place = EMSG;
- if (PRINT_ERROR)
- warnx(recargchar, optchar);
- optopt = optchar;
- return (BADARG);
- } else /* white space */
- place = nargv[optind];
- optchar = parse_long_options(nargv, options, long_options,
- idx, 0);
- place = EMSG;
- return (optchar);
- }
- if (*++oli != ':') { /* doesn't take argument */
- if (!*place)
- ++optind;
- } else { /* takes (optional) argument */
- optarg = NULL;
- if (*place) /* no white space */
- optarg = place;
- else if (oli[1] != ':') { /* arg not optional */
- if (++optind >= nargc) { /* no arg */
- place = EMSG;
- if (PRINT_ERROR)
- warnx(recargchar, optchar);
- optopt = optchar;
- return (BADARG);
- } else
- optarg = nargv[optind];
- }
- place = EMSG;
- ++optind;
- }
- /* dump back option letter */
- return (optchar);
-}
-
-#ifdef REPLACE_GETOPT
-/*
- * getopt --
- * Parse argc/argv argument vector.
- *
- * [eventually this will replace the BSD getopt]
- */
-int
-getopt(int nargc, char * const *nargv, const char *options)
-{
-
- /*
- * We don't pass FLAG_PERMUTE to getopt_internal() since
- * the BSD getopt(3) (unlike GNU) has never done this.
- *
- * Furthermore, since many privileged programs call getopt()
- * before dropping privileges it makes sense to keep things
- * as simple (and bug-free) as possible.
- */
- return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
-}
-#endif /* REPLACE_GETOPT */
-
-/*
- * getopt_long --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx)
-{
-
- return (getopt_internal(nargc, nargv, options, long_options, idx,
- FLAG_PERMUTE));
-}
-
-/*
- * getopt_long_only --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long_only(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx)
-{
-
- return (getopt_internal(nargc, nargv, options, long_options, idx,
- FLAG_PERMUTE|FLAG_LONGONLY));
-}
--- a/win/getopt.h
+++ /dev/null
@@ -1,95 +1,0 @@
-#ifndef __GETOPT_H__
-/**
- * DISCLAIMER
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the w64 mingw-runtime package.
- *
- * The w64 mingw-runtime package and its code is distributed in the hope that it
- * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
- * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
- * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define __GETOPT_H__
-
-/* All the headers include this file. */
-#include <crtdefs.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int optind; /* index of first non-option in argv */
-extern int optopt; /* single option character, as parsed */
-extern int opterr; /* flag to enable built-in diagnostics... */
- /* (user may set to zero, to suppress) */
-
-extern char *optarg; /* pointer to argument of current option */
-
-extern int getopt(int nargc, char * const *nargv, const char *options);
-
-#ifdef _BSD_SOURCE
-/*
- * BSD adds the non-standard `optreset' feature, for reinitialisation
- * of `getopt' parsing. We support this feature, for applications which
- * proclaim their BSD heritage, before including this header; however,
- * to maintain portability, developers are advised to avoid it.
- */
-# define optreset __mingw_optreset
-extern int optreset;
-#endif
-#ifdef __cplusplus
-}
-#endif
-/*
- * POSIX requires the `getopt' API to be specified in `unistd.h';
- * thus, `unistd.h' includes this header. However, we do not want
- * to expose the `getopt_long' or `getopt_long_only' APIs, when
- * included in this manner. Thus, close the standard __GETOPT_H__
- * declarations block, and open an additional __GETOPT_LONG_H__
- * specific block, only when *not* __UNISTD_H_SOURCED__, in which
- * to declare the extended API.
- */
-#endif /* !defined(__GETOPT_H__) */
-
-#if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__)
-#define __GETOPT_LONG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct option /* specification for a long form option... */
-{
- const char *name; /* option name, without leading hyphens */
- int has_arg; /* does it take an argument? */
- int *flag; /* where to save its status, or NULL */
- int val; /* its associated status value */
-};
-
-enum /* permitted values for its `has_arg' field... */
-{
- no_argument = 0, /* option never takes an argument */
- required_argument, /* option always requires an argument */
- optional_argument /* option may take an argument */
-};
-
-extern int getopt_long(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx);
-extern int getopt_long_only(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx);
-/*
- * Previous MinGW implementation had...
- */
-#ifndef HAVE_DECL_GETOPT
-/*
- * ...for the long form API only; keep this for compatibility.
- */
-# define HAVE_DECL_GETOPT 1
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */
--- a/win/libgen.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#ifndef _LIBGEN_H
-#define _LIBGEN_H
-
-char * basename (char *fname)
-{
- return fname;
-}
-
-#endif // _LIBGEN_H
--- a/win/unistd.h
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef _UNISTD_H
-#define _UNISTD_H
-
-#include "getopt.h"
-
-#endif // _UNISTD_H