summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_error.cpp1
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_error.h1
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp36
3 files changed, 21 insertions, 17 deletions
diff --git a/xfa/src/fxfa/src/fm2js/xfa_error.cpp b/xfa/src/fxfa/src/fm2js/xfa_error.cpp
index fdeee363bb..03423b0673 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_error.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_error.cpp
@@ -11,6 +11,7 @@ static const FX_WCHAR* const gs_lpStrErrorMsgInfo[] = {
L"invalidate char '%c'", L"expected identifier instead of '%s'",
L"expected '%s' instead of '%s'", L"expected 'endif' instead of '%s'",
L"unexpected expression '%s'", L"expected operator '%s' instead of '%s'",
+ L"expected non-empty expression",
};
const FX_WCHAR* XFA_FM_ErrorMsg(XFA_FM_ERRMSG msg) {
diff --git a/xfa/src/fxfa/src/fm2js/xfa_error.h b/xfa/src/fxfa/src/fm2js/xfa_error.h
index 474b28b7c9..8907ad872f 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_error.h
+++ b/xfa/src/fxfa/src/fm2js/xfa_error.h
@@ -19,6 +19,7 @@ enum XFA_FM_ERRMSG {
FMERR_EXPECTED_IFEND,
FMERR_UNEXPECTED_EXPRESSION,
FMERR_EXPTECTED_OPERATOR,
+ FMERR_EXPECTED_NON_EMPTY_EXPRESSION,
FMERR_MAXIMUM
};
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp b/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp
index 6841cdaca5..bd2c206f03 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp
@@ -782,26 +782,28 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParseIndexExpression() {
}
CXFA_FMSimpleExpression* CXFA_FMParse::ParseParenExpression() {
- FX_DWORD line = m_pToken->m_uLinenum;
Check(TOKlparen);
- std::unique_ptr<CXFA_FMSimpleExpression> pExp1;
- if (m_pToken->m_type != TOKrparen) {
- pExp1.reset(ParseLogicalOrExpression());
- while (m_pToken->m_type == TOKassign) {
- NextToken();
- std::unique_ptr<CXFA_FMSimpleExpression> pExp2(
- ParseLogicalOrExpression());
- if (m_pErrorInfo->message.IsEmpty()) {
- pExp1.reset(new CXFA_FMAssignExpression(
- line, TOKassign, pExp1.release(), pExp2.release()));
- } else {
- pExp1.reset();
- }
- }
- Check(TOKrparen);
- } else {
+
+ if (m_pToken->m_type == TOKrparen) {
+ Error(m_pToken->m_uLinenum, FMERR_EXPECTED_NON_EMPTY_EXPRESSION);
NextToken();
+ return nullptr;
}
+
+ FX_DWORD line = m_pToken->m_uLinenum;
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1(ParseLogicalOrExpression());
+
+ while (m_pToken->m_type == TOKassign) {
+ NextToken();
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2(ParseLogicalOrExpression());
+ if (m_pErrorInfo->message.IsEmpty()) {
+ pExp1.reset(new CXFA_FMAssignExpression(line, TOKassign, pExp1.release(),
+ pExp2.release()));
+ } else {
+ pExp1.reset();
+ }
+ }
+ Check(TOKrparen);
return pExp1.release();
}