Initial boost-regex++ release

[SVN r7845]
This commit is contained in:
John Maddock
2000-09-26 11:48:28 +00:00
commit 58a5836642
129 changed files with 41116 additions and 0 deletions

127
demo/regress/bc55.mak Normal file
View File

@ -0,0 +1,127 @@
# very basic makefile for regress
#
# Borland C++ tools
#
# BCROOT defines the root directory of your bcb install
#
!ifndef BCROOT
BCROOT=$(MAKEDIR)\..
!endif
BCC32 = $(BCROOT)\bin\Bcc32.exe
TLINK32 = $(BCROOT)\bin\ILink32.exe
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
LINKOPTS= -ap -Tpe -x
CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb5
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe
echo testing static single threaded version....
r1 tests.txt test1252.txt
r2 tests.txt
r3 tests.txt
r4 tests.txt test1252.txt
r5 tests.txt
r6 tests.txt
echo testing static multi-threaded version....
r1m tests.txt test1252.txt
r2m tests.txt
r3m tests.txt
r4m tests.txt test1252.txt
r5m tests.txt
r6m tests.txt
echo testing dll single threaded version....
r1l tests.txt test1252.txt
r2l tests.txt
r3l tests.txt
r4l tests.txt test1252.txt
r5l tests.txt
r6l tests.txt
echo testing dll multi-threaded version....
r1lm tests.txt test1252.txt
r2lm tests.txt
r3lm tests.txt
r4lm tests.txt test1252.txt
r5lm tests.txt
r6lm tests.txt
r1.exe : r1.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r1.cpp
r2.exe : r2.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r2.cpp
r3.exe : r3.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r3.cpp
r4.exe : r4.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r4.cpp
r5.exe : r5.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r5.cpp
r6.exe : r6.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r6.cpp
r1m.exe : r1.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe r1.cpp
r2m.exe : r2.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe r2.cpp
r3m.exe : r3.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe r3.cpp
r4m.exe : r4.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe r4.cpp
r5m.exe : r5.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe r5.cpp
r6m.exe : r6.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe r6.cpp
r1l.exe : r1.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe r1.cpp
r2l.exe : r2.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe r2.cpp
r3l.exe : r3.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe r3.cpp
r4l.exe : r4.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe r4.cpp
r5l.exe : r5.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe r5.cpp
r6l.exe : r6.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe r6.cpp
r1lm.exe : r1.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe r1.cpp
r2lm.exe : r2.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe r2.cpp
r3lm.exe : r3.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe r3.cpp
r4lm.exe : r4.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe r4.cpp
r5lm.exe : r5.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe r5.cpp
r6lm.exe : r6.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe r6.cpp

179
demo/regress/bcb4.mak Normal file
View File

@ -0,0 +1,179 @@
# very basic makefile for regress
#
# Borland C++ tools
#
# BCROOT defines the root directory of your bcb install
#
!ifndef BCROOT
BCROOT=$(MAKEDIR)\..
!endif
BCC32 = $(BCROOT)\bin\Bcc32.exe
TLINK32 = $(BCROOT)\bin\ILink32.exe
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
LINKOPTS= -ap -Tpe -x
CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb4
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe
echo testing static single threaded version....
r1 tests.txt test1252.txt
r2 tests.txt
r3 tests.txt
r4 tests.txt test1252.txt
r5 tests.txt
r6 tests.txt
echo testing static multi-threaded version....
r1m tests.txt test1252.txt
r2m tests.txt
r3m tests.txt
r4m tests.txt test1252.txt
r5m tests.txt
r6m tests.txt
echo testing static VCL version....
r1v tests.txt test1252.txt
r2v tests.txt
r3v tests.txt
r4v tests.txt test1252.txt
r5v tests.txt
r6v tests.txt
echo testing dll single threaded version....
r1l tests.txt test1252.txt
r2l tests.txt
r3l tests.txt
r4l tests.txt test1252.txt
r5l tests.txt
r6l tests.txt
echo testing dll multi-threaded version....
r1lm tests.txt test1252.txt
r2lm tests.txt
r3lm tests.txt
r4lm tests.txt test1252.txt
r5lm tests.txt
r6lm tests.txt
echo testing dll VCL version....
r1lv tests.txt test1252.txt
r2lv tests.txt
r3lv tests.txt
r4lv tests.txt test1252.txt
r5lv tests.txt
r6lv tests.txt
r1.exe : r1.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r1.cpp
r2.exe : r2.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r2.cpp
r3.exe : r3.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r3.cpp
r4.exe : r4.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r4.cpp
r5.exe : r5.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r5.cpp
r6.exe : r6.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r6.cpp
r1m.exe : r1.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe r1.cpp
r2m.exe : r2.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe r2.cpp
r3m.exe : r3.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe r3.cpp
r4m.exe : r4.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe r4.cpp
r5m.exe : r5.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe r5.cpp
r6m.exe : r6.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe r6.cpp
r1v.exe : r1.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe r1.cpp
r2v.exe : r2.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe r2.cpp
r3v.exe : r3.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe r3.cpp
r4v.exe : r4.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe r4.cpp
r5v.exe : r5.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe r5.cpp
r6v.exe : r6.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe r6.cpp
r1l.exe : r1.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe r1.cpp
r2l.exe : r2.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe r2.cpp
r3l.exe : r3.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe r3.cpp
r4l.exe : r4.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe r4.cpp
r5l.exe : r5.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe r5.cpp
r6l.exe : r6.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe r6.cpp
r1lm.exe : r1.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe r1.cpp
r2lm.exe : r2.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe r2.cpp
r3lm.exe : r3.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe r3.cpp
r4lm.exe : r4.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe r4.cpp
r5lm.exe : r5.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe r5.cpp
r6lm.exe : r6.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe r6.cpp
r1lv.exe : r1.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe r1.cpp
r2lv.exe : r2.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe r2.cpp
r3lv.exe : r3.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe r3.cpp
r4lv.exe : r4.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe r4.cpp
r5lv.exe : r5.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe r5.cpp
r6lv.exe : r6.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe r6.cpp

179
demo/regress/bcb5.mak Normal file
View File

