Comments (2)
Yes I saw that too when running with Valgrind. I'd dismissed it as user error as it went away as soon as I'd re-fetched from the server.
from camcops.
It seems fine in the debugger. But under Memcheck, the regular expression is not being parsed consistently.
With a debugging insert:
void IdPolicy::tokenize(QString policy_text)
{
m_valid = true;
// Single line, whitespace trimmed, newlines/tabs etc. removed
policy_text = policy_text.simplified();
// QString::split() splits using the regex to match BOUNDARIES.
// Our regex matches CONTENT, so we use QRegularExpression functions.
// https://dangelog.wordpress.com/2012/04/07/qregularexpression/
const QRegularExpression re(TOKENIZE_RE_STR);
QRegularExpressionMatchIterator it = re.globalMatch(policy_text);
QStringList words;
while (it.hasNext()) {
const QRegularExpressionMatch match = it.next();
const QString word = match.captured(1);
words << word;
}
// Debugging under memcheck:
qWarning() << "... TOKENIZE_RE_STR = " << TOKENIZE_RE_STR;
qWarning() << "... policy_text = " << policy_text;
qWarning() << "... words = " << words;
for (const QString& word : words) {
const QString element = word.toLower();
const int token = nameToToken(element);
if (token == BAD_TOKEN) {
reportSyntaxError(QString("unknown word: %1").arg(word));
invalidate();
return;
}
m_tokens.append(token);
}
// check syntax:
AttributesType blank_attributes;
for (const QString& name : s_name_to_token.keys()) {
blank_attributes[name] = false;
}
if (idPolicyChunk(m_tokens, blank_attributes) == ChunkValue::SyntaxError) {
invalidate();
}
}
One run:
camcops[2314512]: 2024-06-26T15:55:17.828: warning: ../tablet_qt/lib/idpolicy.cpp(172): ... TOKENIZE_RE_STR = "\\s*(\\w+|\\(|\\))"
camcops[2314512]: 2024-06-26T15:55:17.829: warning: ../tablet_qt/lib/idpolicy.cpp(173): ... policy_text = "forename AND surname AND sex AND dob AND anyidnum"
camcops[2314512]: 2024-06-26T15:55:17.829: warning: ../tablet_qt/lib/idpolicy.cpp(174): ... words = QList("AND", "surname", "AND", "sex", "AND", "dob", "AND", "anyidnum")
camcops[2314512]: 2024-06-26T15:55:17.831: warning: ../tablet_qt/lib/idpolicy.cpp(237): Syntax error in policy ("chunk can't start with AND/OR/')'"); policy text is: "forename AND surname AND sex AND dob AND anyidnum"
Another:
camcops[2315554]: 2024-06-26T15:56:26.417: warning: ../tablet_qt/lib/idpolicy.cpp(172): ... TOKENIZE_RE_STR = "\\s*(\\w+|\\(|\\))"
camcops[2315554]: 2024-06-26T15:56:26.417: warning: ../tablet_qt/lib/idpolicy.cpp(173): ... policy_text = "forename AND surname AND sex AND dob AND anyidnum"
camcops[2315554]: 2024-06-26T15:56:26.417: warning: ../tablet_qt/lib/idpolicy.cpp(174): ... words = QList()
camcops[2315554]: 2024-06-26T15:56:26.420: warning: ../tablet_qt/lib/idpolicy.cpp(237): Syntax error in policy ("policy incomplete"); policy text is: "forename AND surname AND sex AND dob AND anyidnum"
??
from camcops.
Related Issues (20)
- Reminders or notifications for tasks in single-user mode HOT 1
- Add the name of the task schedule to the email or PDF
- Potential client icon distortion under Linux, sometimes HOT 1
- qhelpgenerator tool is not created by the Qt build script on Linux
- Android App Links broken HOT 7
- Make clearer how to obtain verbose output upon network error HOT 1
- BoxLayoutHfw for PySide6 HOT 6
- In single user mode the upload icon disappears when the network activity log is closed HOT 1
- EQ-5D-5L approval process (?site-specific) HOT 1
- The forgotten password workflow can end up going round in circles
- Patient reports no text on the new password dialog iPhone 14 HOT 2
- Incorrect questionnaires are being displayed during task chains HOT 3
- Impossible to enter a correct password, having followed the forgotten password workflow HOT 1
- Possible memory leak in Qt's QScroller
- It is possible to enter zero height in the BMI task HOT 3
- 2 patients with clashing ID numbers in single user mode HOT 1
- StrictDoubleValidator rejecting certain valid values HOT 2
- Debian 10 has reached end of life
- Allow a patient to opt out of completing a task
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camcops.