Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cxfa_fmlexer.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef XFA_FXFA_FORMCALC_CXFA_FMLEXER_H_
8#define XFA_FXFA_FORMCALC_CXFA_FMLEXER_H_
9
10#include "core/fxcrt/raw_span.h"
11#include "core/fxcrt/widestring.h"
12#include "v8/include/cppgc/macros.h"
13
84
86 CPPGC_STACK_ALLOCATED(); // Raw pointers allowed.
87
88 public:
89 class Token {
90 public:
92 explicit Token(XFA_FM_TOKEN token);
94 Token(const Token& that);
96
97 XFA_FM_TOKEN GetType() const { return m_type; }
98 WideStringView GetString() const { return m_string; }
99#ifndef NDEBUG
101#endif // NDEBUG
102
103 private:
104 XFA_FM_TOKEN m_type = TOKreserver;
105 WideStringView m_string;
106 };
107
108 explicit CXFA_FMLexer(WideStringView wsFormcalc);
110
112 bool IsComplete() const { return m_nCursor >= m_spInput.size(); }
113
114 private:
115 Token AdvanceForNumber();
116 Token AdvanceForString();
117 Token AdvanceForIdentifier();
118 void AdvanceForComment();
119
120 void RaiseError() { m_bLexerError = true; }
121
122 pdfium::raw_span<const wchar_t> m_spInput;
123 size_t m_nCursor = 0;
124 bool m_bLexerError = false;
125};
126
127#endif // XFA_FXFA_FORMCALC_CXFA_FMLEXER_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
XFA_ResolveFlag
const FXJSE_CLASS_DESCRIPTOR kFormCalcDescriptor
#define DCHECK
Definition check.h:33
#define DCHECK_EQ(x, y)
Definition check_op.h:17
bool IsNotZero() const
uint8_t GetScale() const
void SetScale(uint8_t newScale)
CFGAS_Decimal(uint64_t val)
CFGAS_Decimal(float val, uint8_t scale)
CFGAS_Decimal(WideStringView str)
CFGAS_Decimal operator*(const CFGAS_Decimal &val) const
CFGAS_Decimal(uint32_t val)
double ToDouble() const
WideString ToWideString() const
CFGAS_Decimal operator/(const CFGAS_Decimal &val) const
CFGAS_Decimal(int32_t val)
float ToFloat() const
XFA_SCRIPTATTRIBUTEINFO script_attribute
CXFA_Object * GetThisObject() const
friend class EventParamScope
std::optional< ResolveResult > ResolveObjects(CXFA_Object *refObject, WideStringView wsExpression, Mask< XFA_ResolveFlag > dwStyles)
v8::Local< v8::Value > GlobalPropertyGetter()
static ByteString Local2IsoDate(CFXJSE_HostObject *pThis, ByteStringView bsDate, ByteStringView bsFormat, ByteStringView bsLocale)
static ByteString Num2AllTime(CFXJSE_HostObject *pThis, int32_t iTime, ByteStringView bsFormat, ByteStringView bsLocale, bool bGM)
CXFA_Document * GetDocument() const
static ByteString GetStandardTimeFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale)
static ByteString GetStandardDateFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale)
CFXJSE_FormCalcContext * AsFormCalcContext() override
static ByteString GetLocalDateFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale, bool bStandard)
~CFXJSE_FormCalcContext() override
static std::optional< WideTextBuffer > Translate(cppgc::Heap *pHeap, WideStringView wsFormcalc)
static ByteString GetLocalTimeFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale, bool bStandard)
static ByteString IsoDate2Local(CFXJSE_HostObject *pThis, ByteStringView bsDate, ByteStringView bsFormat, ByteStringView bsLocale)
static ByteString IsoTime2Local(CFXJSE_HostObject *pThis, ByteStringView bsTime, ByteStringView bsFormat, ByteStringView bsLocale)
virtual CFXJSE_FormCalcContext * AsFormCalcContext()
Definition fxjse.cpp:34
int32_t GetYear() const
uint8_t GetSecond() const
uint8_t GetHour() const
uint8_t GetDay() const
uint8_t GetMinute() const
uint16_t GetMillisecond() const
uint8_t GetMonth() const
CXFA_FFNotify * GetNotify() const
CXFA_LocaleMgr * GetLocaleMgr()
CFXJSE_Engine * GetScriptContext() const
virtual bool PostRequestURL(const WideString &wsURL, const WideString &wsData, const WideString &wsContentType, const WideString &wsEncode, const WideString &wsHeader, WideString &wsResponse)=0
virtual bool PutRequestURL(const WideString &wsURL, const WideString &wsData, const WideString &wsEncode)=0
CXFA_FFApp::CallbackIface * GetAppProvider()
std::optional< WideTextBuffer > ToJavaScript() const
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMAssignExpression() override
~CXFA_FMBinExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
CXFA_FMBinExpression(const WideString &opName, XFA_FM_TOKEN op, CXFA_FMSimpleExpression *pExp1, CXFA_FMSimpleExpression *pExp2)
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMBlockExpression() override
~CXFA_FMBreakExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMCallExpression() override
uint32_t IsMethodWithObjParam(const WideString &methodName) const
bool IsBuiltInFunc(WideTextBuffer *funcName) const
~CXFA_FMChainableExpression() override
CXFA_FMSimpleExpression * GetSecondExpression() const
CXFA_FMChainableExpression(XFA_FM_TOKEN op, CXFA_FMSimpleExpression *pExp1, CXFA_FMSimpleExpression *pExp2)
CXFA_FMSimpleExpression * GetFirstExpression() const
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMContinueExpression() override
~CXFA_FMDivExpression() override
~CXFA_FMDoExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMDotAccessorExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMEqualExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMExpExpression() override
virtual ~CXFA_FMExpression()
virtual bool ToJavaScript(WideTextBuffer *js, ReturnType type) const =0
~CXFA_FMForExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMForeachExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMFunctionDefinition() override
~CXFA_FMGeExpression() override
~CXFA_FMGtExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMIdentifierExpression() override
~CXFA_FMIfExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMIndexExpression() override
~CXFA_FMLeExpression() override
WideStringView GetString() const
XFA_FM_TOKEN GetType() const
WideString ToDebugString() const
Token(const Token &that)
Token(XFA_FM_TOKEN token, WideStringView str)
Token(XFA_FM_TOKEN token)
bool IsComplete() const
CXFA_FMLexer(WideStringView wsFormcalc)
~CXFA_FMLogicalAndExpression() override
~CXFA_FMLogicalOrExpression() override
~CXFA_FMLtExpression() override
~CXFA_FMMethodCallExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMMinusExpression() override
~CXFA_FMMulExpression() override
~CXFA_FMNegExpression() override
~CXFA_FMNotEqualExpression() override
~CXFA_FMNotExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMNullExpression() override
~CXFA_FMNumberExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
bool HasError() const
CXFA_FMParser(cppgc::Heap *heap, CXFA_FMLexer *pLexer)
CXFA_FMAST * Parse()
void SetMaxParseDepthForTest(unsigned long max_depth)
~CXFA_FMPlusExpression() override
~CXFA_FMPosExpression() override
CXFA_FMSimpleExpression(XFA_FM_TOKEN op)
~CXFA_FMSimpleExpression() override
XFA_FM_TOKEN GetOperatorToken() const
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMStringExpression() override
~CXFA_FMUnaryExpression() override
CXFA_FMUnaryExpression(const WideString &opName, XFA_FM_TOKEN op, CXFA_FMSimpleExpression *pExp)
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMVarExpression() override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
bool ToJavaScript(WideTextBuffer *js, ReturnType type) const override
~CXFA_FMWhileExpression() override
GCedLocaleIface * GetDefLocale() override
GCedLocaleIface * GetLocaleByName(const WideString &wsLocaleName) override
CXFA_LocaleValue(ValueType dwType, const WideString &wsValue, const WideString &wsFormat, GCedLocaleIface *pLocale, CXFA_LocaleMgr *pLocaleMgr)
double GetDoubleNum() const
CFX_DateTime GetTime() const
const WideString & GetValue() const
CFX_DateTime GetDate() const
bool FormatPatterns(WideString &wsResult, const WideString &wsFormat, GCedLocaleIface *pLocale, XFA_ValuePicture eValueType) const
bool IsValid() const
GCedLocaleIface * GetLocale()
CXFA_Node * AsNode()
virtual WideString GetDatePattern(DateTimeSubcategory eType) const =0
virtual int GetTimeZoneInMinutes() const =0
virtual WideString GetDateTimeSymbols() const =0
virtual WideString GetTimePattern(DateTimeSubcategory eType) const =0
ByteString(const char *ptr)
bool EqualNoCase(ByteStringView str) const
static ByteString Format(const char *pFormat,...)
ByteString & operator+=(const ByteString &str)
ByteString()=default
ByteString & operator+=(char ch)
static ByteString FormatInteger(int i)
bool operator==(const ByteString &other) const
bool operator==(const char *ptr) const
ByteString & operator+=(const char *str)
ByteString & operator=(const ByteString &that)
int Compare(ByteStringView str) const
ByteString ToUTF8() const
WideString & operator=(WideString &&that) noexcept
WideString()=default
static WideString FromUTF8(ByteStringView str)
bool IsASCII() const
Definition widestring.h:110
ByteString ToASCII() const
static WideString FromASCII(ByteStringView str)
void AppendChar(wchar_t wch)
WideString MakeString() const
WideStringView AsStringView() const
#define UNSAFE_TODO(...)
bool CXFA_IsTooBig(const WideTextBuffer &js)
XFA_FM_TOKEN
@ TOKdotstar
@ TOKnan
@ TOKeof
@ TOKge
@ TOKbreak
@ TOKreserver
@ TOKminus
@ TOKnumber
@ TOKendfor
@ TOKor
@ TOKeq
@ TOKexclamation
@ TOKksle
@ TOKfor
@ TOKdo
@ TOKcall
@ TOKupto
@ TOKlbracket
@ TOKexit
@ TOKplus
@ TOKkslt
@ TOKnull
@ TOKthrow
@ TOKksgt
@ TOKendif
@ TOKgt
@ TOKcontinue
@ TOKcomma
@ TOKstar
@ TOKle
@ TOKksnot
@ TOKrparen
@ TOKlparen
@ TOKksand
@ TOKidentifier
@ TOKksor
@ TOKelseif
@ TOKassign
@ TOKendfunc
@ TOKdollar
@ TOKelse
@ TOKksge
@ TOKkseq
@ TOKvar
@ TOKendwhile
@ TOKunderscore
@ TOKstring
@ TOKfunc
@ TOKksne
@ TOKreturn
@ TOKforeach
@ TOKif
@ TOKinfinity
@ TOKin
@ TOKdotscream
@ TOKdiv
@ TOKne
@ TOKrbracket
@ TOKmul
@ TOKlt
@ TOKdownto
@ TOKthen
@ TOKdotdot
@ TOKstep
@ TOKand
@ TOKdot
@ TOKend
@ TOKwhile
XFA_ValuePicture
Definition cxfa_node.h:71
CXFA_Node * ToNode(CXFA_Object *pObj)
time_t FXSYS_time(time_t *tloc)
int FXSYS_WideHexCharToInt(wchar_t c)
bool FXSYS_IsDecimalDigit(wchar_t c)
bool FXSYS_IsWideHexDigit(wchar_t c)
struct tm * FXSYS_localtime(const time_t *tp)
pdfium::CheckedNumeric< int32_t > FX_SAFE_INT32
int32_t FXSYS_atoi(const char *str)
#define FX_FILESIZE
Definition fx_types.h:19
XFA_Attribute
Definition fxfa_basic.h:67
XFA_ScriptType
Definition fxfa_basic.h:104
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
Definition heap.h:12
ByteString operator+(const ByteString &str1, const ByteString &str2)
Definition bytestring.h:146
WideString operator+(const WideString &str1, const WideString &str2)
Definition widestring.h:156
ByteString operator+(const ByteString &str1, const char *str2)
Definition bytestring.h:155
WideString operator+(const wchar_t *str1, const WideString &str2)
Definition widestring.h:168
WideString operator+(const WideString &str1, const wchar_t *str2)
Definition widestring.h:165
Definition fxv8.h:22
bool IsBoolean(v8::Local< v8::Value > value)
Definition fxv8.cpp:28
bool IsArray(v8::Local< v8::Value > value)
Definition fxv8.cpp:48
bool IsUndefined(v8::Local< v8::Value > value)
Definition fxv8.cpp:20
bool IsNumber(v8::Local< v8::Value > value)
Definition fxv8.cpp:36
bool IsObject(v8::Local< v8::Value > value)
Definition fxv8.cpp:44
bool IsString(v8::Local< v8::Value > value)
Definition fxv8.cpp:32
ByteString ReentrantToByteStringHelper(v8::Isolate *pIsolate, v8::Local< v8::Value > pValue)
Definition fxv8.cpp:176
bool ReentrantToBooleanHelper(v8::Isolate *pIsolate, v8::Local< v8::Value > pValue)
Definition fxv8.cpp:141
bool IsNull(v8::Local< v8::Value > value)
Definition fxv8.cpp:24
int32_t ReentrantToInt32Helper(v8::Isolate *pIsolate, v8::Local< v8::Value > pValue)
Definition fxv8.cpp:134
const char kClassTag[]
Definition fxjse.cpp:18
const char kFuncTag[]
Definition fxjse.cpp:17
fxcrt::ByteStringView ByteStringView
fxcrt::WideStringView WideStringView
XFA_ScriptType eValueType
XFA_ATTRIBUTE_CALLBACK callback
#define UNOWNED_PTR_EXCLUSION
fxcrt::WideString WideString
Definition widestring.h:207