Skip to content

Commit

Permalink
add <f/> as dictionary symbol for reading separator </> for lsx pgen
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-martian committed Mar 1, 2024
1 parent 37c717f commit 17251f6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ(2.52)

m4_define([PKG_VERSION_MAJOR], [3])
m4_define([PKG_VERSION_MINOR], [7])
m4_define([PKG_VERSION_PATCH], [7])
m4_define([PKG_VERSION_PATCH], [8])

# Bump if the ABI (not API) changed in a backwards-incompatible manner
m4_define([PKG_VERSION_ABI], [3])
Expand Down
6 changes: 6 additions & 0 deletions lttoolbox/compiler.cc
Expand Up @@ -385,6 +385,10 @@ Compiler::readString(std::vector<int> &result, UStringView name)
result.push_back(word_boundary);
}
}
else if (is_separable && name == COMPILER_LSX_FORM_SEP_ELEM) {
requireEmptyError(name);
result.push_back(reading_boundary);
}
else
{
std::cerr << "Error (" << xmlTextReaderGetParserLineNumber(reader);
Expand Down Expand Up @@ -966,11 +970,13 @@ Compiler::procNode()
alphabet.includeSymbol(Transducer::LSX_BOUNDARY_SYMBOL);
alphabet.includeSymbol(Transducer::LSX_BOUNDARY_SPACE_SYMBOL);
alphabet.includeSymbol(Transducer::LSX_BOUNDARY_NO_SPACE_SYMBOL);
alphabet.includeSymbol(Transducer::READING_SEPARATOR_SYMBOL);
any_tag = alphabet(Transducer::ANY_TAG_SYMBOL);
any_char = alphabet(Transducer::ANY_CHAR_SYMBOL);
word_boundary = alphabet(Transducer::LSX_BOUNDARY_SYMBOL);
word_boundary_s = alphabet(Transducer::LSX_BOUNDARY_SPACE_SYMBOL);
word_boundary_ns = alphabet(Transducer::LSX_BOUNDARY_NO_SPACE_SYMBOL);
reading_boundary = alphabet(Transducer::READING_SEPARATOR_SYMBOL);
}
}
else if(name == COMPILER_ALPHABET_ELEM)
Expand Down
2 changes: 2 additions & 0 deletions lttoolbox/compiler.h
Expand Up @@ -176,6 +176,7 @@ class Compiler
int32_t word_boundary = 0;
int32_t word_boundary_s = 0;
int32_t word_boundary_ns = 0;
int32_t reading_boundary = 0;

/**
* Method to parse an XML Node
Expand Down Expand Up @@ -354,6 +355,7 @@ class Compiler
static constexpr UStringView COMPILER_LSX_WB_ELEM = u"d";
static constexpr UStringView COMPILER_LSX_CHAR_ELEM = u"w";
static constexpr UStringView COMPILER_LSX_TAG_ELEM = u"t";
static constexpr UStringView COMPILER_LSX_FORM_SEP_ELEM = u"f";
static constexpr UStringView COMPILER_LSX_SPACE_ATTR = u"space";
static constexpr UStringView COMPILER_LSX_SPACE_YES_VAL = u"yes";
static constexpr UStringView COMPILER_LSX_SPACE_NO_VAL = u"no";
Expand Down
3 changes: 3 additions & 0 deletions lttoolbox/dix.dtd
Expand Up @@ -171,3 +171,6 @@

<!ELEMENT w EMPTY>
<!-- w: any word character -->

<!ELEMENT f EMPTY>
<!-- f: form/reading separator -->
1 change: 1 addition & 0 deletions lttoolbox/transducer.h
Expand Up @@ -99,6 +99,7 @@ class Transducer
static constexpr UStringView LSX_BOUNDARY_SYMBOL = u"<$>";
static constexpr UStringView LSX_BOUNDARY_SPACE_SYMBOL = u"<$_>";
static constexpr UStringView LSX_BOUNDARY_NO_SPACE_SYMBOL= u"<$->";
static constexpr UStringView READING_SEPARATOR_SYMBOL = u"</>";
static constexpr UStringView COMPOUND_ONLY_L_SYMBOL = u"<compound-only-L>";
static constexpr UStringView COMPOUND_R_SYMBOL = u"<compound-R>";

Expand Down

0 comments on commit 17251f6

Please sign in to comment.