summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmlexer.cpp30
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmlexer.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
index dc86c23b06..5ae8a6f40b 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
@@ -95,6 +95,26 @@ const XFA_FMKeyword keyWords[] = {
const XFA_FM_TOKEN KEYWORD_START = TOKdo;
const XFA_FM_TOKEN KEYWORD_END = TOKendif;
+const wchar_t* tokenStrings[] = {
+ L"TOKand", L"TOKlparen", L"TOKrparen", L"TOKmul",
+ L"TOKplus", L"TOKcomma", L"TOKminus", L"TOKdot",
+ L"TOKdiv", L"TOKlt", L"TOKassign", L"TOKgt",
+ L"TOKlbracket", L"TOKrbracket", L"TOKor", L"TOKdotscream",
+ L"TOKdotstar", L"TOKdotdot", L"TOKle", L"TOKne",
+ L"TOKeq", L"TOKge", L"TOKdo", L"TOKkseq",
+ L"TOKksge", L"TOKksgt", L"TOKif", L"TOKin",
+ L"TOKksle", L"TOKkslt", L"TOKksne", L"TOKksor",
+ L"TOKnull", L"TOKbreak", L"TOKksand", L"TOKend",
+ L"TOKeof", L"TOKfor", L"TOKnan", L"TOKksnot",
+ L"TOKvar", L"TOKthen", L"TOKelse", L"TOKexit",
+ L"TOKdownto", L"TOKreturn", L"TOKinfinity", L"TOKendwhile",
+ L"TOKforeach", L"TOKendfunc", L"TOKelseif", L"TOKwhile",
+ L"TOKendfor", L"TOKthrow", L"TOKstep", L"TOKupto",
+ L"TOKcontinue", L"TOKfunc", L"TOKendif", L"TOKstar",
+ L"TOKidentifier", L"TOKunderscore", L"TOKdollar", L"TOKexclamation",
+ L"TOKcall", L"TOKstring", L"TOKnumber", L"TOKreserver",
+};
+
XFA_FM_TOKEN TokenizeIdentifier(const CFX_WideStringC& str) {
uint32_t key = FX_HashCode_GetW(str, true);
@@ -118,6 +138,16 @@ CXFA_FMToken::CXFA_FMToken(uint32_t line_num)
CXFA_FMToken::~CXFA_FMToken() {}
+CFX_WideString CXFA_FMToken::ToDebugString() const {
+ CFX_WideString str(L"type = ");
+ str += tokenStrings[m_type];
+ str += L", string = ";
+ str += m_string;
+ str += L", line_num = ";
+ str += std::to_wstring(m_line_num).c_str();
+ return str;
+}
+
CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc)
: m_cursor(wsFormCalc.unterminated_c_str()),
m_end(m_cursor + wsFormCalc.GetLength() - 1),
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.h b/xfa/fxfa/fm2js/cxfa_fmlexer.h
index b3f13dae7a..858dc5d988 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer.h
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer.h
@@ -95,6 +95,8 @@ class CXFA_FMToken {
explicit CXFA_FMToken(uint32_t line_num);
~CXFA_FMToken();
+ CFX_WideString ToDebugString() const;
+
CFX_WideStringC m_string;
XFA_FM_TOKEN m_type;
uint32_t m_line_num;