Skip to content

Commit

Permalink
switch to use external REPP. Delete boost escape function from utilit…
Browse files Browse the repository at this point in the history
…y, since it

is included in REPP.


git-svn-id: https://pet.opendfki.de/repos/pet/main@929 4200e16c-5112-0410-ac55-d7fb557a720a
  • Loading branch information
rebecca.dridan committed Sep 15, 2014
1 parent d0d53e5 commit edd43de
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 48 deletions.
6 changes: 4 additions & 2 deletions cheap/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif
include $(top_srcdir)/common/Makefile.common

# Add cheap-specific CPPFLAGS/CXXFLAGS/LDFLAGS/LIBS as determined by configure
CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/fspp @CHEAPCPPFLAGS@
CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/fspp -I$(top_srcdir)/repp @CHEAPCPPFLAGS@
CXXFLAGS += @CHEAPCXXFLAGS@
LDFLAGS += @CHEAPLDFLAGS@
LIBS += @CHEAPLIBS@
Expand Down Expand Up @@ -82,7 +82,9 @@ cheaplibsources = \
vpm.h vpm.cpp \
pcfg.h pcfg.cpp \
yy-tokenizer.cpp yy-tokenizer.h \
repp.cpp repp.h \
$(top_srcdir)/repp/repp.cpp $(top_srcdir)/repp/repp.h \
$(top_srcdir)/repp/tdl_options.cpp $(top_srcdir)/repp/tdl_options.h \
$(top_srcdir)/repp/repp_from_pet.cpp $(top_srcdir)/repp/repp_from_pet.h \
tagger.cpp tagger.h \
$(top_srcdir)/common/bitcode.cpp \
$(top_srcdir)/common/chunk-alloc.cpp \
Expand Down
11 changes: 10 additions & 1 deletion cheap/cheap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "yy-tokenizer.h"
#ifdef HAVE_BOOST_REGEX_ICU_HPP
#include "repp.h"
#include "repp_from_pet.h"
#endif
#include "tagger.h"
#include "lingo-tokenizer.h"
Expand Down Expand Up @@ -647,7 +648,15 @@ bool load_grammar(string initial_name) {
case TOKENIZER_REPP:
#ifdef HAVE_BOOST_REGEX_ICU_HPP
{
tok = new tReppTokenizer();
string name = get_opt_string("opt_repp");
settings *reppsettings;
if(!name.empty()) {
reppsettings = new settings(name, cheap_settings->base(), "reading");
if(!reppsettings->valid())
throw tError("Unable to read REPP configuration '" + name + "'.");
cheap_settings->install(reppsettings);
}
tok = createReppTokenizer(cheap_settings);
}
break;
#else
Expand Down
38 changes: 0 additions & 38 deletions common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,41 +509,3 @@ socket_readline(int socket, char *string, int length, bool ffp) {

} /* socket_readline() */

#ifndef FLOP
#ifdef HAVE_BOOST_REGEX_ICU_HPP
/* escape literal braces in regex before giving it to Boost, since Boost::Regex
* is not completely pcre compatible
*/
string boostescape(string esc)
{
boost::smatch res;
boost::u32regex quantifier
= boost::make_u32regex("^([{](?:[0-9]+(?:,[0-9]*)?)[}])");
int len = esc.length();
for (int x=0; x < len; ++x) {
if (esc.at(x) == '{') {
if (x > 0 && esc.at(x-1) == '\\')
continue; //already escaped, keep going
if (x > 1 && esc.at(x-2) == '\\' && isalpha(esc.at(x-1))) {
//probably the start of a backslash seq. find and skip past the
//closing brace. If not a backslash seq, ambiguous - let boost complain
while (x < len && esc.at(x) != '}')
x++;
} else if (boost::u32regex_search(esc.substr(x), res, quantifier)) {
//quantifier, skip past closing brace
x += string(res[0]).length()-1;
} else {
esc.replace(x,1, "\\{", 2);
x++;
len++;
}
} else if (esc.at(x) == '}') {
esc.replace(x,1, "\\}", 2);
x++;
len++;
}
}
return esc;
}
#endif
#endif
7 changes: 0 additions & 7 deletions common/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,4 @@ int socket_readline(int, char *, int, bool = false);
void print_borland_heap(FILE *f);
#endif

#ifndef FLOP
#ifdef HAVE_BOOST_REGEX_ICU_HPP
/* work around pcre incompatibility in Boost::Regex */
std::string boostescape(std::string esc);
#endif
#endif

#endif

0 comments on commit edd43de

Please sign in to comment.