summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-07-27 14:53:20 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-27 20:16:52 +0000
commitdb1e8a500588abb98026bafac376b953f61813d2 (patch)
treef96181361d5acb18a11f60a09035f213264eaa75
parent5b45c540a2bdfedd0711139e0f1256faaee2ef83 (diff)
downloadpdfium-db1e8a500588abb98026bafac376b953f61813d2.tar.xz
Move CXFA_FMParse to CFXA_FMParser
Minor nit I had with this code and want to fix. Bug: Change-Id: I2494667d580bf982a4359153123d9e8afb75e349 Reviewed-on: https://pdfium-review.googlesource.com/9370 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--BUILD.gn6
-rw-r--r--xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp4
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser.cpp (renamed from xfa/fxfa/fm2js/cxfa_fmparse.cpp)130
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser.h (renamed from xfa/fxfa/fm2js/cxfa_fmparse.h)12
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp (renamed from xfa/fxfa/fm2js/cxfa_fmparse_unittest.cpp)57
5 files changed, 105 insertions, 104 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 057e84ff00..f2dbc6816f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1716,8 +1716,8 @@ if (pdf_enable_xfa) {
"xfa/fxfa/fm2js/cxfa_fmexpression.h",
"xfa/fxfa/fm2js/cxfa_fmlexer.cpp",
"xfa/fxfa/fm2js/cxfa_fmlexer.h",
- "xfa/fxfa/fm2js/cxfa_fmparse.cpp",
- "xfa/fxfa/fm2js/cxfa_fmparse.h",
+ "xfa/fxfa/fm2js/cxfa_fmparser.cpp",
+ "xfa/fxfa/fm2js/cxfa_fmparser.h",
"xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp",
"xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h",
"xfa/fxfa/fxfa.h",
@@ -1956,7 +1956,7 @@ test("pdfium_unittests") {
"xfa/fxfa/cxfa_ffbarcode_unittest.cpp",
"xfa/fxfa/cxfa_textparser_unittest.cpp",
"xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp",
- "xfa/fxfa/fm2js/cxfa_fmparse_unittest.cpp",
+ "xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp",
"xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp",
"xfa/fxfa/parser/xfa_utils_unittest.cpp",
]
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
index 1e8e1469a5..445d729668 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp
@@ -19,7 +19,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/cxfa_fmparse.h"
+#include "xfa/fxfa/fm2js/cxfa_fmparser.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -6055,7 +6055,7 @@ bool CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc,
return true;
}
- CXFA_FMParse parser(wsFormcalc);
+ CXFA_FMParser parser(wsFormcalc);
std::unique_ptr<CXFA_FMFunctionDefinition> func = parser.Parse();
if (!func || parser.HasError())
return false;
diff --git a/xfa/fxfa/fm2js/cxfa_fmparse.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index 8e163a40d0..150fa5aeda 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparse.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/fm2js/cxfa_fmparse.h"
+#include "xfa/fxfa/fm2js/cxfa_fmparser.h"
#include <memory>
#include <utility>
@@ -18,14 +18,15 @@ const int kMaxAssignmentChainLength = 12;
} // namespace
-CXFA_FMParse::CXFA_FMParse(const CFX_WideStringC& wsFormcalc) : m_error(false) {
+CXFA_FMParser::CXFA_FMParser(const CFX_WideStringC& wsFormcalc)
+ : m_error(false) {
m_lexer = pdfium::MakeUnique<CXFA_FMLexer>(wsFormcalc);
m_token = m_lexer->NextToken();
}
-CXFA_FMParse::~CXFA_FMParse() {}
+CXFA_FMParser::~CXFA_FMParser() {}
-std::unique_ptr<CXFA_FMFunctionDefinition> CXFA_FMParse::Parse() {
+std::unique_ptr<CXFA_FMFunctionDefinition> CXFA_FMParser::Parse() {
auto expressions = ParseTopExpression();
if (HasError())
return nullptr;
@@ -35,7 +36,7 @@ std::unique_ptr<CXFA_FMFunctionDefinition> CXFA_FMParse::Parse() {
1, true, L"", std::move(arguments), std::move(expressions));
}
-bool CXFA_FMParse::NextToken() {
+bool CXFA_FMParser::NextToken() {
if (HasError())
return false;
m_token = m_lexer->NextToken();
@@ -44,7 +45,7 @@ bool CXFA_FMParse::NextToken() {
return !HasError();
}
-bool CXFA_FMParse::CheckThenNext(XFA_FM_TOKEN op) {
+bool CXFA_FMParser::CheckThenNext(XFA_FM_TOKEN op) {
if (HasError())
return false;
@@ -56,7 +57,7 @@ bool CXFA_FMParse::CheckThenNext(XFA_FM_TOKEN op) {
}
std::vector<std::unique_ptr<CXFA_FMExpression>>
-CXFA_FMParse::ParseTopExpression() {
+CXFA_FMParser::ParseTopExpression() {
std::unique_ptr<CXFA_FMExpression> expr;
std::vector<std::unique_ptr<CXFA_FMExpression>> expressions;
if (HasError())
@@ -82,7 +83,7 @@ CXFA_FMParse::ParseTopExpression() {
return expressions;
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseFunction() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseFunction() {
if (HasError())
return nullptr;
@@ -144,7 +145,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseFunction() {
line, false, ident, std::move(arguments), std::move(expressions));
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpression() {
if (HasError())
return nullptr;
@@ -196,7 +197,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseExpression() {
return expr;
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseVarExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseVarExpression() {
if (HasError())
return nullptr;
@@ -226,7 +227,8 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseVarExpression() {
return pdfium::MakeUnique<CXFA_FMVarExpression>(line, ident, std::move(expr));
}
-std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseSimpleExpression() {
+std::unique_ptr<CXFA_FMSimpleExpression>
+CXFA_FMParser::ParseSimpleExpression() {
if (HasError())
return nullptr;
@@ -251,7 +253,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseSimpleExpression() {
return pExp1;
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseExpExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpExpression() {
if (HasError())
return nullptr;
@@ -263,7 +265,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseExpExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseLogicalOrExpression() {
+CXFA_FMParser::ParseLogicalOrExpression() {
if (HasError())
return nullptr;
@@ -297,7 +299,7 @@ CXFA_FMParse::ParseLogicalOrExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseLogicalAndExpression() {
+CXFA_FMParser::ParseLogicalAndExpression() {
if (HasError())
return nullptr;
@@ -330,7 +332,7 @@ CXFA_FMParse::ParseLogicalAndExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseEqualityExpression() {
+CXFA_FMParser::ParseEqualityExpression() {
if (HasError())
return nullptr;
@@ -374,7 +376,7 @@ CXFA_FMParse::ParseEqualityExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseRelationalExpression() {
+CXFA_FMParser::ParseRelationalExpression() {
if (HasError())
return nullptr;
@@ -443,7 +445,7 @@ CXFA_FMParse::ParseRelationalExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseAddtiveExpression() {
+CXFA_FMParser::ParseAddtiveExpression() {
if (HasError())
return nullptr;
@@ -486,7 +488,7 @@ CXFA_FMParse::ParseAddtiveExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseMultiplicativeExpression() {
+CXFA_FMParser::ParseMultiplicativeExpression() {
if (HasError())
return nullptr;
@@ -528,7 +530,7 @@ CXFA_FMParse::ParseMultiplicativeExpression() {
return e1;
}
-std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseUnaryExpression() {
+std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseUnaryExpression() {
if (HasError())
return nullptr;
@@ -575,7 +577,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseUnaryExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParsePrimaryExpression() {
+CXFA_FMParser::ParsePrimaryExpression() {
if (HasError())
return nullptr;
@@ -641,7 +643,7 @@ CXFA_FMParse::ParsePrimaryExpression() {
return expr;
}
-std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParsePostExpression(
+std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression(
std::unique_ptr<CXFA_FMSimpleExpression> expr) {
if (HasError())
return nullptr;
@@ -749,44 +751,42 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParsePostExpression(
expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>(
tempLine, std::move(expr), TOKdot, tempStr, std::move(s));
- } else {
- std::unique_ptr<CXFA_FMSimpleExpression> s =
- pdfium::MakeUnique<CXFA_FMIndexExpression>(
- tempLine, ACCESSOR_NO_INDEX, nullptr, false);
- expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>(
- line, std::move(expr), TOKdot, tempStr, std::move(s));
- continue;
- }
+ } else {
+ std::unique_ptr<CXFA_FMSimpleExpression> s =
+ pdfium::MakeUnique<CXFA_FMIndexExpression>(
+ tempLine, ACCESSOR_NO_INDEX, nullptr, false);
+ expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>(
+ line, std::move(expr), TOKdot, tempStr, std::move(s));
+ continue;
}
- break;
- case TOKdotdot: {
- if (!NextToken())
- return nullptr;
- if (m_token->m_type != TOKidentifier) {
- m_error = true;
- return nullptr;
- }
- CFX_WideStringC tempStr = m_token->m_string;
- uint32_t tempLine = m_token->m_line_num;
- if (!NextToken())
+ } break;
+ case TOKdotdot: {
+ if (!NextToken())
+ return nullptr;
+ if (m_token->m_type != TOKidentifier) {
+ m_error = true;
+ return nullptr;
+ }
+ CFX_WideStringC tempStr = m_token->m_string;
+ uint32_t tempLine = m_token->m_line_num;
+ if (!NextToken())
+ return nullptr;
+ if (m_token->m_type == TOKlbracket) {
+ std::unique_ptr<CXFA_FMSimpleExpression> s = ParseIndexExpression();
+ if (!s)
return nullptr;
- if (m_token->m_type == TOKlbracket) {
- std::unique_ptr<CXFA_FMSimpleExpression> s = ParseIndexExpression();
- if (!s)
- return nullptr;
- expr = pdfium::MakeUnique<CXFA_FMDotDotAccessorExpression>(
- tempLine, std::move(expr), TOKdotdot, tempStr, std::move(s));
- } else {
- std::unique_ptr<CXFA_FMSimpleExpression> s =
- pdfium::MakeUnique<CXFA_FMIndexExpression>(
- tempLine, ACCESSOR_NO_INDEX, nullptr, false);
- expr = pdfium::MakeUnique<CXFA_FMDotDotAccessorExpression>(
- line, std::move(expr), TOKdotdot, tempStr, std::move(s));
- continue;
- }
+ expr = pdfium::MakeUnique<CXFA_FMDotDotAccessorExpression>(
+ tempLine, std::move(expr), TOKdotdot, tempStr, std::move(s));
+ } else {
+ std::unique_ptr<CXFA_FMSimpleExpression> s =
+ pdfium::MakeUnique<CXFA_FMIndexExpression>(
+ tempLine, ACCESSOR_NO_INDEX, nullptr, false);
+ expr = pdfium::MakeUnique<CXFA_FMDotDotAccessorExpression>(
+ line, std::move(expr), TOKdotdot, tempStr, std::move(s));
+ continue;
}
- break;
+ } break;
case TOKdotscream: {
if (!NextToken())
return nullptr;
@@ -831,7 +831,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParsePostExpression(
return expr;
}
-std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseIndexExpression() {
+std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseIndexExpression() {
if (HasError())
return nullptr;
@@ -873,7 +873,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseIndexExpression() {
std::move(s), false);
}
-std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseParenExpression() {
+std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseParenExpression() {
if (!CheckThenNext(TOKlparen))
return nullptr;
@@ -908,7 +908,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParse::ParseParenExpression() {
return pExp1;
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseBlockExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseBlockExpression() {
if (HasError())
return nullptr;
@@ -948,7 +948,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseBlockExpression() {
std::move(expressions));
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseIfExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseIfExpression() {
if (HasError())
return nullptr;
@@ -1018,7 +1018,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseIfExpression() {
std::move(pElseExpression));
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseWhileExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseWhileExpression() {
if (HasError())
return nullptr;
@@ -1038,7 +1038,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseWhileExpression() {
}
std::unique_ptr<CXFA_FMSimpleExpression>
-CXFA_FMParse::ParseSubassignmentInForExpression() {
+CXFA_FMParser::ParseSubassignmentInForExpression() {
if (HasError())
return nullptr;
@@ -1052,7 +1052,7 @@ CXFA_FMParse::ParseSubassignmentInForExpression() {
return expr;
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseForExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForExpression() {
if (HasError())
return nullptr;
@@ -1120,7 +1120,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseForExpression() {
std::move(pStep), std::move(pList));
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseForeachExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForeachExpression() {
if (HasError())
return nullptr;
@@ -1165,7 +1165,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseForeachExpression() {
line, wsIdentifier, std::move(pAccessors), std::move(pList));
}
-std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseDoExpression() {
+std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseDoExpression() {
if (HasError())
return nullptr;
@@ -1179,6 +1179,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParse::ParseDoExpression() {
return pdfium::MakeUnique<CXFA_FMDoExpression>(line, std::move(expr));
}
-bool CXFA_FMParse::HasError() const {
+bool CXFA_FMParser::HasError() const {
return m_error || m_token == nullptr;
}
diff --git a/xfa/fxfa/fm2js/cxfa_fmparse.h b/xfa/fxfa/fm2js/cxfa_fmparser.h
index 7377cc75d7..66eb1f8392 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparse.h
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_FM2JS_CXFA_FMPARSE_H_
-#define XFA_FXFA_FM2JS_CXFA_FMPARSE_H_
+#ifndef XFA_FXFA_FM2JS_CXFA_FMPARSER_H_
+#define XFA_FXFA_FM2JS_CXFA_FMPARSER_H_
#include <memory>
#include <vector>
@@ -13,10 +13,10 @@
#include "xfa/fxfa/fm2js/cxfa_fmexpression.h"
#include "xfa/fxfa/fm2js/cxfa_fmlexer.h"
-class CXFA_FMParse {
+class CXFA_FMParser {
public:
- explicit CXFA_FMParse(const CFX_WideStringC& wsFormcalc);
- ~CXFA_FMParse();
+ explicit CXFA_FMParser(const CFX_WideStringC& wsFormcalc);
+ ~CXFA_FMParser();
std::unique_ptr<CXFA_FMFunctionDefinition> Parse();
bool HasError() const;
@@ -56,4 +56,4 @@ class CXFA_FMParse {
bool m_error;
};
-#endif // XFA_FXFA_FM2JS_CXFA_FMPARSE_H_
+#endif // XFA_FXFA_FM2JS_CXFA_FMPARSER_H_
diff --git a/xfa/fxfa/fm2js/cxfa_fmparse_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp
index 9e6972b356..9907890e83 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparse_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xfa/fxfa/fm2js/cxfa_fmparse.h"
+#include "xfa/fxfa/fm2js/cxfa_fmparser.h"
#include <vector>
@@ -10,8 +10,8 @@
#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-TEST(CXFA_FMParseTest, Empty) {
- auto parser = pdfium::MakeUnique<CXFA_FMParse>(L"");
+TEST(CXFA_FMParserTest, Empty) {
+ auto parser = pdfium::MakeUnique<CXFA_FMParser>(L"");
std::unique_ptr<CXFA_FMFunctionDefinition> ast = parser->Parse();
ASSERT(ast != nullptr);
EXPECT_FALSE(parser->HasError());
@@ -22,8 +22,8 @@ TEST(CXFA_FMParseTest, Empty) {
EXPECT_EQ(L"// comments only", buf.AsStringC());
}
-TEST(CXFA_FMParseTest, CommentOnlyIsError) {
- auto parser = pdfium::MakeUnique<CXFA_FMParse>(L"; Just comment");
+TEST(CXFA_FMParserTest, CommentOnlyIsError) {
+ auto parser = pdfium::MakeUnique<CXFA_FMParser>(L"; Just comment");
std::unique_ptr<CXFA_FMFunctionDefinition> ast = parser->Parse();
ASSERT(ast != nullptr);
// TODO(dsinclair): This isn't allowed per the spec.
@@ -35,7 +35,7 @@ TEST(CXFA_FMParseTest, CommentOnlyIsError) {
EXPECT_EQ(L"// comments only", buf.AsStringC());
}
-TEST(CXFA_FMParseTest, CommentThenValue) {
+TEST(CXFA_FMParserTest, CommentThenValue) {
const wchar_t ret[] =
L"(\nfunction ()\n{\n"
L"var pfm_ret = null;\n"
@@ -43,7 +43,7 @@ TEST(CXFA_FMParseTest, CommentThenValue) {
L"return pfm_rt.get_val(pfm_ret);\n"
L"}\n).call(this);\n";
- auto parser = pdfium::MakeUnique<CXFA_FMParse>(L"; Just comment\n12");
+ auto parser = pdfium::MakeUnique<CXFA_FMParser>(L"; Just comment\n12");
std::unique_ptr<CXFA_FMFunctionDefinition> ast = parser->Parse();
ASSERT(ast != nullptr);
EXPECT_FALSE(parser->HasError());
@@ -53,8 +53,9 @@ TEST(CXFA_FMParseTest, CommentThenValue) {
EXPECT_EQ(ret, buf.AsStringC());
}
-TEST(CXFA_FMParseTest, Parse) {
- const wchar_t input[] = L"$ = Avg (-3, 5, -6, 12, -13);\n"
+TEST(CXFA_FMParserTest, Parse) {
+ const wchar_t input[] =
+ L"$ = Avg (-3, 5, -6, 12, -13);\n"
L"$ = Avg (Table2..Row[*].Cell1);\n"
L"\n"
L"if ($ ne -1)then\n"
@@ -69,35 +70,35 @@ TEST(CXFA_FMParseTest, Parse) {
L"(\nfunction ()\n{\n"
L"var pfm_ret = null;\n"
L"if (pfm_rt.is_obj(this))\n{\n"
- L"pfm_rt.asgn_val_op(this, pfm_rt.Avg(pfm_rt.neg_op(3), 5, "
- L"pfm_rt.neg_op(6), 12, pfm_rt.neg_op(13)));\n"
+ L"pfm_rt.asgn_val_op(this, pfm_rt.Avg(pfm_rt.neg_op(3), 5, "
+ L"pfm_rt.neg_op(6), 12, pfm_rt.neg_op(13)));\n"
L"}\n"
L"if (pfm_rt.is_obj(this))\n{\n"
- L"pfm_rt.asgn_val_op(this, pfm_rt.Avg(pfm_rt.dot_acc(pfm_rt.dotdot_acc("
- L"Table2, \"Table2\", \"Row\", 1), \"\", \"Cell1\", 0, 0)));\n"
+ L"pfm_rt.asgn_val_op(this, pfm_rt.Avg(pfm_rt.dot_acc(pfm_rt.dotdot_acc("
+ L"Table2, \"Table2\", \"Row\", 1), \"\", \"Cell1\", 0, 0)));\n"
L"}\n"
L"if (pfm_rt.get_val(pfm_rt.neq_op(this, pfm_rt.neg_op(1))))\n{\n"
- L"if (pfm_rt.is_obj(pfm_rt.dot_acc(pfm_rt.dot_acc(pfm_rt.dot_acc("
- L"border, \"border\", \"fill\", 0, 0), \"\", \"color\", 0, 0), \"\", "
- L"\"value\", 0, 0)))\n{\n"
- L"pfm_rt.asgn_val_op(pfm_rt.dot_acc(pfm_rt.dot_acc("
- L"pfm_rt.dot_acc(border, \"border\", \"fill\", 0, 0), \"\", "
- L"\"color\", 0, 0), \"\", \"value\", 0, 0), \"255,64,64\");\n"
- L"}\n"
+ L"if (pfm_rt.is_obj(pfm_rt.dot_acc(pfm_rt.dot_acc(pfm_rt.dot_acc("
+ L"border, \"border\", \"fill\", 0, 0), \"\", \"color\", 0, 0), \"\", "
+ L"\"value\", 0, 0)))\n{\n"
+ L"pfm_rt.asgn_val_op(pfm_rt.dot_acc(pfm_rt.dot_acc("
+ L"pfm_rt.dot_acc(border, \"border\", \"fill\", 0, 0), \"\", "
+ L"\"color\", 0, 0), \"\", \"value\", 0, 0), \"255,64,64\");\n"
+ L"}\n"
L"}\nelse\n{\n"
- L"if (pfm_rt.is_obj(pfm_rt.dot_acc(pfm_rt.dot_acc(pfm_rt.dot_acc("
- L"border, \"border\", \"fill\", 0, 0), \"\", \"color\", 0, 0), \"\", "
- L"\"value\", 0, 0)))\n{\n"
- L"pfm_rt.asgn_val_op(pfm_rt.dot_acc(pfm_rt.dot_acc("
- L"pfm_rt.dot_acc(border, \"border\", \"fill\", 0, 0), \"\", "
- L"\"color\", 0, 0), \"\", \"value\", 0, 0), \"20,170,13\");\n"
- L"}\n"
+ L"if (pfm_rt.is_obj(pfm_rt.dot_acc(pfm_rt.dot_acc(pfm_rt.dot_acc("
+ L"border, \"border\", \"fill\", 0, 0), \"\", \"color\", 0, 0), \"\", "
+ L"\"value\", 0, 0)))\n{\n"
+ L"pfm_rt.asgn_val_op(pfm_rt.dot_acc(pfm_rt.dot_acc("
+ L"pfm_rt.dot_acc(border, \"border\", \"fill\", 0, 0), \"\", "
+ L"\"color\", 0, 0), \"\", \"value\", 0, 0), \"20,170,13\");\n"
+ L"}\n"
L"}\n"
L"pfm_ret = this;\n"
L"return pfm_rt.get_val(pfm_ret);\n"
L"}\n).call(this);\n";
- auto parser = pdfium::MakeUnique<CXFA_FMParse>(input);
+ auto parser = pdfium::MakeUnique<CXFA_FMParser>(input);
std::unique_ptr<CXFA_FMFunctionDefinition> ast = parser->Parse();
ASSERT(ast != nullptr);
EXPECT_FALSE(parser->HasError());