Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,13 @@ jobs:
if [ "$out" != "$want" ]; then
echo "FAIL(stdin blank line): stdout was:"; echo "$out"; exit 1
fi
# A UTF-8 BOM ahead of the first path, as a .NET or PowerShell caller
# on Windows writes, used to make the first input "no such input file".
out=$( { printf '\xEF\xBB\xBF'; printf '%s\n' a.txt b.txt c.txt; } | ./bin/nlp -ANA "$FIX" -WORK ./ -STDIN | tr -d '\r')
want=$(printf '%s\n' "first=1 last=0 dir=1 n=1" "first=0 last=0 dir=1 n=2" "first=0 last=1 dir=1 n=3")
if [ "$out" != "$want" ]; then
echo "FAIL(stdin BOM): stdout was:"; echo "$out"; exit 1
fi
echo "[stdin] one load, KB carried across inputs, last-file flag set at end of stream"

- name: Non-ASCII punctuation in rules (#467) (Non-20.04)
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,13 @@ jobs:
if [ "$out" != "$want" ]; then
echo "FAIL(stdin blank line): stdout was:"; echo "$out"; exit 1
fi
# A UTF-8 BOM ahead of the first path, as a .NET or PowerShell caller
# on Windows writes, used to make the first input "no such input file".
out=$( { printf '\xEF\xBB\xBF'; printf '%s\n' a.txt b.txt c.txt; } | ./bin/Release/nlp.exe -ANA "$FIX" -WORK ./ -STDIN | tr -d '\r')
want=$(printf '%s\n' "first=1 last=0 dir=1 n=1" "first=0 last=0 dir=1 n=2" "first=0 last=1 dir=1 n=3")
if [ "$out" != "$want" ]; then
echo "FAIL(stdin BOM): stdout was:"; echo "$out"; exit 1
fi
echo "[stdin] one load, KB carried across inputs, last-file flag set at end of stream"

- name: Non-ASCII punctuation in rules (#467)
Expand Down
6 changes: 6 additions & 0 deletions lite/nlp_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,13 @@ int NLP_ENGINE::analyzeStream(
const char *space = " \t\r\n";
std::string line, held;
long count = 0;
bool first = true;
while (std::getline(in, line)) {
// A .NET or PowerShell caller on Windows writes a UTF-8 BOM ahead of
// the first line, which made the first path "no such input file".
if (first && line.compare(0, 3, "\xEF\xBB\xBF") == 0)
line.erase(0, 3);
first = false;
size_t beg = line.find_first_not_of(space);
if (beg == std::string::npos)
break; // A blank line ends the stream, like EOF.
Expand Down
2 changes: 1 addition & 1 deletion nlp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All rights reserved.
#include "lite/nlp_engine.h"
#include "version.h"

#define NLP_ENGINE_VERSION "4.2.45"
#define NLP_ENGINE_VERSION "4.2.46"

bool cmdReadArgs(int, _TCHAR *argv[], _TCHAR *&, _TCHAR *&, _TCHAR *&, _TCHAR *&, bool &, bool &, bool &, bool &, bool &, bool &, int &, bool &, bool &, _TCHAR *&, double &);
void cmdHelpargs(_TCHAR *);
Expand Down
Loading