@ -0,0 +1,179 @@
# very basic makefile for regress
#
# Borland C++ tools
#
# BCROOT defines the root directory of your bcb install
#
!ifndef BCROOT
BCROOT=$(MAKEDIR)\..
!endif
BCC32 = $(BCROOT)\bin\Bcc32.exe
TLINK32 = $(BCROOT)\bin\ILink32.exe
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
LINKOPTS= -ap -Tpe -x
CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb5
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe
echo testing static single threaded version....
r1 tests.txt test1252.txt
r2 tests.txt
r3 tests.txt
r4 tests.txt test1252.txt
r5 tests.txt
r6 tests.txt
echo testing static multi-threaded version....
r1m tests.txt test1252.txt
r2m tests.txt
r3m tests.txt
r4m tests.txt test1252.txt
r5m tests.txt
r6m tests.txt
echo testing static VCL version....
r1v tests.txt test1252.txt
r2v tests.txt
r3v tests.txt
r4v tests.txt test1252.txt
r5v tests.txt
r6v tests.txt
echo testing dll single threaded version....
r1l tests.txt test1252.txt
r2l tests.txt
r3l tests.txt
r4l tests.txt test1252.txt
r5l tests.txt
r6l tests.txt
echo testing dll multi-threaded version....
r1lm tests.txt test1252.txt
r2lm tests.txt
r3lm tests.txt
r4lm tests.txt test1252.txt
r5lm tests.txt
r6lm tests.txt
echo testing dll VCL version....
r1lv tests.txt test1252.txt
r2lv tests.txt
r3lv tests.txt
r4lv tests.txt test1252.txt
r5lv tests.txt
r6lv tests.txt
r1.exe : r1.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r1.cpp
r2.exe : r2.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r2.cpp
r3.exe : r3.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r3.cpp
r4.exe : r4.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r4.cpp
r5.exe : r5.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r5.cpp
r6.exe : r6.cpp
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r6.cpp
r1m.exe : r1.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe r1.cpp
r2m.exe : r2.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe r2.cpp
r3m.exe : r3.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe r3.cpp
r4m.exe : r4.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe r4.cpp
r5m.exe : r5.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe r5.cpp
r6m.exe : r6.cpp
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe r6.cpp
r1v.exe : r1.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe r1.cpp
r2v.exe : r2.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe r2.cpp
r3v.exe : r3.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe r3.cpp
r4v.exe : r4.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe r4.cpp
r5v.exe : r5.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe r5.cpp
r6v.exe : r6.cpp
$(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe r6.cpp
r1l.exe : r1.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe r1.cpp
r2l.exe : r2.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe r2.cpp
r3l.exe : r3.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe r3.cpp
r4l.exe : r4.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe r4.cpp
r5l.exe : r5.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe r5.cpp
r6l.exe : r6.cpp
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe r6.cpp
r1lm.exe : r1.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe r1.cpp
r2lm.exe : r2.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe r2.cpp
r3lm.exe : r3.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe r3.cpp
r4lm.exe : r4.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe r4.cpp
r5lm.exe : r5.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe r5.cpp
r6lm.exe : r6.cpp
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe r6.cpp
r1lv.exe : r1.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe r1.cpp
r2lv.exe : r2.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe r2.cpp
r3lv.exe : r3.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe r3.cpp
r4lv.exe : r4.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe r4.cpp
r5lv.exe : r5.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe r5.cpp
r6lv.exe : r6.cpp
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe r6.cpp

50
demo/regress/egcs.mak Normal file
View File

@ -0,0 +1,50 @@
# very basic makefile for regress.exe
#
# egcs compiler GCC
#
CXX= g++ -O2 -pedantic -Wall -I../../../../ -I./
total : r2.exe
r2 tests.txt
r5 tests.txt
r2.exe : r2.cpp
$(CXX) -or2.exe r2.cpp -L../../lib -lregex++

50
demo/regress/gcc.mak Normal file
View File

@ -0,0 +1,50 @@
# very basic makefile for regression tests
#
# g++ 2.95 and greater
#
CXX= g++ -O2 -pedantic -Wall -I../../../../ -I./ -L../../lib/gcc
total : r2
./r2 tests.txt
r2 : r2.cpp
$(CXX) -o r2 r2.cpp -lregex++

78
demo/regress/makefile.in Normal file
View File

@ -0,0 +1,78 @@
# very basic makefile for regression tests
#
CXX=@CXX@
CXXFLAGS=@CXXFLAGS@
LIBS=@LIBS@ -L../../lib -lregex++
EXE=@ac_exe_ext@
OBJ=@ac_obj_ext@
total : @ac_regress@
LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp
r1$(EXE) :: r1$(OBJ)
$(CXX) -o r1$(EXE) r1$(OBJ) $(LIBS)
./r1 tests.txt test1252.txt
r2$(EXE) :: r2$(OBJ)
$(CXX) -o r2$(EXE) r2$(OBJ) $(LIBS)
./r2 tests.txt
r3$(EXE) :: r3$(OBJ)
$(CXX) -o r3$(EXE) r3$(OBJ) $(LIBS)
./r3 tests.txt
r4$(EXE) :: r4$(OBJ)
$(CXX) -o r4$(EXE) r4$(OBJ) $(LIBS)
./r4 tests.txt test1252.txt
r5$(EXE) :: r5$(OBJ)
$(CXX) -o r5$(EXE) r5$(OBJ) $(LIBS)
./r5 tests.txt
r6$(EXE) :: r6$(OBJ)
$(CXX) -o r6$(EXE) r6$(OBJ) $(LIBS)
./r6 tests.txt
r1$(OBJ) : parse.cpp regress.cpp tests.cpp r1.cpp $(LIBDEP)
$(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ r1.cpp
r2$(OBJ) : parse.cpp regress.cpp tests.cpp r2.cpp $(LIBDEP)
$(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r2.cpp
r3$(OBJ) : parse.cpp regress.cpp tests.cpp r3.cpp $(LIBDEP)
$(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r3.cpp
r4$(OBJ) : parse.cpp regress.cpp tests.cpp r4.cpp $(LIBDEP)
$(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ r4.cpp
r5$(OBJ) : parse.cpp regress.cpp tests.cpp r5.cpp $(LIBDEP)
$(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r5.cpp
r6$(OBJ) : parse.cpp regress.cpp tests.cpp r6.cpp $(LIBDEP)
$(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r6.cpp

342
demo/regress/out.txt Normal file
View File

@ -0,0 +1,342 @@
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
cl /MT /D_MT -o r1m.exe -O2 -GX -GR -I..\..\..\.. r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r1.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r1.exe
/out:r1m.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r1.obj
cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r2m.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r2.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r2.exe
/out:r2m.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r2.obj
cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r3m.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r3.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r3.exe
/out:r3m.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r3.obj
cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r4m.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r4.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r4.exe
/out:r4m.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r4.obj
cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r5m.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r5.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r5.exe
/out:r5m.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r5.obj
cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r6m.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r6.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r6.exe
/out:r6m.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r6.obj
cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r1l.exe r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r1.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r1.exe
/out:r1l.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r1.obj
cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r2l.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r2.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r2.exe
/out:r2l.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r2.obj
cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r3l.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r3.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r3.exe
/out:r3l.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r3.obj
cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r4l.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r4.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r4.exe
/out:r4l.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r4.obj
cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r5l.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r5.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r5.exe
/out:r5l.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r5.obj
cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r6l.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r6.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r6.exe
/out:r6l.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r6.obj
cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r1md.exe r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r1.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r1.exe
/out:r1md.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r1.obj
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r2md.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r2.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r2.exe
/out:r2md.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r2.obj
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r3md.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r3.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r3.exe
/out:r3md.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r3.obj
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r4md.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r4.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r4.exe
/out:r4md.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r4.obj
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r5md.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r5.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r5.exe
/out:r5md.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r5.obj
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r6md.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r6.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r6.exe
/out:r6md.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r6.obj
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r1lmd.exe r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r1.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r1.exe
/out:r1lmd.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r1.obj
cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r2lmd.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r2.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r2.exe
/out:r2lmd.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r2.obj
cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r3lmd.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r3.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r3.exe
/out:r3lmd.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r3.obj
cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r4lmd.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r4.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r4.exe
/out:r4lmd.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r4.obj
cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r5lmd.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r5.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r5.exe
/out:r5lmd.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r5.obj
cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r6lmd.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
r6.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:r6.exe
/out:r6lmd.exe
/LIBPATH:..\..\lib\vc6-stlport
user32.lib
r6.obj
echo testing static multi-threaded version....
testing static multi-threaded version....
r1m tests.txt test1252.txt
858 lines, 625 tests completed in file tests.txt
33 lines, 10 tests completed in file test1252.txt
r2m tests.txt
858 lines, 625 tests completed in file tests.txt
r3m tests.txt
Error in line 259 of file tests.txt
Expression: [[:print:]]+
Search text:
a b
Flags: REG_EXTENDED | basic | escape_in_lists | char_classes | intervals | bk_refs | normal | basic | extended
regex++ API result mismatch in sub-expression 0, found (0,5) expected (1,4)
regex++ API result mismatch in sub-expression 0, found (0,5) expected (1,4)
regex++ API result mismatch in sub-expression 0, found (0,5) expected (1,4)
858 lines, 625 tests completed in file tests.txt
NMAKE : fatal error U1077: 'd:\boost\regexpp\libs\regex\demo\regress\r3m.exe' : return code '0x1'
Stop.

326
demo/regress/parse.cpp Normal file
View File

@ -0,0 +1,326 @@
/*
*
* Copyright (c) 1998-2000
* Dr John Maddock
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Dr John Maddock makes no representations
* about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
*/
/*
*
* FILE parse.cpp
* VERSION 3.01
*
* Input parsing functions for regress.
*
*/
#include <boost/regex.hpp>
#include "regress.h"
#ifndef BOOST_RE_ALGO_INCLUDED
#include <algorithm>
#endif
using namespace boost;
//
// start by defining all our flag types:
flag_info flag_data[] = {
{ BOOST_RE_STR("REG_BASIC"), 9, REG_BASIC, 0 },
{ BOOST_RE_STR("REG_EXTENDED"), 12, REG_EXTENDED, 0 },
{ BOOST_RE_STR("REG_ICASE"), 9, REG_ICASE, 0 },
{ BOOST_RE_STR("REG_NOSUB"), 9, REG_NOSUB, 0 },
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
{ BOOST_RE_STR("REG_NOSPEC"), 10, REG_NOSPEC, 0 },
{ BOOST_RE_STR("REG_NOTBOL"), 10, REG_NOTBOL, 1 },
{ BOOST_RE_STR("REG_NOTEOL"), 10, REG_NOTEOL, 1 },
{ BOOST_RE_STR("REG_STARTEND"), 12, REG_STARTEND, 1 },
{ BOOST_RE_STR("basic"), 5, regbase::basic, 2 },
{ BOOST_RE_STR("escape_in_lists"), 15, regbase::escape_in_lists, 2 },
{ BOOST_RE_STR("char_classes"), 12, regbase::char_classes, 2 },
{ BOOST_RE_STR("intervals"), 9, regbase::intervals, 2 },
{ BOOST_RE_STR("limited_ops"), 11, regbase::limited_ops, 2 },
{ BOOST_RE_STR("newline_alt"), 11, regbase::newline_alt, 2 },
{ BOOST_RE_STR("bk_plus_qm"), 10, regbase::bk_plus_qm, 2 },
{ BOOST_RE_STR("bk_braces"), 9, regbase::bk_braces, 2 },
{ BOOST_RE_STR("bk_parens"), 9, regbase::bk_parens, 2 },
{ BOOST_RE_STR("bk_refs"), 7, regbase::bk_refs, 2 },
{ BOOST_RE_STR("bk_vbar"), 7, regbase::bk_vbar, 2 },
{ BOOST_RE_STR("use_except"), 10, regbase::use_except, 2 },
{ BOOST_RE_STR("literal"), 7, regbase::literal, 2 },
{ BOOST_RE_STR("normal"), 6, regbase::normal, 2 },
{ BOOST_RE_STR("basic"), 5, regbase::basic, 2 },
{ BOOST_RE_STR("extended"), 8, regbase::extended, 2 },
{ BOOST_RE_STR("match_default"), 13, match_default, 3 },
{ BOOST_RE_STR("match_not_bol"), 13, match_not_bol, 3 },
{ BOOST_RE_STR("match_not_eol"), 13, match_not_eol, 3 },
{ BOOST_RE_STR("match_not_bob"), 13, match_not_bob, 3 },
{ BOOST_RE_STR("match_not_eob"), 13, match_not_eob, 3 },
{ BOOST_RE_STR("match_not_bow"), 13, match_not_bow, 3 },
{ BOOST_RE_STR("match_not_eow"), 13, match_not_eow, 3 },
{ BOOST_RE_STR("match_not_dot_newline"), 21, match_not_dot_newline, 3 },
{ BOOST_RE_STR("match_not_dot_null"), 18, match_not_dot_null, 3 },
{ BOOST_RE_STR("match_prev_avail"), 16, match_prev_avail, 3 },
{ BOOST_RE_STR("match_any"), 9, match_any, 3 },
{ BOOST_RE_STR("match_not_null"), 14, match_not_null, 3 },
{ BOOST_RE_STR("match_continuous"), 16, match_continuous, 3 },
{ BOOST_RE_STR("format_sed"), 10, format_sed, 3 },
{ BOOST_RE_STR("format_perl"), 11, format_perl, 3 },
{ BOOST_RE_STR("format_no_copy"), 14, format_no_copy, 3 },
{ BOOST_RE_STR("REG_NO_POSIX_TEST"), 17, REG_NO_POSIX_TEST, 4 },
{ BOOST_RE_STR("REG_UNICODE_ONLY"), 16, REG_UNICODE_ONLY, 4 },
{ BOOST_RE_STR("REG_GREP"), 8, REG_GREP, 4 },
{ BOOST_RE_STR("REG_MERGE"), 9, REG_MERGE, 4 },
{ BOOST_RE_STR("REG_MERGE_COPY"), 14, REG_MERGE_COPY, 4 },
{ BOOST_RE_STR(""), 0, 0, 0 },
};
// basically we create a simple token parser
// using regular expressions
const char_t* expression_text = BOOST_RE_STR("(;.*)|") // comment
BOOST_RE_STR("(^[[:blank:]]*-)|") // -
BOOST_RE_STR("([^\"[:space:]][^[:space:]]*)|") // token
BOOST_RE_STR("(\"(([^\"]|\\\\\")*)\")") // "token"
;
typedef reg_expression<char_t> re_parse_t;
typedef re_parse_t::allocator_type parse_alloc;
typedef match_results<string_type::const_iterator, parse_alloc> parse_grep;
typedef string_type::const_iterator parse_iterator;
re_parse_t parse_expression(expression_text, regbase::normal);
//
// now define our grep predicate function object:
class parse_function
{
int mode;
public:
parse_function() : mode(0) {}
parse_function(const parse_function& o) : mode(o.mode) {}
bool operator()(const parse_grep& i);
};
bool parse_function::operator()(const parse_grep& g)
{
parse_iterator i, j;
// determine what caused the match:
if(g[1].matched)
{
// we have a comment:
return true;
}
else if(g[2].matched)
{
// we have the start of a line of flags
mode = -1;
for(int i = 0; i < 5; ++i)
flags[i] = 0;
return true;
}
else if(g[3].matched)
{
// token:
i = g[3].first;
j = g[3].second;
}
else
{
// token delimited by ""
i = g[5].first;
j = g[5].second;
}
// now we need to switch depending upon what mode we are in:
switch(mode)
{
case -1:
{
// parse the flag:
unsigned int id = 0;
while(flag_data[id].len != 0)
{
if(static_cast<unsigned int>(j - i) != flag_data[id].len)
{
++id;
continue;
}
if(std::equal(i, j, flag_data[id].name) == true)
{
flags[flag_data[id].id] |= flag_data[id].value;
return true;
}
++id;
}
cout << "Warning: Unknown flag: ";
string_type t(i, j);
cout << t.c_str();
cout << endl;
return true;
}
case 0:
// set the expression text:
expression = string_type(i, j);
do_test = true;
break;
case 1:
// set the text to match:
search_text = string_type(i, j);
jm_trace("Initial search text: " << search_text);
expand_escapes(search_text);
jm_trace("Search text after escapes expanded: " << search_text);
break;
case 2:
// maybe set format string:
if(flags[4] & REG_MERGE)
{
format_string = string_type(i, j);
break;
}
else
{
matches[mode - 2] = to_int(i, j);
break;
}
case 3:
// maybe set format result:
if(flags[4] & REG_MERGE)
{
merge_string = string_type(i, j);
expand_escapes(merge_string);
break;
}
else
{
matches[mode - 2] = to_int(i, j);
break;
}
default:
jm_assert(mode >= 2);
// set the relevent int value:
matches[mode - 2] = to_int(i, j);
}
++mode;
return true;
}
void parse_input_line(const string_type& s)
{
// set matches back to starting values:
for(int i = 0; i < MAX_MATCHES; ++i)
{
matches[i] = -2;
}
parse_function op;
do_test = false;
regex_grep(op, s.begin(), s.end(), parse_expression);
jm_trace("expression: " << expression);
jm_trace("search string: " << search_text);
}
int to_int(string_type::const_iterator i, string_type::const_iterator j)
{
int val = 0;
bool neg = false;
if((i != j) && (*i == BOOST_RE_STR('-')))
{
neg = true;
++i;
}
while (i != j)
{
val *= 10;
val += *i - BOOST_RE_STR('0');
++i;
}
if(neg)
val *= -1;
return val;
}
void expand_escapes(string_type& s)
{
for(unsigned int i = 0; i < s.size(); ++i)
{
if(s[i] == BOOST_RE_STR('\\'))
{
switch(s[i+1])
{
case BOOST_RE_STR('a'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\a');
break;
case BOOST_RE_STR('b'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\b');
break;
case BOOST_RE_STR('f'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\f');
break;
case BOOST_RE_STR('n'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\n');
break;
case BOOST_RE_STR('r'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\r');
break;
case BOOST_RE_STR('t'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\t');
break;
case BOOST_RE_STR('v'):
s.erase(s.begin() + i);
s[i] = BOOST_RE_STR('\v');
break;
default:
if( (s[i + 1] >= BOOST_RE_STR('0')) && (s[i + 1] <= BOOST_RE_STR('9')) )
{
int val = 0;
unsigned int pos = i;
++i;
while( (s[i] >= BOOST_RE_STR('0')) && (s[i] <= BOOST_RE_STR('9')) && (i < s.size()))
{
val *= 10;
val += s[i] - BOOST_RE_STR('0');
++i;
}
s.erase(s.begin() + pos, s.begin() + i);
if(0 == val)
{
s.insert(s.begin()+pos, ' ');
s[pos] = 0;
}
else
s.insert(s.begin() + pos, val);
i = pos;
}
else
{
s.erase(s.begin() + i);
}
}
}
}
}

24
demo/regress/r1.cpp Normal file
View File

@ -0,0 +1,24 @@
//
// master include file for different regression builds...
//
// r1.cpp
// narrow char's, locale Win32
#define BOOST_RE_TEST_LOCALE_W32
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

24
demo/regress/r1lm.cpp Normal file
View File

@ -0,0 +1,24 @@
//
// master include file for different regression builds...
//
// r1.cpp
// narrow char's, locale Win32
#define BOOST_RE_TEST_LOCALE_W32
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

28
demo/regress/r2.cpp Normal file
View File

@ -0,0 +1,28 @@
//
// master include file for different regression builds...
//
// r1.cpp
// narrow char's, locale C, force no Win32
#define BOOST_RE_TEST_LOCALE_C
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

26
demo/regress/r3.cpp Normal file
View File

@ -0,0 +1,26 @@
//
// master include file for different regression builds...
//
// r1.cpp
// narrow char's, locale CPP
#define BOOST_RE_TEST_LOCALE_CPP
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

26
demo/regress/r4.cpp Normal file
View File

@ -0,0 +1,26 @@
//
// master include file for different regression builds...
//
// r1.cpp
// wide char's, locale Win32
#define BOOST_RE_TEST_LOCALE_W32
#define TEST_UNICODE
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

27
demo/regress/r5.cpp Normal file
View File

@ -0,0 +1,27 @@
//
// master include file for different regression builds...
//
// r1.cpp
// wide char's, locale C
#define BOOST_RE_TEST_LOCALE_C
#define TEST_UNICODE
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

27
demo/regress/r6.cpp Normal file
View File

@ -0,0 +1,27 @@
//
// master include file for different regression builds...
//
// r1.cpp
// wide char's, locale CPP
#define BOOST_RE_TEST_LOCALE_CPP
#define TEST_UNICODE
#include "parse.cpp"
#include "regress.cpp"
#include "tests.cpp"

246
demo/regress/regress.cpp Normal file
View File

@ -0,0 +1,246 @@
/*
*
* Copyright (c) 1998-2000
* Dr John Maddock
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Dr John Maddock makes no representations
* about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
*/
/*
*
* FILE regress.cpp
* VERSION 3.01
*
* main() and associated code for regress.
*
*/
#include <cstdlib>
#include <boost/regex.hpp>
#ifdef BOOST_RE_OLD_IOSTREAM
#include <fstream.h>
#else
#include <fstream>
using std::ifstream;
using std::ofstream;
//using std::cin;
//using std::cout;
using std::endl;
#endif
#ifdef __BORLANDC__
#pragma hrdstop
#endif
#include "regress.h"
//
// declare all our globals here:
//
string_type expression;
string_type search_text;
string_type format_string;
string_type merge_string;
int matches[MAX_MATCHES];
char file[MAX_PATH];
int line;
bool do_test = false;
unsigned int flags[5];
unsigned error_count = 0;
void usage()
{
cout <<
"Usage: regress filename [filename2...]\n"
"see tests.txt for an example test script\n"
"and the script format.\n";
}
int main(int argc, char * argv[])
{
if(argc < 2)
usage();
int i;
for(i = 1; i < argc; ++i)
{
reset_error();
ifstream is(argv[i]);
if(is.good() == false)
{
cout << "Error unable to open file: " << argv[i] << endl << endl;
continue;
}
std::strcpy(file, argv[i]);
line = 0;
unsigned int tests = 0;
while(is.good())
{
string_type s;
get_line(is, s);
++line;
jm_trace("Reading test script line " << line << " " << s);
parse_input_line(s);
if(do_test)
{
run_tests();
++tests;
}
}
cout << line << " lines, " << tests << " tests completed in file " << argv[i] << endl;
}
return error_count;
}
#ifdef TEST_UNICODE
ostream& operator << (ostream& os, const wchar_t* s)
{
while(*s)
{
os.put((char)*s);
++s;
}
return os;
}
ostream& operator << (ostream& os, const std::wstring& s)
{
os << s.c_str();
return os;
}
istream& get_line(istream& is, nstring_type& s, char delim)
{
char c = (char)is.get();
s.erase(s.begin(), s.end());
while((c != delim) && (c != EOF))
{
s.append(1, c);
c = (char)is.get();
}
return is;
}
istream& get_line(istream& is, string_type& s, char delim)
{
nstring_type t;
get_line(is, t, delim);
s.erase(s.begin(), s.end());
const char* i, *j;
i = t.c_str();
j = t.c_str() + t.size();
wchar_t* buf = new wchar_t[MB_CUR_MAX + 1];
int cchars;
while(i != j)
{
cchars = mbtowc(buf, i, j - i);
if(cchars == -1)
break;
if(cchars == 0)
break;
s.insert(s.end(), buf, buf + cchars);
i += cchars;
}
delete[] buf;
return is;
}
#else
istream& get_line(istream& is, string_type& s, char delim)
{
char c = (char)is.get();
s.erase(s.begin(), s.end());
while((c != delim) && (c != EOF))
{
s.append(1, c);
c = (char)is.get();
}
return is;
}
#endif
jm_debug_alloc::jm_debug_alloc()
{
blocks = new int;
count = new int;
*blocks = 0;
*count = 1;
guard = this;
}
jm_debug_alloc::jm_debug_alloc(const jm_debug_alloc& d)
{
blocks = d.blocks;
count = d.count;
++(*count);
guard = this;
}
jm_debug_alloc& jm_debug_alloc::operator=(const jm_debug_alloc& d)
{
free();
blocks = d.blocks;
count = d.count;
++(*count);
return *this;
}
jm_debug_alloc::~jm_debug_alloc()
{
if(guard != this)
{
cout << "Error: attempt to destroy object already destroyed" << endl;
}
else
{
free();
guard = 0;
}
}
void jm_debug_alloc::free()
{
if(--(*count) == 0)
{
if(*blocks)
{
begin_error();
cout << "Error: " << *blocks << " blocks not freed by allocator" << endl;
}
delete count;
delete blocks;
}
}
jm_debug_alloc::pointer jm_debug_alloc::allocate(size_type n, void* hint)
{
pointer p = new char[n + maxi(sizeof(size_type), boost::re_detail::padding_size)];
*(size_type*)p = n;
++(*blocks);
return p + maxi(sizeof(size_type), boost::re_detail::padding_size);
}
void jm_debug_alloc::deallocate(pointer p, size_type n)
{
p -= maxi(sizeof(size_type), boost::re_detail::padding_size);
if(*(size_type*)p != n)
{
begin_error();
cout << "Error: size mismatch in allocate/deallocate calls" << endl;
}
--(*blocks);
delete[] p;
}

325
demo/regress/regress.h Normal file
View File

@ -0,0 +1,325 @@
/*
*
* Copyright (c) 1998-2000
* Dr John Maddock
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Dr John Maddock makes no representations
* about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
*/
/*
*
* FILE regress.h
* VERSION 3.01
*
* Function and data declarations for regress.
*
*/
#ifndef _REGRESS_H
#define _REGRESS_H
#include <boost/re_detail/regex_config.hpp>
#ifdef BOOST_RE_OLD_IOSTREAM
#include <iostream.h>
#else
#include <iostream>
using std::cout;
using std::cerr;
using std::cin;
using std::istream;
using std::ostream;
using std::endl;
#endif
#include <string>
#include <iostream>
#include <boost/regex.hpp>
#ifdef TEST_UNICODE
#ifdef __GNUC__
#define char_t wchar_t
#else
typedef wchar_t char_t;
#endif
#define NO_POSIX_TEST
typedef std::basic_string<char_t> string_type;
typedef std::basic_string<char> nstring_type;
inline istream& get_line(istream& is, nstring_type& s, char delim = '\n');
istream& get_line(istream& is, string_type& s, char delim = L'\n');
#define BOOST_RE_STR(x) L##x
ostream& operator << (ostream& os, const string_type& s);
#else
#ifdef __GNUC__
#define char_t char
#else
typedef char char_t;
#endif
typedef std::basic_string<char_t> string_type;
inline istream& get_line(istream& is, string_type& s, char delim = '\n');
#define BOOST_RE_STR(x) x
#endif
ostream& operator << (ostream& os, const wchar_t* s);
void parse_input_line(const string_type& s);
void expand_escapes(string_type& s);
void run_tests();
void begin_error();
void reset_error();
int to_int(string_type::const_iterator i, string_type::const_iterator j);
#define MAX_MATCHES 30
extern string_type expression;
extern string_type search_text;
extern string_type format_string;
extern string_type merge_string;
extern int matches[MAX_MATCHES];
#ifndef MAX_PATH
#define MAX_PATH 260
#endif
extern char file[MAX_PATH];
extern int line;
extern bool do_test;
extern unsigned int flags[5];
extern unsigned error_count;
struct flag_info
{
const char_t* name; // printable flag name
unsigned int len; // length of name
unsigned int value; // value of the flag
unsigned int id; // index to assign value to
};
extern flag_info flag_data[];
//
// class jm_debug_alloc
// NB this is a byte based allocator
//
class jm_debug_alloc
{
private:
int* blocks, *count;
jm_debug_alloc* guard;
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef char* pointer;
typedef const char* const_pointer;
typedef char& reference;
typedef const char& const_reference;
typedef char value_type;
#ifndef BOOST_RE_NO_MEMBER_TEMPLATES
template <class U>
struct rebind
{
typedef boost::re_detail::re_alloc_binder<U, jm_debug_alloc> other;
};
#endif
jm_debug_alloc();
jm_debug_alloc(const jm_debug_alloc& d);
jm_debug_alloc& operator=(const jm_debug_alloc& d);
~jm_debug_alloc();
void free();
static pointer address(reference x)
{
return &x;
}
static const_pointer address(const_reference x)
{
return &x;
}
unsigned maxi(unsigned i, unsigned j)
{
return i < j ? j : i;
}
pointer allocate(size_type n, void* hint = 0);
void deallocate(pointer p, size_type n);
static size_type max_size()
{
return UINT_MAX;
}
static void construct(pointer , const char& )
{
}
static void destroy(pointer )
{
}
};
#ifdef __BORLANDC__
#if __BORLANDC__ < 0x520
#define BOOST_RE_BORLAND_FIX
#endif
#endif
//
// class debug_iterator
//
template <class T>
struct debug_iterator : public BOOST_RE_RA_ITERATOR(T, ptrdiff_t)
{
typedef std::ptrdiff_t difference_type;
typedef char_t value_type;
typedef char_t* pointer;
typedef char_t& reference;
typedef std::random_access_iterator_tag iterator_category;
typedef debug_iterator self;
typedef size_t size_type;
T cur;
T first;
T last;
debug_iterator(T c, T f, T l)
: cur(c), first(f), last(l) {}
debug_iterator() : cur(), first(), last() {}
debug_iterator(const debug_iterator& x)
: cur(x.cur), first(x.first), last(x.last) {}
reference operator*() const
{
if(cur == last)
{
begin_error();
cout << "Error: attempt to dereference iterator past range" << endl;
}
return *cur;
}
operator T()const { return cur; }
difference_type operator-(const self& x) const {
return (difference_type)(cur - x.cur);
}
self& operator++()
{
if(cur == last)
{
begin_error();
cout << "Error: attempt to increment iterator past range" << endl;
return *this;
}
++cur;
return *this;
}
self operator++(int)
{
self tmp = *this;
++*this;
return tmp;
}
self& operator--()
{
if(cur == first)
{
begin_error();
cout << "Error: attempt to decrement iterator past range" << endl;
return *this;
}
--cur;
return *this;
}
self operator--(int)
{
self tmp = *this;
--*this;
return tmp;
}
self& operator+=(difference_type n)
{
if((last - cur) < n)
{
begin_error();
cout << "Error: attempt to increment iterator past range" << endl;
return *this;
}
cur += n;
return *this;
}
self operator+(difference_type n) const
{
self tmp = *this;
return tmp += n;
}
self& operator-=(difference_type n) { return *this += -n; }
self operator-(difference_type n) const
{
self tmp = *this;
return tmp -= n;
}
reference operator[](difference_type n) const { return *(cur + n); }
bool operator==(const self& x) const { return cur == x.cur; }
bool operator!=(const self& x) const { return !(*this == x); }
bool operator<(const self& x) const {
return (cur < x.cur);
}
};
#if defined(__SGI_STL_PORT) && (__SGI_STL_PORT >= 0x400)
namespace std{
template <class T>
inline random_access_iterator_tag __STL_CALL
__iterator_category(const debug_iterator<T>&) {
return random_access_iterator_tag();
}
}
#endif
#ifdef BOOST_RE_TEST_LOCALE_W32
typedef boost::reg_expression<char_t, boost::w32_regex_traits<char_t>, jm_debug_alloc> re_type;
#elif defined(BOOST_RE_TEST_LOCALE_CPP)
typedef boost::reg_expression<char_t, boost::cpp_regex_traits<char_t>, jm_debug_alloc> re_type;
#else
typedef boost::reg_expression<char_t, boost::c_regex_traits<char_t>, jm_debug_alloc> re_type;
#endif
#define REG_NO_POSIX_TEST 1
#define REG_UNICODE_ONLY 2
#define REG_GREP 4
#define REG_MERGE 8
#define REG_MERGE_COPY 16
#endif

28
demo/regress/sunpro.mak Normal file
View File

@ -0,0 +1,28 @@
# Makefile for timer application
#
# for SUN workshop 5.0 C++ compiler
#
CXX=CC
CPP_FLAGS = -O -I../../../../ -I./
all: r2 r5
r2 tests.txt
r5 tests.txt
%.o : %.cpp
$(CXX) -c -o $@ $(CPP_FLAGS) $<
r2 : r2.o
$(CXX) -o $@ $(CPP_FLAGS) r2.o -L../../lib -lregex++
r5 : r5.o
$(CXX) -o $@ $(CPP_FLAGS) r5.o -L../../lib -lregex++
clean:
rm -rf SunWS_cache
rm -f r2.o r2 r5 r5.o

32
demo/regress/test1252.txt Normal file
View File

@ -0,0 +1,32 @@
;
; This file tests code page 1252 - US / Western European code page.
;
; See tests.txt for a desciption of the scipt format.
;
- match_default extended REG_EXTENDED
; start by testing character classes:
[[:lower:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 32
[[:upper:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 31
[[:punct:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 31
[[:print:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 94
[[:graph:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 94
[a-z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 31
[a-z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 31
[[:word:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 61
;and equivalence classes:
[[=a=]]+ aA<61><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 14
; and then test case mapping:
- match_default extended REG_EXTENDED REG_ICASE
;[A-Z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 31
;[a-z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 31
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 30

729
demo/regress/tests.cpp Normal file
View File

@ -0,0 +1,729 @@
/*
*
* Copyright (c) 1998-2000
* Dr John Maddock
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Dr John Maddock makes no representations
* about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
*/
/*
*
* FILE tests.cpp
* VERSION 3.01
*
* the actual tests conducted by regress.
*
*/
#include <boost/regex.hpp>
#include "regress.h"
using namespace boost;
template <class M1, class M2>
bool compare_result(const M1& sm, const M2& m)
{
if(sm.size() != m.size())
return false;
if(sm.line() != m.line())
return false;
for(unsigned int i = 0; i < sm.size(); ++i)
{
if(sm.position(i) != m.position(i))
return false;
if(sm.length(i) != m.length(i))
return false;
}
return true;
}
template <class M1>
bool compare_result(const M1& sm, const M1& m)
{
return sm == m;
}
template <class C, class T, class A>
void cpp_eh_tests(const reg_expression<C, T, A>& )
{
#ifndef __GNUC__
bool thrown = false;
// try set_expression form first:
try
{
A a;
reg_expression<C, T, A> e(a);
e.set_expression(expression.c_str(), flags[2] | regbase::use_except);
}
catch(const boost::bad_expression&)
{
thrown = true;
}
catch(...){}
if(!thrown)
{
begin_error();
cout << "Error: expected exception not thrown" << endl;
}
// now try constructor form:
thrown = false;
try
{
A a;
reg_expression<C, T, A> e(expression.c_str(), flags[2] | regbase::use_except, a);
}
catch(const boost::bad_expression&)
{
thrown = true;
}
catch(...){}
if(!thrown)
{
begin_error();
cout << "Error: expected exception not thrown" << endl;
}
#endif
}
template <class iterator>
iterator find_last_line(iterator start, iterator end)
{
iterator result = start;
while(start != end)
{
if(*start == '\n')
{
++start;
result = start;
}
else
++start;
}
return result;
}
template <class iterator>
unsigned int count_lines(iterator start, iterator end)
{
unsigned int result = 0;
while(start != end)
{
if(*start == '\n')
++result;
++start;
}
return result;
}
template <class iterator, class Alloc>
class grep_test_predicate
{
int match_id;
iterator base, term;
public:
grep_test_predicate(iterator i, iterator j) : base(i), term(j) { match_id = 0; }
~grep_test_predicate(){}
bool operator()(const boost::match_results< iterator, Alloc >& m);
};
template <class iterator, class Alloc>
bool grep_test_predicate<iterator, Alloc>::operator()(const boost::match_results< iterator, Alloc >& m)
{
int start, end;
start = m[0].first - base;
end = m[0].second - base;
if((matches[match_id] != start) || (matches[match_id + 1] != end))
{
begin_error();
cout << "regex++ grep match error: found [" << start << "," << end << "] expected [" << matches[match_id] << "," << matches[match_id+1] << "]" << endl;
}
//
// check $`:
start = m[-1].first - base;
end = m[-1].second - base;
if(match_id &&
( (end != matches[match_id]) || (start != matches[match_id - 1]) )
)
{
begin_error();
cout << "regex++ grep error in $`: found [" << start << "," << end << "] expected [" << matches[match_id-1] << "," << matches[match_id] << "]" << endl;
}
else if((!match_id) && ((start != 0) || (end != matches[0])))
{
begin_error();
cout << "regex++ grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl;
}
//
// check $':
start = m[-2].first - base;
end = m[-2].second - base;
if((start != matches[match_id + 1]) || (end != (term-base)))
{
begin_error();
cout << "regex++ grep error in $': found [" << start << "," << end << "] expected [" << matches[match_id + 1] << "," << (term-base) << "]" << endl;
}
//
// now check line()
start = m.line();
end = count_lines(base, iterator(m[0].first)) + 1;
if(start != end)
{
begin_error();
cout << "regex++ grep error in line(): found " << start << " expected " << end << endl;
}
//
// now check line_start()
start = m.line_start() - base;
end = find_last_line(base, iterator(m[0].first)) - base;
if(start != end)
{
begin_error();
cout << "regex++ grep error in line_start(): found " << start << " expected " << end << endl;
}
match_id += 2;
return true;
}
template <class C, class T, class A>
void cpp_tests(const reg_expression<C, T, A>& e, bool recurse = true)
{
typedef A allocator_type;
if(flags[4] & REG_MERGE)
{
//
// test merge code:
//
string_type s;
s = regex_merge(search_text, e, format_string.c_str(), flags[3]);
if(s != merge_string)
{
begin_error();
cout << "merge result mismatch: found \"" << s.c_str() << "\" expected \"" << merge_string.c_str() << "\"" << endl;
}
return;
}
if(recurse)
{
// copy and assign test:
reg_expression<C, T, A> e2(e);
cpp_tests(e2, false);
e2 = e;
cpp_tests(e2, false);
}
if(e.error_code())
{
// verify that we don't expect expression to compile
if(search_text != BOOST_RE_STR("!"))
{
begin_error();
cout << "Expression did not compile using regex++ API" << endl;
}
else if(recurse)
cpp_eh_tests(e);
}
else if(flags[4] & REG_GREP)
{
// try to do grep:
debug_iterator<string_type::iterator> x(search_text.begin(), search_text.begin(), search_text.end());
debug_iterator<string_type::iterator> y(search_text.end(), search_text.begin(), search_text.end());
grep_test_predicate<debug_iterator<string_type::iterator>, allocator_type> oi(x, y);
regex_grep(oi, x, y, e, flags[3]);
#if !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) && !defined(BOOST_RE_NO_STRING_H) && !defined(BOOST_RE_NO_STRING_DEF_ARGS)
if(!recurse)
{
std::basic_string<char_t> s(search_text.begin(), search_text.end());
grep_test_predicate<std::basic_string<char_t>::const_iterator, reg_expression<C, T, A>::allocator_type> oi2(s.begin(), s.end());
regex_grep(oi2, s, e, flags[3]);
grep_test_predicate<const char_t*, reg_expression<C, T, A>::allocator_type> oi3(s.c_str(), s.c_str()+s.size());
regex_grep(oi3, s.c_str(), e, flags[3]);
}
#endif
}
else
{
// try to find match
match_results< debug_iterator<string_type::iterator>, reg_expression<C, T, A>::allocator_type> m;
debug_iterator<string_type::iterator> x(search_text.begin(), search_text.begin(), search_text.end());
debug_iterator<string_type::iterator> y(search_text.end(), search_text.begin(), search_text.end());
if(regex_search(x, y, m, e, flags[3]))
{
// match found compare what matched with what we expect:
int j = 0;
for(unsigned int i = 0; i < m.size(); ++i, j += 2)
{
if(m[i].matched == false)
{
if(matches[j] != -1)
{
begin_error();
cout << "regex++ API result mismatch in sub-expression " << i <<
", found (" << (m[i].first - x) << "," <<
(m[i].second - x) << ") expected (" <<
matches[j] << "," << matches[j+1] << ")" << endl;
}
}
else if(((m[i].first - x) != matches[j]) || ((m[i].second - x) != matches[j+1]))
{
begin_error();
cout << "regex++ API result mismatch in sub-expression " << i <<
", found (" << (m[i].first - x) << "," <<
(m[i].second - x) << ") expected (" <<
matches[j] << "," << matches[j+1] << ")" << endl;
}
}
//
// now check $` and $':
//
if((m[-1].first != x) || (m[-1].second != m[0].first))
{
begin_error();
cout << "regex++ API result mismatch in $` (match -1), found (" <<
(m[-1].first - x) << "," << (m[-1].second - x) << ") expected (0" <<
"," << matches[0] << ")" << endl;
}
if((m[-2].first != m[0].second) || (m[-2].second != y))
{
begin_error();
cout << "regex++ API result mismatch in $' (match -2), found (" <<
(m[-2].first - x) << "," << (m[-2].second - x) << ") expected (" <<
matches[1] << "," << (y-x) << ")" << endl;
}
//
// now try alternative forms of regex_search if available:
#if !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) && !defined(BOOST_RE_NO_STRING_H) && !defined(BOOST_RE_NO_STRING_DEF_ARGS)
if(!recurse)
{
std::basic_string<char_t> s(search_text.begin(), search_text.end());
match_results<std::basic_string<char_t>::const_iterator> sm;
if(regex_search(s, sm, e, flags[3]))
{
if(compare_result(sm, m) == false)
{
begin_error();
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const reg_expression&, int)" << endl;
}
}
else
{
begin_error();
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const reg_expression&, int)" << endl;
}
if(s.find(char_t(0)) == std::basic_string<char_t>::npos)
{
match_results<const char_t*> ssm;
if(regex_search(search_text.c_str(), ssm, e, flags[3]))
{
if(compare_result(ssm, m) == false)
{
begin_error();
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const reg_expression&, int)" << endl;
}
}
else
{
begin_error();
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const reg_expression&, int)" << endl;
}
}
}
if((false == recurse) && (matches[0] == 0) && (matches[1] == search_text.size()))
{
//
// match expected on whole string, so all versions
// of regex_match should also succeed:
//
match_results< debug_iterator<string_type::iterator>, reg_expression<C, T, A>::allocator_type> m1;
debug_iterator<string_type::iterator> x1(search_text.begin(), search_text.begin(), search_text.end());
debug_iterator<string_type::iterator> y1(search_text.end(), search_text.begin(), search_text.end());
if(regex_match(x1, y1, m1, e, flags[3]))
{
if(compare_result(m1, m) == false)
{
begin_error();
cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const reg_expression&, int)" << endl;
}
}
else
{
begin_error();
cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const reg_expression&, int)" << endl;
}
std::basic_string<char_t> s(search_text.begin(), search_text.end());
match_results<std::basic_string<char_t>::const_iterator> sm;
if(regex_match(s, sm, e, flags[3]))
{
if(compare_result(sm, m) == false)
{
begin_error();
cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const reg_expression&, int)" << endl;
}
}
else
{
begin_error();
cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const reg_expression&, int)" << endl;
}
if(s.find(char_t(0)) == std::basic_string<char_t>::npos)
{
match_results<const char_t*> ssm;
if(regex_match(search_text.c_str(), ssm, e, flags[3]))
{
if(compare_result(ssm, m) == false)
{
begin_error();
cout << "regex++ API result mismatch in regex_match(const char_t*, match_results&, const reg_expression&, int)" << endl;
}
}
else
{
begin_error();
cout << "regex++ API result mismatch in regex_match(const char_t*, match_results&, const reg_expression&, int)" << endl;
}
}
}
#endif
}
else
{
// match not found
if(matches[0] != -1)
{
begin_error();
cout << "Match expected but not found using regex++ API" << endl;
}
}
}
}
#if !defined(TEST_UNICODE)
unsigned int hl_match_id;
bool hl_grep_test_proc(const RegEx& e)
{
int start, end;
start = e.Position(0);
end = start + e.Length();
if((matches[hl_match_id] != start) || (matches[hl_match_id + 1] != end))
{
begin_error();
cout << "class RegEx grep match error: found [" << start << "," << end << "] expected [" << matches[hl_match_id] << "," << matches[hl_match_id+1] << "]" << endl;
}
//
// check $`:
start = e.Position(-1);
end = start + e.Length(-1);
if(start == -1)
{
if(hl_match_id &&
( matches[hl_match_id] != matches[hl_match_id - 1] )
)
{
begin_error();
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << matches[hl_match_id-1] << "," << matches[hl_match_id] << "]" << endl;
}
else if((!hl_match_id) && (0 != matches[0]))
{
begin_error();
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl;
}
}
else
{
if(hl_match_id &&
( (end != matches[hl_match_id]) || (start != matches[hl_match_id - 1]) )
)
{
begin_error();
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << matches[hl_match_id-1] << "," << matches[hl_match_id] << "]" << endl;
}
else if((!hl_match_id) && ((start != 0) || (end != matches[0])))
{
begin_error();
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl;
}
}
//
// check $':
start = e.Position(-2);
end = start + e.Length(-2);
if(start == -1)
{
if(matches[hl_match_id + 1] != search_text.size())
{
begin_error();
cout << "class RegEx grep error in $': found [" << start << "," << end << "] expected [" << matches[hl_match_id + 1] << "," << (search_text.size()) << "]" << endl;
}
}
else if((start != matches[hl_match_id + 1]) || (end != search_text.size()))
{
begin_error();
cout << "class RegEx grep error in $': found [" << start << "," << end << "] expected [" << matches[hl_match_id + 1] << "," << (search_text.size()) << "]" << endl;
}
hl_match_id += 2;
return true;
}
void cpp_hl_tests(RegEx& e, bool recurse = true)
{
if(flags[4] & REG_MERGE)
return;
if(recurse)
{
// copy and assign test:
RegEx e2(e);
cpp_hl_tests(e2, false);
e2 = e;
cpp_hl_tests(e2, false);
}
if(flags[4] & REG_GREP)
{
// try to do grep:
hl_match_id = 0;
GrepCallback cb = hl_grep_test_proc;
e.Grep(cb, search_text.c_str(), flags[3]);
}
else
{
if(e.Search(search_text.c_str(), flags[3]))
{
unsigned int i = 0;
unsigned int j = 0;
while(matches[j] != -2)
{
if( (matches[j] != e.Position(i)) || (matches[j+1] - matches[j] != e.Length(i)) )
{
begin_error();
cout << "RegEx::Search error in subexpression " << i << ": found [" << e.Position(i) << "," << (e.Position(i) + e.Length(i)) << "] expected [" << matches[j] << "," << matches[j+1] << "]" << endl;
}
++i;
j += 2;
}
}
else
{
if(matches[0] != -1)
{
begin_error();
cout << "match expected but not found with RexEx::Search" << endl;
}
}
if((matches[0] == 0) && (e.Match(search_text.c_str(), flags[3])))
{
unsigned int i = 0;
unsigned int j = 0;
while(matches[j] != -2)
{
if( (matches[j] != e.Position(i)) || (matches[j+1] - matches[j] != e.Length(i)) )
{
begin_error();
cout << "RegEx::Match error in subexpression " << i << ": found [" << e.Position(i) << "," << (e.Position(i) + e.Length(i)) << "] expected [" << matches[j] << "," << matches[j+1] << "]" << endl;
}
++i;
j += 2;
}
}
}
}
#endif
template <class iterator>
bool has_nulls(iterator i, iterator j)
{
while(i != j)
{
if(*i == 0)
return true;
++i;
}
return false;
}
#ifdef TEST_UNICODE
#undef regcomp
#undef regerror
#undef regexec
#undef regfree
#undef regex_t
#define regcomp regcompW
#define regerror regerrorW
#define regexec regexecW
#define regfree regfreeW
#define regex_t regex_tW
#endif
void run_tests()
{
#ifndef TEST_UNICODE
if(flags[4] & REG_UNICODE_ONLY)
return;
#endif
#ifndef NO_CPP_TEST
try
{
unsigned int f = flags[2] & ~regbase::use_except;
if(flags[0] & REG_ICASE)
f |= regbase::icase;
re_type e(expression.c_str(), f);
cpp_tests(e, true);
}
#ifndef BOOST_RE_NO_EXCEPTION_H
catch(const std::exception& e)
{
//
// this is only an error if the expression is expected to be valid:
if(search_text != BOOST_RE_STR("!"))
{
begin_error();
cout << "Unexpected exception thrown from C++ library: " << e.what() << endl;
}
}
#endif
catch(...)
{
begin_error();
cout << "Unexpected exception thrown from C++ library" << endl;
}
#endif
#if !defined(TEST_UNICODE)
try
{
if((flags[2] == regbase::normal) && (has_nulls(search_text.begin(), search_text.end()) == false))
{
RegEx e;
e.SetExpression(expression.c_str(), flags[0] & REG_ICASE);
cpp_hl_tests(e, true);
}
}
catch(const std::exception& e)
{
if(search_text != BOOST_RE_STR("!"))
{
begin_error();
cout << "Expression did not compile with class RegEx" << endl;
}
}
catch(...)
{
begin_error();
cout << "Unexpected exception thrown from RegEx::SetExpression" << endl;
}
#endif
if(flags[4] & (REG_NO_POSIX_TEST | REG_GREP | REG_MERGE | REG_MERGE_COPY))
return;
regex_t posix_expression;
regmatch_t m[MAX_MATCHES];
if(regcomp(&posix_expression, expression.c_str(), flags[0]) == 0)
{
if(flags[1] & REG_STARTEND)
{
m[0].rm_so = 0;
m[0].rm_eo = search_text.size();
}
if(regexec(&posix_expression, search_text.c_str(), MAX_MATCHES, m, flags[1]))
{
// match not found
if(matches[0] != -1)
{
begin_error();
cout << "Match expected but not found using POSIX API" << endl;
}
}
else
{
// match found compare what matched with what we expect:
int j = 0;
for(unsigned int i = 0; i <= posix_expression.re_nsub; ++i, j += 2)
{
if((m[i].rm_so != matches[j]) || (m[i].rm_eo != matches[j+1]))
{
begin_error();
cout << "POSIX API result mismatch in sub-expression " << i << ", found (" << m[i].rm_so << "," << m[i].rm_eo <<
") expected (" << matches[j] << "," << matches[j+1] << ")" << endl;
}
}
}
regfree(&posix_expression);
}
else
{
// expression did not compile
if(search_text != BOOST_RE_STR("!"))
{
begin_error();
cout << "Expression did not compile using POSIX API" << endl;
}
}
}
//
// error reporting:
int last_line = 0;
void begin_error()
{
if(line != last_line)
{
cout << "Error in line " << line << " of file " << file << endl;
cout << "Expression: " << expression.c_str() << endl;
cout << "Search text: " << search_text.c_str() << endl;
cout << "Flags: ";
bool started = false;
unsigned int id = 0;
while(flag_data[id].len != 0)
{
if(flags[flag_data[id].id] & flag_data[id].value)
{
if(started)
cout << " | ";
cout << flag_data[id].name;
started = true;
}
++id;
}
cout << endl;
last_line = line;
++error_count;
}
}
void reset_error()
{
last_line = 0;
}

857
demo/regress/tests.txt Normal file
View File

@ -0,0 +1,857 @@
;
;
; this file contains a script of tests to run through regress.exe
;
; comments start with a semicolon and proceed to the end of the line
;
; changes to regular expression compile flags start with a "-" as the first
; non-whitespace character and consist of a list of the printable names
; of the flags, for example "match_default"
;
; Other lines contain a test to perform using the current flag status
; the first token contains the expression to compile, the second the string
; to match it against. If the second string is "!" then the expression should
; not compile, that is the first string is an invalid regular expression.
; This is then followed by a list of integers that specify what should match,
; each pair represents the starting and ending positions of a subexpression
; starting with the zeroth subexpression (the whole match).
; A value of -1 indicates that the subexpression should not take part in the
; match at all, if the first value is -1 then no part of the expression should
; match the string.
;
- match_default normal REG_EXTENDED
;
; try some really simple literals:
a a 0 1
Z Z 0 1
Z aaa -1 -1
Z xxxxZZxxx 4 5
; and some simple brackets:
(a) zzzaazz 3 4 3 4
() zzz 0 0 0 0
() "" 0 0 0 0
( !
) !
(aa !
aa) !
a b -1 -1
\(\) () 0 2
\(a\) (a) 0 3
\() !
(\) !
; now try escaped brackets:
- match_default bk_parens REG_BASIC
\(a\) zzzaazz 3 4 3 4
\(\) zzz 0 0 0 0
\(\) "" 0 0 0 0
\( !
\) !
\(aa !
aa\) !
() () 0 2
(a) (a) 0 3
(\) !
\() !
; now move on to "." wildcards
- match_default normal REG_EXTENDED REG_STARTEND
. a 0 1
. \n 0 1
. \r 0 1
. \0 0 1
- match_default normal match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE
. a 0 1
. \n -1 -1
. \r -1 -1
. \0 0 1
- match_default normal match_not_dot_null match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE
. \n -1 -1
. \r -1 -1
; this *WILL* produce an error from the POSIX API functions:
- match_default normal match_not_dot_null match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE REG_NO_POSIX_TEST
. \0 -1 -1
;
; now move on to the repetion ops,
; starting with operator *
- match_default normal REG_EXTENDED
a* b 0 0
ab* a 0 1
ab* ab 0 2
ab* sssabbbbbbsss 3 10
ab*c* a 0 1
ab*c* abbb 0 4
ab*c* accc 0 4
ab*c* abbcc 0 5
*a !
\<* !
\>* !
\n* \n\n 0 2
\** ** 0 2
\* * 0 1
; now try operator +
ab+ a -1 -1
ab+ ab 0 2
ab+ sssabbbbbbsss 3 10
ab+c+ a -1 -1
ab+c+ abbb -1 -1
ab+c+ accc -1 -1
ab+c+ abbcc 0 5
+a !
\<+ !
\>+ !
\n+ \n\n 0 2
\+ + 0 1
\+ ++ 0 1
\++ ++ 0 2
- match_default normal bk_plus_qm REG_EXTENDED REG_NO_POSIX_TEST
+ + 0 1
\+ !
a\+ aa 0 2
; now try operator ?
- match_default normal REG_EXTENDED
a? b 0 0
ab? a 0 1
ab? ab 0 2
ab? sssabbbbbbsss 3 5
ab?c? a 0 1
ab?c? abbb 0 2
ab?c? accc 0 2
ab?c? abcc 0 3
?a !
\<? !
\>? !
\n? \n\n 0 1
\? ? 0 1
\? ?? 0 1
\?? ?? 0 1
- match_default normal bk_plus_qm REG_EXTENDED REG_NO_POSIX_TEST
? ? 0 1
\? !
a\? aa 0 1
a\? b 0 0
- match_default normal limited_ops
a? a? 0 2
a+ a+ 0 2
a\? a? 0 2
a\+ a+ 0 2
; now try operator {}
- match_default normal REG_EXTENDED
a{2} a -1 -1
a{2} aa 0 2
a{2} aaa 0 2
a{2,} a -1 -1
a{2,} aa 0 2
a{2,} aaaaa 0 5
a{2,4} a -1 -1
a{2,4} aa 0 2
a{2,4} aaa 0 3
a{2,4} aaaa 0 4
a{2,4} aaaaa 0 4
; spaces are now allowed inside {}
"a{ 2 , 4 }" aaaaa 0 4
a{} !
"a{ }" !
a{2 !
a} !
\{\} {} 0 2
- match_default normal bk_braces
a\{2\} a -1 -1
a\{2\} aa 0 2
a\{2\} aaa 0 2
a\{2,\} a -1 -1
a\{2,\} aa 0 2
a\{2,\} aaaaa 0 5
a\{2,4\} a -1 -1
a\{2,4\} aa 0 2
a\{2,4\} aaa 0 3
a\{2,4\} aaaa 0 4
a\{2,4\} aaaaa 0 4
"a\{ 2 , 4 \}" aaaaa 0 4
{} {} 0 2
; now test the alternation operator |
- match_default normal REG_EXTENDED
a|b a 0 1
a|b b 0 1
a(b|c) ab 0 2 1 2
a(b|c) ac 0 2 1 2
a(b|c) ad -1 -1 -1 -1
|c !
c| !
(|) !
(a|) !
(|a) !
a\| a| 0 2
- match_default normal limited_ops
a| a| 0 2
a\| a| 0 2
| | 0 1
- match_default normal bk_vbar REG_NO_POSIX_TEST
a| a| 0 2
a\|b a 0 1
a\|b b 0 1
; now test the set operator []
- match_default normal REG_EXTENDED
; try some literals first
[abc] a 0 1
[abc] b 0 1
[abc] c 0 1
[abc] d -1 -1
[^bcd] a 0 1
[^bcd] b -1 -1
[^bcd] d -1 -1
[^bcd] e 0 1
a[b]c abc 0 3
a[ab]c abc 0 3
a[^ab]c adc 0 3
a[]b]c a]c 0 3
a[[b]c a[c 0 3
a[-b]c a-c 0 3
a[^]b]c adc 0 3
a[^-b]c adc 0 3
a[b-]c a-c 0 3
a[b !
a[] !
; then some ranges
[b-e] a -1 -1
[b-e] b 0 1
[b-e] e 0 1
[b-e] f -1 -1
[^b-e] a 0 1
[^b-e] b -1 -1
[^b-e] e -1 -1
[^b-e] f 0 1
a[1-3]c a2c 0 3
a[3-1]c !
a[1-3-5]c !
a[1- !
; and some classes
a[[:alpha:]]c abc 0 3
a[[:unknown:]]c !
a[[: !
a[[:alpha !
a[[:alpha:] !
a[[:alpha,:] !
a[[:]:]]b !
a[[:-:]]b !
a[[:alph:]] !
a[[:alphabet:]] !
[[:alnum:]]+ -%@a0X- 3 6
[[:alpha:]]+ -%@aX0- 3 5
[[:blank:]]+ "a \tb" 1 4
[[:cntrl:]]+ a\n\tb 1 3
[[:digit:]]+ a019b 1 4
[[:graph:]]+ " a%b " 1 4
[[:lower:]]+ AabC 1 3
[[:print:]]+ "\na b\n" 1 4
[[:punct:]]+ " %-&\t" 1 4
[[:space:]]+ "a \n\t\rb" 1 5
[[:upper:]]+ aBCd 1 3
[[:xdigit:]]+ p0f3Cx 1 5
; now test flag settings:
- escape_in_lists REG_NO_POSIX_TEST
[\n] \n 0 1
- REG_NO_POSIX_TEST
[\n] \n -1 -1
[\n] \\ 0 1
[[:class:] : 0 1
[[:class:] [ 0 1
[[:class:] c 0 1
; line anchors
- match_default normal REG_EXTENDED
^ab ab 0 2
^ab xxabxx -1 -1
^ab xx\nabzz 3 5
ab$ ab 0 2
ab$ abxx -1 -1
ab$ ab\nzz 0 2
- match_default match_not_bol match_not_eol normal REG_EXTENDED REG_NOTBOL REG_NOTEOL
^ab ab -1 -1
^ab xxabxx -1 -1
^ab xx\nabzz 3 5
ab$ ab -1 -1
ab$ abxx -1 -1
ab$ ab\nzz 0 2
; back references
- match_default normal REG_EXTENDED
a(b)\2c !
a(b\1)c !
a(b*)c\1d abbcbbd 0 7 1 3
a(b*)c\1d abbcbd -1 -1
a(b*)c\1d abbcbbbd -1 -1
^(.)\1 abc -1 -1
a([bc])\1d abcdabbd 4 8 5 6
; strictly speaking this is at best ambiguous, at worst wrong, this is what most
; re implimentations will match though.
a(([bc])\2)*d abbccd 0 6 3 5 3 4
a(([bc])\2)*d abbcbd -1 -1
a((b)*\2)*d abbbd 0 5 1 4 2 3
(ab*)[ab]*\1 ababaaa 0 7 0 1
(a)\1bcd aabcd 0 5 0 1
(a)\1bc*d aabcd 0 5 0 1
(a)\1bc*d aabd 0 4 0 1
(a)\1bc*d aabcccd 0 7 0 1
(a)\1bc*[ce]d aabcccd 0 7 0 1
^(a)\1b(c)*cd$ aabcccd 0 7 0 1 4 5
;
; characters by code:
- match_default normal REG_EXTENDED REG_STARTEND
\0101 A 0 1
\00 \0 0 1
\0 \0 0 1
\0172 z 0 1
;
; word operators:
\w a 0 1
\w z 0 1
\w A 0 1
\w Z 0 1
\w _ 0 1
\w } -1 -1
\w ` -1 -1
\w [ -1 -1
\w @ -1 -1
; non-word:
\W a -1 -1
\W z -1 -1
\W A -1 -1
\W Z -1 -1
\W _ -1 -1
\W } 0 1
\W ` 0 1
\W [ 0 1
\W @ 0 1
; word start:
\<abcd " abcd" 2 6
\<ab cab -1 -1
\<ab "\nab" 1 3
\<tag ::tag 2 5
;word end:
abc\> abc 0 3
abc\> abcd -1 -1
abc\> abc\n 0 3
abc\> abc:: 0 3
; word boundary:
\babcd " abcd" 2 6
\bab cab -1 -1
\bab "\nab" 1 3
\btag ::tag 2 5
abc\b abc 0 3
abc\b abcd -1 -1
abc\b abc\n 0 3
abc\b abc:: 0 3
; within word:
\B ab 1 1
a\Bb ab 0 2
a\B ab 0 1
a\B a -1 -1
a\B "a " -1 -1
;
; buffer operators:
\`abc abc 0 3
\`abc \nabc -1 -1
\`abc " abc" -1 -1
abc\' abc 0 3
abc\' abc\n -1 -1
abc\' "abc " -1 -1
;
; extra escape sequences:
\a \a 0 1
\f \f 0 1
\n \n 0 1
\r \r 0 1
\t \t 0 1
\v \v 0 1
;
; now follows various complex expressions designed to try and bust the matcher:
a(((b)))c abc 0 3 1 2 1 2 1 2
a(b|(c))d abd 0 3 1 2 -1 -1
a(b|(c))d acd 0 3 1 2 1 2
a(b*|c)d abbd 0 4 1 3
; just gotta have one DFA-buster, of course
a[ab]{20} aaaaabaaaabaaaabaaaab 0 21
; and an inline expansion in case somebody gets tricky
a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] aaaaabaaaabaaaabaaaab 0 21
; and in case somebody just slips in an NFA...
a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) aaaaabaaaabaaaabaaaabweeknights 0 31 21 24 24 31
; one really big one
1234567890123456789012345678901234567890123456789012345678901234567890 a1234567890123456789012345678901234567890123456789012345678901234567890b 1 71
; fish for problems as brackets go past 8
[ab][cd][ef][gh][ij][kl][mn] xacegikmoq 1 8
[ab][cd][ef][gh][ij][kl][mn][op] xacegikmoq 1 9
[ab][cd][ef][gh][ij][kl][mn][op][qr] xacegikmoqy 1 10
[ab][cd][ef][gh][ij][kl][mn][op][q] xacegikmoqy 1 10
; and as parenthesis go past 9:
(a)(b)(c)(d)(e)(f)(g)(h) zabcdefghi 1 9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9
(a)(b)(c)(d)(e)(f)(g)(h)(i) zabcdefghij 1 10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j) zabcdefghijk 1 11 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k) zabcdefghijkl 1 12 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12
(a)d|(b)c abc 1 3 -1 -1 1 2
"_+((www)|(ftp)|(mailto)):_*" "_wwwnocolon _mailto:" 12 20 13 19 -1 -1 -1 -1 13 19
; subtleties of matching
a(b)?c\1d acd 0 3 -1 -1
a(b?c)+d accd 0 4 2 3
(wee|week)(knights|night) weeknights 0 10 0 3 3 10
.* abc 0 3
a(b|(c))d abd 0 3 1 2 -1 -1
a(b|(c))d acd 0 3 1 2 1 2
a(b*|c|e)d abbd 0 4 1 3
a(b*|c|e)d acd 0 3 1 2
a(b*|c|e)d ad 0 2 1 1
a(b?)c abc 0 3 1 2
a(b?)c ac 0 2 1 1
a(b+)c abc 0 3 1 2
a(b+)c abbbc 0 5 1 4
a(b*)c ac 0 2 1 1
(a|ab)(bc([de]+)f|cde) abcdef 0 6 0 1 1 6 3 5
a([bc]?)c abc 0 3 1 2
a([bc]?)c ac 0 2 1 1
a([bc]+)c abc 0 3 1 2
a([bc]+)c abcc 0 4 1 3
a([bc]+)bc abcbc 0 5 1 3
a(bb+|b)b abb 0 3 1 2
a(bbb+|bb+|b)b abb 0 3 1 2
a(bbb+|bb+|b)b abbb 0 4 1 3
a(bbb+|bb+|b)bb abbb 0 4 1 2
(.*).* abcdef 0 6 0 6
(a*)* bc 0 0 0 0
; do we get the right subexpression when it is used more than once?
a(b|c)*d ad 0 2 -1 -1
a(b|c)*d abcd 0 4 2 3
a(b|c)+d abd 0 3 1 2
a(b|c)+d abcd 0 4 2 3
a(b|c?)+d ad 0 2 1 1
a(b|c?)+d abcd 0 4 2 3
a(b|c){0,0}d ad 0 2 -1 -1
a(b|c){0,1}d ad 0 2 -1 -1
a(b|c){0,1}d abd 0 3 1 2
a(b|c){0,2}d ad 0 2 -1 -1
a(b|c){0,2}d abcd 0 4 2 3
a(b|c){0,}d ad 0 2 -1 -1
a(b|c){0,}d abcd 0 4 2 3
a(b|c){1,1}d abd 0 3 1 2
a(b|c){1,2}d abd 0 3 1 2
a(b|c){1,2}d abcd 0 4 2 3
a(b|c){1,}d abd 0 3 1 2
a(b|c){1,}d abcd 0 4 2 3
a(b|c){2,2}d acbd 0 4 2 3
a(b|c){2,2}d abcd 0 4 2 3
a(b|c){2,4}d abcd 0 4 2 3
a(b|c){2,4}d abcbd 0 5 3 4
a(b|c){2,4}d abcbcd 0 6 4 5
a(b|c){2,}d abcd 0 4 2 3
a(b|c){2,}d abcbd 0 5 3 4
a(b+|((c)*))+d abd 0 3 1 2 -1 -1 -1 -1
a(b+|((c)*))+d abcd 0 4 2 3 2 3 2 3
- match_default normal REG_EXTENDED REG_STARTEND REG_NOSPEC literal
\**?/{} \\**?/{} 0 7
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST ; we disable POSIX testing because it can't handle escapes in sets
; try to match C++ syntax elements:
; line comment:
//[^\n]* "++i //here is a line comment\n" 4 28
; block comment:
/\*([^*]|\*+[^*/])*\*+/ "/* here is a block comment */" 0 29 26 27
/\*([^*]|\*+[^*/])*\*+/ "/**/" 0 4 -1 -1
/\*([^*]|\*+[^*/])*\*+/ "/***/" 0 5 -1 -1
/\*([^*]|\*+[^*/])*\*+/ "/****/" 0 6 -1 -1
/\*([^*]|\*+[^*/])*\*+/ "/*****/" 0 7 -1 -1
/\*([^*]|\*+[^*/])*\*+/ "/*****/*/" 0 7 -1 -1
; preprossor directives:
^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol" 0 19 -1 -1
^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) #x" 0 25 -1 -1
^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);" 0 53 28 42
; literals:
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFF 0 4 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 35 0 2 0 2 -1 -1 0 2 -1 -1 -1 -1 -1 -1
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFu 0 5 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFL 0 5 0 4 0 4 -1 -1 4 5 -1 -1 -1 -1
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFFFFFFFFFFFFFFFuint64 0 24 0 18 0 18 -1 -1 19 24 19 24 22 24
; strings:
'([^\\']|\\.)*' '\\x3A' 0 6 4 5
'([^\\']|\\.)*' '\\'' 0 4 1 3
'([^\\']|\\.)*' '\\n' 0 4 1 3
; now try and test some unicode specific characters:
- match_default normal REG_EXTENDED REG_UNICODE_ONLY
[[:unicode:]]+ a\0300\0400z 1 3
; finally try some case insensitive matches:
- match_default normal REG_EXTENDED REG_ICASE
; upper and lower have no meaning here so they fail, however these
; may compile with other libraries...
;[[:lower:]] !
;[[:upper:]] !
0123456789@abcdefghijklmnopqrstuvwxyz\[\\\]\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\{\|\} 0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\} 0 72
; known and suspected bugs:
- match_default normal REG_EXTENDED
\( ( 0 1
\) ) 0 1
\$ $ 0 1
\^ ^ 0 1
\. . 0 1
\* * 0 1
\+ + 0 1
\? ? 0 1
\[ [ 0 1
\] ] 0 1
\| | 0 1
\\ \\ 0 1
# # 0 1
\# # 0 1
a- a- 0 2
\- - 0 1
\{ { 0 1
\} } 0 1
0 0 0 1
1 1 0 1
9 9 0 1
b b 0 1
B B 0 1
< < 0 1
> > 0 1
w w 0 1
W W 0 1
` ` 0 1
' ' 0 1
\n \n 0 1
, , 0 1
a a 0 1
f f 0 1
n n 0 1
r r 0 1
t t 0 1
v v 0 1
c c 0 1
x x 0 1
: : 0 1
(\.[[:alnum:]]+){2} "w.a.b " 1 5 3 5
- match_default normal REG_EXTENDED REG_ICASE
a A 0 1
A a 0 1
[abc]+ abcABC 0 6
[ABC]+ abcABC 0 6
[a-z]+ abcABC 0 6
[A-Z]+ abzANZ 0 6
[a-Z]+ abzABZ 0 6
[A-z]+ abzABZ 0 6
[[:lower:]]+ abyzABYZ 0 8
[[:upper:]]+ abzABZ 0 6
[[:word:]]+ abcZZZ 0 6
[[:alpha:]]+ abyzABYZ 0 8
[[:alnum:]]+ 09abyzABYZ 0 10
; updated tests for version 2:
- match_default normal REG_EXTENDED
\x41 A 0 1
\xff \255 0 1
\xFF \255 0 1
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST
\c@ \0 0 1
- match_default normal REG_EXTENDED
\cA \1 0 1
\cz \58 0 1
\c= !
\c? !
=: =: 0 2
; word start:
[[:<:]]abcd " abcd" 2 6
[[:<:]]ab cab -1 -1
[[:<:]]ab "\nab" 1 3
[[:<:]]tag ::tag 2 5
;word end:
abc[[:>:]] abc 0 3
abc[[:>:]] abcd -1 -1
abc[[:>:]] abc\n 0 3
abc[[:>:]] abc:: 0 3
; collating elements and rewritten set code:
- match_default normal REG_EXTENDED REG_STARTEND
[[.zero.]] 0 0 1
[[.one.]] 1 0 1
[[.two.]] 2 0 1
[[.three.]] 3 0 1
[[.a.]] baa 1 2
[[.right-curly-bracket.]] } 0 1
[[.NUL.]] \0 0 1
[[:<:]z] !
[a[:>:]] !
[[=a=]] a 0 1
[[=right-curly-bracket=]] } 0 1
- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE
[[.A.]] A 0 1
[[.A.]] a 0 1
[[.A.]-b]+ AaBb 0 4
[A-[.b.]]+ AaBb 0 4
[[.a.]-B]+ AaBb 0 4
[a-[.B.]]+ AaBb 0 4
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST
[\x61] a 0 1
[\x61-c]+ abcd 0 3
[a-\x63]+ abcd 0 3
- match_default normal REG_EXTENDED REG_STARTEND
[[.a.]-c]+ abcd 0 3
[a-[.c.]]+ abcd 0 3
[[:alpha:]-a] !
[a-[:alpha:]] !
; try mutli-character ligatures:
[[.ae.]] ae 0 2
[[.ae.]] aE -1 -1
[[.AE.]] AE 0 2
[[.Ae.]] Ae 0 2
[[.ae.]-b] a -1 -1
[[.ae.]-b] b 0 1
[[.ae.]-b] ae 0 2
[a-[.ae.]] a 0 1
[a-[.ae.]] b -1 -1
[a-[.ae.]] ae 0 2
- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE
[[.ae.]] AE 0 2
[[.ae.]] Ae 0 2
[[.AE.]] Ae 0 2
[[.Ae.]] aE 0 2
[[.AE.]-B] a -1 -1
[[.Ae.]-b] b 0 1
[[.Ae.]-b] B 0 1
[[.ae.]-b] AE 0 2
- match_default normal REG_EXTENDED REG_STARTEND
;extended perl style escape sequences:
\e \27 0 1
\x1b \27 0 1
\x{1b} \27 0 1
\x{} !
\x{ !
\x} !
\x !
\x{yy !
\x{1b !
- match_default normal REG_EXTENDED REG_STARTEND REG_NO_POSIX_TEST
\l+ ABabcAB 2 5
[\l]+ ABabcAB 2 5
[a-\l] !
[\l-a] !
[\L] !
\L+ abABCab 2 5
\u+ abABCab 2 5
[\u]+ abABCab 2 5
[\U] !
\U+ ABabcAB 2 5
\d+ ab012ab 2 5
[\d]+ ab012ab 2 5
[\D] !
\D+ 01abc01 2 5
\s+ "ab ab" 2 5
[\s]+ "ab ab" 2 5
[\S] !
\S+ " abc " 2 5
- match_default normal REG_EXTENDED REG_STARTEND
\Qabc !
\Qabc\E abcd 0 3
\Qabc\Ed abcde 0 4
\Q+*?\\E +*?\\ 0 4
\C+ abcde 0 5
\X+ abcde 0 5
- match_default normal REG_EXTENDED REG_STARTEND REG_UNICODE_ONLY
\X+ a\768\769 0 3
\X+ \2309\2307 0 2 ;DEVANAGARI script
\X+ \2489\2494 0 2 ;BENGALI script
- match_default normal REG_EXTENDED REG_STARTEND
\Aabc abc 0 3
\Aabc aabc -1 -1
abc\z abc 0 3
abc\z abcd -1 -1
abc\Z abc\n\n 0 3
abc\Z abc 0 3
\Gabc abc 0 3
\Gabc dabcd -1 -1
a\Gbc abc -1 -1
a\Aab abc -1 -1
;
; now test grep,
; basically check all our restart types - line, word, etc
; checking each one for null and non-null matches.
;
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP
a " a a a aa" 1 2 3 4 5 6 7 8 8 9
a+b+ "aabaabbb ab" 0 3 3 8 9 11
a(b*|c|e)d adabbdacd 0 2 2 6 6 9
a "\na\na\na\naa" 1 2 3 4 5 6 7 8 8 9
^ " \n\n \n\n\n" 0 0 4 4 5 5 8 8 9 9 10 10
^ab "ab \nab ab\n" 0 2 5 7
^[^\n]*\n " \n \n\n \n" 0 4 4 7 7 8 8 11
\<abc "abcabc abc\n\nabc" 0 3 7 10 12 15
\< " ab a aaa " 2 2 5 5 7 7
\<\w+\W+ " aa aa a " 1 5 5 9 9 11
\Aabc "abc abc" 0 3
\G\w+\W+ "abc abc a cbbb " 0 5 5 9 9 11 11 18
\Ga+b+ "aaababb abb" 0 4 4 7
abc abc 0 3
abc " abc abcabc " 1 4 5 8 8 11
\n\n " \n\n\n \n \n\n\n\n " 1 3 18 20 20 22
$ " \n\n \n\n\n" 3 3 4 4 7 7 8 8 9 9 10 10
\b " abb a abbb " 2 2 5 5 6 6 7 7 8 8 12 12
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP REG_ICASE
A " a a a aa" 1 2 3 4 5 6 7 8 8 9
A+B+ "aabaabbb ab" 0 3 3 8 9 11
A(B*|c|e)D adabbdacd 0 2 2 6 6 9
A "\na\na\na\naa" 1 2 3 4 5 6 7 8 8 9
^aB "Ab \nab Ab\n" 0 2 5 7
\<abc "Abcabc aBc\n\nabc" 0 3 7 10 12 15
ABC abc 0 3
abc " ABC ABCABC " 1 4 5 8 8 11
;
; now test merge,
;
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE format_no_copy
; start by testing subs:
a+ "...aaa,,," $` "..."
a+ "...aaa,,," $' ",,,"
a+ "...aaa,,," $& "aaa"
a+ "...aaa,,," $0 aaa
a+ "...aaa,,," $1 ""
a+ "...aaa,,," $15 ""
(a+)b+ "...aaabbb,,," $1 aaa
; and now escapes:
a+ "...aaa,,," $x "$x"
a+ "...aaa,,," \a "\a"
a+ "...aaa,,," \f "\f"
a+ "...aaa,,," \n "\n"
a+ "...aaa,,," \r "\r"
a+ "...aaa,,," \t "\t"
a+ "...aaa,,," \v "\v"
a+ "...aaa,,," \x21 "!"
a+ "...aaa,,," \x{21} "!"
a+ "...aaa,,," \c@ \0
a+ "...aaa,,," \e \27
a+ "...aaa,,," \0101 A
a+ "...aaa,,," (\0101) A
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE format_sed format_no_copy
(a+)(b+) ...aabb,, \0 aabb
(a+)(b+) ...aabb,, \1 aa
(a+)(b+) ...aabb,, \2 bb
(a+)(b+) ...aabb,, & aabb
(a+)(b+) ...aabb,, $ $
(a+)(b+) ...aabb,, $1 $1
(a+)(b+) ...aabb,, ()?: ()?:
(a+)(b+) ...aabb,, \\ \\
(a+)(b+) ...aabb,, \& &
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE format_perl format_no_copy
(a+)(b+) ...aabb,, $0 aabb
(a+)(b+) ...aabb,, $1 aa
(a+)(b+) ...aabb,, $2 bb
(a+)(b+) ...aabb,, $& aabb
(a+)(b+) ...aabb,, & &
(a+)(b+) ...aabb,, \0 \0
(a+)(b+) ...aabb,, ()?: ()?:
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE
; move to copying unmatched data:
a+ "...aaa,,," bbb "...bbb,,,"
a+(b+) "...aaabb,,," $1 "...bb,,,"
a+(b+) "...aaabb,,,ab*abbb?" $1 "...bb,,,b*bbb?"
(a+)|(b+) "...aaabb,,,ab*abbb?" (?1A)(?2B) "...AB,,,AB*AB?"
(a+)|(b+) "...aaabb,,,ab*abbb?" ?1A:B "...AB,,,AB*AB?"
(a+)|(b+) "...aaabb,,,ab*abbb?" (?1A:B)C "...ACBC,,,ACBC*ACBC?"
(a+)|(b+) "...aaabb,,,ab*abbb?" ?1:B "...B,,,B*B?"
;
; changes to newline handling with 2.11:
;
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP
^. " \n \r\n " 0 1 3 4 7 8
.$ " \n \r\n " 1 2 4 5 8 9
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP REG_UNICODE_ONLY
^. " \8232 \8233 " 0 1 3 4 5 6
.$ " \8232 \8233 " 1 2 3 4 6 7
;
; non-greedy repeats added 21/04/00
- match_default normal REG_EXTENDED
a** !
a*? aa 0 0
a?? aa 0 0
a++ !
a+? aa 0 1
a{1,3}{1} !
a{1,3}? aaa 0 1
\w+?w ...ccccccwcccccw 3 10
\W+\w+?w ...ccccccwcccccw 0 10
abc|\w+? abd 0 1
abc|\w+? abcd 0 3
<\s*tag[^>]*>(.*?)<\s*/tag\s*> " <tag>here is some text</tag> <tag></tag>" 1 29 6 23
<\s*tag[^>]*>(.*?)<\s*/tag\s*> " < tag attr=\"something\">here is some text< /tag > <tag></tag>" 1 49 24 41
;
; non-marking parenthesis added 25/04/00
- match_default normal REG_EXTENDED
(?:abc)+ xxabcabcxx 2 8
(?:a+)(b+) xaaabbbx 1 7 4 7
(a+)(?:b+) xaaabbba 1 7 1 4
(?:(a+)b+) xaaabbba 1 7 1 4
(?:a+(b+)) xaaabbba 1 7 4 7
a+(?#b+)b+ xaaabbba 1 7

View File

@ -0,0 +1,125 @@
# very basic makefile for regression tests
#
# Visual C++ 6 + full stlport 4.x
#
# we don't test single threaded builds as stlport doesn't support these...
#
CFLAGS= -O2 -GX -GR -I..\..\..\..\
LFLAGS= -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
all :: r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1md.exe r2md.exe r3md.exe r4md.exe r5md.exe r6md.exe r1lmd.exe r2lmd.exe r3lmd.exe r4lmd.exe r5lmd.exe r6lmd.exe
echo testing static multi-threaded version....
r1m tests.txt test1252.txt
r2m tests.txt
r3m tests.txt
r4m tests.txt test1252.txt
r5m tests.txt
r6m tests.txt
echo testing DLL version....
r1l tests.txt test1252.txt
r2l tests.txt
r3l tests.txt
r4l tests.txt test1252.txt
r5l tests.txt
r6l tests.txt
echo testing static multi-threaded debug version....
r1md tests.txt test1252.txt
r2md tests.txt
r3md tests.txt
r4md tests.txt test1252.txt
r5md tests.txt
r6md tests.txt
echo testing dll debug version....
r1lmd tests.txt test1252.txt
r2lmd tests.txt
r3lmd tests.txt
r4lmd tests.txt test1252.txt
r5lmd tests.txt
r6lmd tests.txt
r1m.exe : r1.cpp
cl /MT /D_MT -o r1m.exe $(CFLAGS) r1.cpp $(LFLAGS)
r2m.exe : r2.cpp
cl /MT /D_MT $(CFLAGS) -o r2m.exe r2.cpp $(LFLAGS)
r3m.exe : r3.cpp
cl /MT /D_MT $(CFLAGS) -o r3m.exe r3.cpp $(LFLAGS)
r4m.exe : r4.cpp
cl /MT /D_MT $(CFLAGS) -o r4m.exe r4.cpp $(LFLAGS)
r5m.exe : r5.cpp
cl /MT /D_MT $(CFLAGS) -o r5m.exe r5.cpp $(LFLAGS)
r6m.exe : r6.cpp
cl /MT /D_MT $(CFLAGS) -o r6m.exe r6.cpp $(LFLAGS)
r1l.exe : r1.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r1l.exe r1.cpp $(LFLAGS)
r2l.exe : r2.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r2l.exe r2.cpp $(LFLAGS)
r3l.exe : r3.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r3l.exe r3.cpp $(LFLAGS)
r4l.exe : r4.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r4l.exe r4.cpp $(LFLAGS)
r5l.exe : r5.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r5l.exe r5.cpp $(LFLAGS)
r6l.exe : r6.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r6l.exe r6.cpp $(LFLAGS)
r1md.exe : r1.cpp
cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r1md.exe r1.cpp $(LFLAGS)
r2md.exe : r2.cpp
cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r2md.exe r2.cpp $(LFLAGS)
r3md.exe : r3.cpp
cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r3md.exe r3.cpp $(LFLAGS)
r4md.exe : r4.cpp
cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r4md.exe r4.cpp $(LFLAGS)
r5md.exe : r5.cpp
cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r5md.exe r5.cpp $(LFLAGS)
r6md.exe : r6.cpp
cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r6md.exe r6.cpp $(LFLAGS)
r1lmd.exe : r1.cpp
cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r1lmd.exe r1.cpp $(LFLAGS)
r2lmd.exe : r2.cpp
cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r2lmd.exe r2.cpp $(LFLAGS)
r3lmd.exe : r3.cpp
cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r3lmd.exe r3.cpp $(LFLAGS)
r4lmd.exe : r4.cpp
cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r4lmd.exe r4.cpp $(LFLAGS)
r5lmd.exe : r5.cpp
cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r5lmd.exe r5.cpp $(LFLAGS)
r6lmd.exe : r6.cpp
cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r6lmd.exe r6.cpp $(LFLAGS)

173
demo/regress/vc6.mak Normal file
View File

@ -0,0 +1,173 @@
# very basic makefile for regression tests
#
# Visual C++ 6
#
CFLAGS= -O2 -GX -GR -I..\..\..\..\
LFLAGS= -link /LIBPATH:..\..\lib\vc6 user32.lib
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1d.exe r2d.exe r3d.exe r4d.exe r5d.exe r6d.exe r1md.exe r2md.exe r3md.exe r4md.exe r5md.exe r6md.exe r1lmd.exe r2lmd.exe r3lmd.exe r4lmd.exe r5lmd.exe r6lmd.exe
echo testing static single threaded version....
r1 tests.txt test1252.txt
r2 tests.txt
r3 tests.txt
r4 tests.txt test1252.txt
r5 tests.txt
r6 tests.txt
echo testing static multi-threaded version....
r1m tests.txt test1252.txt
r2m tests.txt
r3m tests.txt
r4m tests.txt test1252.txt
r5m tests.txt
r6m tests.txt
echo testing DLL version....
r1l tests.txt test1252.txt
r2l tests.txt
r3l tests.txt
r4l tests.txt test1252.txt
r5l tests.txt
r6l tests.txt
echo testing static single threaded debug version....
r1d tests.txt test1252.txt
r2d tests.txt
r3d tests.txt
r4d tests.txt test1252.txt
r5d tests.txt
r6d tests.txt
echo testing static multi-threaded debug version....
r1md tests.txt test1252.txt
r2md tests.txt
r3md tests.txt
r4md tests.txt test1252.txt
r5md tests.txt
r6md tests.txt
echo testing dll debug version....
r1lmd tests.txt test1252.txt
r2lmd tests.txt
r3lmd tests.txt
r4lmd tests.txt test1252.txt
r5lmd tests.txt
r6lmd tests.txt
r1.exe : r1.cpp
cl /ML $(CFLAGS) r1.cpp $(LFLAGS)
r2.exe : r2.cpp
cl /ML $(CFLAGS) r2.cpp $(LFLAGS)
r3.exe : r3.cpp
cl /ML $(CFLAGS) r3.cpp $(LFLAGS)
r4.exe : r4.cpp
cl /ML $(CFLAGS) r4.cpp $(LFLAGS)
r5.exe : r5.cpp
cl /ML $(CFLAGS) r5.cpp $(LFLAGS)
r6.exe : r6.cpp
cl /ML $(CFLAGS) r6.cpp $(LFLAGS)
r1m.exe : r1.cpp
cl /MT /D_MT -o r1m.exe $(CFLAGS) r1.cpp $(LFLAGS)
r2m.exe : r2.cpp
cl /MT /D_MT $(CFLAGS) -o r2m.exe r2.cpp $(LFLAGS)
r3m.exe : r3.cpp
cl /MT /D_MT $(CFLAGS) -o r3m.exe r3.cpp $(LFLAGS)
r4m.exe : r4.cpp
cl /MT /D_MT $(CFLAGS) -o r4m.exe r4.cpp $(LFLAGS)
r5m.exe : r5.cpp
cl /MT /D_MT $(CFLAGS) -o r5m.exe r5.cpp $(LFLAGS)
r6m.exe : r6.cpp
cl /MT /D_MT $(CFLAGS) -o r6m.exe r6.cpp $(LFLAGS)
r1l.exe : r1.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r1l.exe r1.cpp $(LFLAGS)
r2l.exe : r2.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r2l.exe r2.cpp $(LFLAGS)
r3l.exe : r3.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r3l.exe r3.cpp $(LFLAGS)
r4l.exe : r4.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r4l.exe r4.cpp $(LFLAGS)
r5l.exe : r5.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r5l.exe r5.cpp $(LFLAGS)
r6l.exe : r6.cpp
cl /MD /D_MT /D_DLL $(CFLAGS) -o r6l.exe r6.cpp $(LFLAGS)
r1d.exe : r1.cpp
cl /MLd $(CFLAGS) -o r1d.exe r1.cpp $(LFLAGS)
r2d.exe : r2.cpp
cl /MLd $(CFLAGS) -o r2d.exe r2.cpp $(LFLAGS)
r3d.exe : r3.cpp
cl /MLd $(CFLAGS) -o r3d.exe r3.cpp $(LFLAGS)
r4d.exe : r4.cpp
cl /MLd $(CFLAGS) -o r4d.exe r4.cpp $(LFLAGS)
r5d.exe : r5.cpp
cl /MLd $(CFLAGS) -o r5d.exe r5.cpp $(LFLAGS)
r6d.exe : r6.cpp
cl /MLd $(CFLAGS) -o r6d.exe r6.cpp $(LFLAGS)
r1md.exe : r1.cpp
cl /MTd /D_MT $(CFLAGS) -o r1md.exe r1.cpp $(LFLAGS)
r2md.exe : r2.cpp
cl /MTd /D_MT $(CFLAGS) -o r2md.exe r2.cpp $(LFLAGS)
r3md.exe : r3.cpp
cl /MTd /D_MT $(CFLAGS) -o r3md.exe r3.cpp $(LFLAGS)
r4md.exe : r4.cpp
cl /MTd /D_MT $(CFLAGS) -o r4md.exe r4.cpp $(LFLAGS)
r5md.exe : r5.cpp
cl /MTd /D_MT $(CFLAGS) -o r5md.exe r5.cpp $(LFLAGS)
r6md.exe : r6.cpp
cl /MTd /D_MT $(CFLAGS) -o r6md.exe r6.cpp $(LFLAGS)
r1lmd.exe : r1.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r1lmd.exe r1.cpp $(LFLAGS)
r2lmd.exe : r2.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r2lmd.exe r2.cpp $(LFLAGS)
r3lmd.exe : r3.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r3lmd.exe r3.cpp $(LFLAGS)
r4lmd.exe : r4.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r4lmd.exe r4.cpp $(LFLAGS)
r5lmd.exe : r5.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r5lmd.exe r5.cpp $(LFLAGS)
r6lmd.exe : r6.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmd.exe r6.cpp $(LFLAGS)