| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/fm2js/xfa_fmparse.h" | 7 #include "xfa/fxfa/fm2js/xfa_fmparse.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 void CXFA_FMParse::Check(XFA_FM_TOKEN op) { | 30 void CXFA_FMParse::Check(XFA_FM_TOKEN op) { |
| 31 if (m_pToken->m_type != op) { | 31 if (m_pToken->m_type != op) { |
| 32 CFX_WideString ws_TempString = m_pToken->m_wstring; | 32 CFX_WideString ws_TempString = m_pToken->m_wstring; |
| 33 Error(m_pToken->m_uLinenum, FMERR_EXPECTED_TOKEN, | 33 Error(m_pToken->m_uLinenum, FMERR_EXPECTED_TOKEN, |
| 34 XFA_FM_KeywordToString(op), ws_TempString.c_str()); | 34 XFA_FM_KeywordToString(op), ws_TempString.c_str()); |
| 35 } | 35 } |
| 36 NextToken(); | 36 NextToken(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void CXFA_FMParse::Error(uint32_t lineNum, XFA_FM_ERRMSG msg, ...) { | 39 void CXFA_FMParse::Error(uint32_t lineNum, const FX_WCHAR* msg, ...) { |
| 40 m_pErrorInfo->linenum = lineNum; | 40 m_pErrorInfo->linenum = lineNum; |
| 41 const FX_WCHAR* lpMessageInfo = XFA_FM_ErrorMsg(msg); | |
| 42 va_list ap; | 41 va_list ap; |
| 43 va_start(ap, msg); | 42 va_start(ap, msg); |
| 44 m_pErrorInfo->message.FormatV(lpMessageInfo, ap); | 43 m_pErrorInfo->message.FormatV(msg, ap); |
| 45 va_end(ap); | 44 va_end(ap); |
| 46 } | 45 } |
| 47 | 46 |
| 48 CFX_PtrArray* CXFA_FMParse::ParseTopExpression() { | 47 CFX_PtrArray* CXFA_FMParse::ParseTopExpression() { |
| 49 std::unique_ptr<CXFA_FMExpression> e; | 48 std::unique_ptr<CXFA_FMExpression> e; |
| 50 CFX_PtrArray* expression = new CFX_PtrArray(); | 49 CFX_PtrArray* expression = new CFX_PtrArray(); |
| 51 while (1) { | 50 while (1) { |
| 52 if (m_pToken->m_type == TOKeof || m_pToken->m_type == TOKendfunc || | 51 if (m_pToken->m_type == TOKeof || m_pToken->m_type == TOKendfunc || |
| 53 m_pToken->m_type == TOKendif || m_pToken->m_type == TOKelseif || | 52 m_pToken->m_type == TOKendif || m_pToken->m_type == TOKelseif || |
| 54 m_pToken->m_type == TOKelse || m_pToken->m_type == TOKreserver) { | 53 m_pToken->m_type == TOKelse || m_pToken->m_type == TOKreserver) { |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 NextToken(); | 1041 NextToken(); |
| 1043 e.reset(ParseBlockExpression()); | 1042 e.reset(ParseBlockExpression()); |
| 1044 Check(TOKend); | 1043 Check(TOKend); |
| 1045 if (m_pErrorInfo->message.IsEmpty()) { | 1044 if (m_pErrorInfo->message.IsEmpty()) { |
| 1046 e.reset(new CXFA_FMDoExpression(line, e.release())); | 1045 e.reset(new CXFA_FMDoExpression(line, e.release())); |
| 1047 } else { | 1046 } else { |
| 1048 e.reset(); | 1047 e.reset(); |
| 1049 } | 1048 } |
| 1050 return e.release(); | 1049 return e.release(); |
| 1051 } | 1050 } |
| OLD | NEW |