Skip to content

Commit

Permalink
add option to always print reading IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-martian committed Sep 17, 2024
1 parent 5ec1b51 commit fd8ebfd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/GrammarApplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void GrammarApplicator::printReading(const Reading* reading, std::ostream& outpu
}
}

if (reading->parent->type & CT_RELATED) {
if (print_ids || reading->parent->type & CT_RELATED) {
u_fprintf(output, " ID:%u", reading->parent->global_number);
if (!reading->parent->relations.empty()) {
for (const auto& miter : reading->parent->relations) {
Expand Down
1 change: 1 addition & 0 deletions src/GrammarApplicator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class GrammarApplicator {
bool split_mappings = false;
bool pipe_deleted = false;
bool add_spacing = true;
bool print_ids = false;

bool dep_has_spanned = false;
uint32_t dep_delimit = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ void GAppSetOpts(GrammarApplicator& applicator, UConverter* conv) {
}
std::cerr << "Debug level set to " << applicator.debug_level << std::endl;
}
if (options[PRINT_IDS].doesOccur) {
applicator.print_ids = true;
}
if (options[NUM_WINDOWS].doesOccur) {
applicator.num_windows = std::stoul(options[NUM_WINDOWS].value);
}
Expand Down
2 changes: 2 additions & 0 deletions src/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ enum OPTIONS {
MAPPING_PREFIX,
UNICODE_TAGS,
UNIQUE_TAGS,
PRINT_IDS,
NUM_WINDOWS,
ALWAYS_SPAN,
SOFT_LIMIT,
Expand Down Expand Up @@ -143,6 +144,7 @@ std::array<UOption,NUM_OPTIONS> options{
UOption{"prefix", 'p', UOPT_REQUIRES_ARG, "sets the mapping prefix; defaults to @"},
UOption{"unicode-tags", 0, UOPT_NO_ARG, "outputs Unicode code points for things like ->"},
UOption{"unique-tags", 0, UOPT_NO_ARG, "outputs unique tags only once per reading"},
UOption{"print-ids", 0, UOPT_NO_ARG, "always output IDs"},

UOption{"num-windows", 0, UOPT_REQUIRES_ARG, "number of windows to keep in before/ahead buffers; defaults to 2"},
UOption{"always-span", 0, UOPT_NO_ARG, "forces scanning tests to always span across window boundaries"},
Expand Down

0 comments on commit fd8ebfd

Please sign in to comment.