core/src/lexer.cpp
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Thu, 04 Nov 2010 20:51:05 +0000
changeset 82 a6fec624de6c
parent 78 b3ffff030d5c
permissions -rw-r--r--
Tweaks to s60\5th_edition build, added README_HowToBuild.txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     1
// lexer.cpp
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     2
// 
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     3
// Copyright (c) 2006 - 2010 Accenture. All rights reserved.
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     4
// This component and the accompanying materials are made available
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     5
// under the terms of the "Eclipse Public License v1.0"
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     6
// which accompanies this distribution, and is available
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     8
// 
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     9
// Initial Contributors:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    10
// Accenture - Initial contribution
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    11
//
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    12
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    13
#include "lexer.h"
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    14
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    15
const TInt KMaxReadLength = 512;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    16
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    17
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    18
//
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    19
// TToken
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    20
//
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    21
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    22
TToken::TToken()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    23
	: iToken(NULL, 0), iPos(0)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    24
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    25
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    26
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    27
TToken::TToken(TType aType, const TDesC& aToken, TInt aPos)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    28
	: iType(aType), iToken(aToken), iPos(aPos)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    29
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    30
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    31
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    32
TToken& TToken::operator=(const TToken& aToken)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    33
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    34
	iType = aToken.iType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    35
	iToken.Set(aToken.iToken);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    36
	iPos = aToken.iPos;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    37
	return *this;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    38
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    39
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    40
TToken::TType TToken::Type() const
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    41
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    42
	return iType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    43
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    44
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    45
TInt TToken::Position() const
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    46
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    47
	return iPos;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    48
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    49
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    50
const TDesC& TToken::String() const
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    51
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    52
	return iToken;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    53
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    54
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    55
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    56
//
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    57
// CLex - A cut down version of the TLex API that supports reading data incrementally from an RIoReadHandle.
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    58
//
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    59
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    60
class CLex : public CBase
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    61
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    62
public:
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    63
	static CLex* NewL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    64
	~CLex();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    65
	void Set(const TDesC& aDes);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    66
	void Set(RIoReadHandle& aHandle);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    67
	void Purge();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    68
	void SkipToEnd();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    69
	TBool EosL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    70
	void Mark();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    71
	void IncL(TInt aNumber);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    72
	TChar GetL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    73
	TChar Peek() const;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    74
	TPtrC RemainderL(TInt aMinLength);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    75
	void UnGet();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    76
	TInt Offset() const;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    77
	TInt MarkedOffset() const;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    78
	TPtrC MarkedToken() const;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    79
	const TUint16* Ptr() const;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    80
private:
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    81
	CLex();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    82
	void DoReadL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    83
private:
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    84
	TLex iLex;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    85
	TInt iMarkedOffset;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    86
	TPtrC iLexPtr;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    87
	RBuf iLexBuf;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    88
	TBuf<KMaxReadLength> iReadBuf;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    89
	RIoReadHandle iHandle;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    90
	TBool iUsingHandle;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    91
	TBool iEos;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    92
	};
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    93
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    94
CLex* CLex::NewL()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    95
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    96
	return new(ELeave) CLex();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    97
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    98
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
    99
CLex::CLex() : iLexPtr(NULL, 0)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   100
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   101
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   102
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   103
CLex::~CLex()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   104
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   105
	iLexBuf.Close();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   106
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   107
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   108
void CLex::Set(const TDesC& aDes)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   109
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   110
	iEos = EFalse;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   111
	iUsingHandle = EFalse;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   112
	iMarkedOffset = 0;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   113
	iLexPtr.Set(aDes);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   114
	iLex = iLexPtr;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   115
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   116
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   117
void CLex::Set(RIoReadHandle& aHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   118
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   119
	iEos = EFalse;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   120
	iUsingHandle = ETrue;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   121
	iMarkedOffset = 0;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   122
	iHandle = aHandle;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   123
	iHandle.SetReadMode(RIoReadHandle::EOneOrMore);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   124
	iLexBuf.Zero();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   125
	iLex = iLexBuf;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   126
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   127
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   128
void CLex::Purge()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   129
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   130
	if (iUsingHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   131
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   132
		iLexBuf.Delete(0, iLex.Offset());
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   133
		iLex = iLexBuf;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   134
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   135
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   136
	iMarkedOffset = 0;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   137
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   138
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   139
void CLex::SkipToEnd()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   140
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   141
	iEos = ETrue;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   142
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   143
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   144
TBool CLex::EosL()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   145
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   146
	if (!iEos)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   147
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   148
		if (!iLex.Eos())
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   149
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   150
			// If iLex still has data, then we're definately not at the end of the string.
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   151
			// Do nothing. This test avoids us doing I/O handle reads before draining using the existing data.
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   152
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   153
		else if (iUsingHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   154
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   155
			DoReadL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   156
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   157
		else
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   158
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   159
			iEos = ETrue;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   160
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   161
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   162
	return iEos;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   163
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   164
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   165
void CLex::Mark()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   166
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   167
	iMarkedOffset = iLex.Offset();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   168
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   169
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   170
void CLex::IncL(TInt aNumber)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   171
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   172
	if (iUsingHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   173
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   174
		while (!iEos && (iLex.Remainder().Length() < aNumber))
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   175
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   176
			DoReadL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   177
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   178
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   179
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   180
	iLex.Inc(aNumber);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   181
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   182
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   183
TChar CLex::GetL()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   184
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   185
	if (iUsingHandle && !iEos && (iLex.Remainder().Length() < 1))
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   186
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   187
		DoReadL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   188
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   189
	return iLex.Get();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   190
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   191
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   192
TChar CLex::Peek() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   193
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   194
	return iLex.Peek();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   195
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   196
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   197
TPtrC CLex::RemainderL(TInt aMinLength)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   198
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   199
	if (iUsingHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   200
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   201
		while (!iEos && (iLex.Remainder().Length() < aMinLength))
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   202
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   203
			DoReadL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   204
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   205
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   206
	return iLex.Remainder();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   207
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   208
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   209
void CLex::UnGet()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   210
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   211
	iLex.UnGet();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   212
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   213
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   214
TInt CLex::Offset() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   215
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   216
	return iLex.Offset();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   217
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   218
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   219
TInt CLex::MarkedOffset() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   220
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   221
	return iMarkedOffset;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   222
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   223
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   224
TPtrC CLex::MarkedToken() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   225
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   226
	if (iUsingHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   227
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   228
		return TPtrC(iReadBuf.Ptr() + iMarkedOffset, iLex.Offset() - iMarkedOffset);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   229
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   230
	else
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   231
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   232
		return TPtrC(iLexPtr.Ptr() + iMarkedOffset, iLex.Offset() - iMarkedOffset);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   233
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   234
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   235
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   236
const TUint16* CLex::Ptr() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   237
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   238
	if (iUsingHandle)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   239
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   240
		return iLexBuf.Ptr();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   241
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   242
	else
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   243
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   244
		return iLexPtr.Ptr();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   245
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   246
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   247
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   248
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   249
void CLex::DoReadL()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   250
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   251
	ASSERT(iUsingHandle);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   252
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   253
	if (!iEos)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   254
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   255
		if (iReadBuf.Length() == 0) // iReadBuf may contain data if a realloc of iLexBuf failed previously.
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   256
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   257
			TInt err = iHandle.Read(iReadBuf);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   258
			if (err == KErrEof)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   259
				{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   260
				iEos = ETrue;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   261
				}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   262
			else
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   263
				{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   264
				User::LeaveIfError(err);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   265
				}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   266
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   267
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   268
		TInt offset = iLex.Offset();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   269
		if ((iLexBuf.MaxLength() - iLexBuf.Length()) < iReadBuf.Length())
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   270
			{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   271
			iLexBuf.ReAllocL(iLexBuf.Length() + iReadBuf.Length());
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   272
			}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   273
		iLexBuf.Append(iReadBuf);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   274
		iReadBuf.Zero();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   275
		iLex = iLexBuf;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   276
		iLex.Inc(offset);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   277
		}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   278
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   279
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   280
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   281
//
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   282
// CReservedLookup
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   283
//
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   284
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   285
class CReservedLookup : public CBase
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   286
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   287
public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   288
	class TResult
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   289
		{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   290
	public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   291
		enum TType
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   292
			{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   293
			ENoMatch,
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   294
			EMatch
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   295
			};
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   296
	public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   297
		TResult();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   298
	public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   299
		TType iResultType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   300
		TToken::TType iTokenType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   301
		TInt iTokenLength;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   302
		};
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   303
	enum TCharPos
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   304
		{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   305
		ENotLast,
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   306
		ELast
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   307
		};
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   308
public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   309
	static CReservedLookup* NewL();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   310
	~CReservedLookup();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   311
	void DefineTokenTypeL(TToken::TType aTokenType, const TDesC& aString);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   312
	void Reset();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   313
	TResult Lookup(const TDesC& aDes);
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   314
	TInt Longest() const;
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   315
private:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   316
	class TReserved
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   317
		{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   318
	public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   319
		TReserved(TToken::TType aType, const TDesC& aString);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   320
	public:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   321
		TToken::TType iType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   322
		TPtrC iString;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   323
		};
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   324
private:
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   325
	RArray<TReserved> iList;
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   326
	TInt iLongest;
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   327
	};
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   328
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   329
CReservedLookup* CReservedLookup::NewL()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   330
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   331
	return new(ELeave) CReservedLookup();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   332
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   333
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   334
CReservedLookup::~CReservedLookup()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   335
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   336
	iList.Close();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   337
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   338
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   339
void CReservedLookup::DefineTokenTypeL(TToken::TType aTokenType, const TDesC& aString)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   340
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   341
	User::LeaveIfError(iList.Append(TReserved(aTokenType, aString)));
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   342
	if (aString.Length() > iLongest)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   343
		{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   344
		iLongest = aString.Length();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   345
		}
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   346
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   347
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   348
CReservedLookup::TResult CReservedLookup::Lookup(const TDesC& aDes)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   349
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   350
	// Find the longest reserved word that matches from the beginning of this string.
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   351
	TResult result;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   352
	const TInt count = iList.Count();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   353
	for (TInt i = 0; i < count; ++i)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   354
		{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   355
		const TReserved& reserved = iList[i];
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   356
		if (aDes.Left(reserved.iString.Length()) == reserved.iString)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   357
			{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   358
			if (result.iTokenLength < reserved.iString.Length())
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   359
				{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   360
				result.iTokenLength = reserved.iString.Length();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   361
				result.iResultType = TResult::EMatch;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   362
				result.iTokenType = reserved.iType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   363
				}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   364
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   365
		}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   366
	return result;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   367
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   368
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   369
TInt CReservedLookup::Longest() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   370
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   371
	return iLongest;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   372
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   373
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   374
CReservedLookup::TReserved::TReserved(TToken::TType aType, const TDesC& aString)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   375
	: iType(aType), iString(aString)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   376
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   377
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   378
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   379
CReservedLookup::TResult::TResult()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   380
	: iResultType(ENoMatch), iTokenType(TToken::EString), iTokenLength(0)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   381
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   382
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   383
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   384
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   385
//
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   386
// CLexer
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   387
//
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   388
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   389
CLexer* CLexer::NewL()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   390
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   391
	CLexer* self = CLexer::NewLC();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   392
	CleanupStack::Pop(self);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   393
	return self;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   394
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   395
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   396
CLexer* CLexer::NewL(TUint aBehaviour)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   397
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   398
	CLexer* self = CLexer::NewLC(aBehaviour);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   399
	CleanupStack::Pop(self);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   400
	return self;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   401
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   402
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   403
CLexer* CLexer::NewLC()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   404
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   405
	CLexer* self = new(ELeave) CLexer(EHandleSingleQuotes | EHandleDoubleQuotes | EHandleComments);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   406
	CleanupStack::PushL(self);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   407
	self->ConstructL();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   408
	return self;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   409
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   410
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   411
CLexer* CLexer::NewLC(TUint aBehaviour)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   412
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   413
	CLexer* self = new(ELeave) CLexer(aBehaviour);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   414
	CleanupStack::PushL(self);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   415
	self->ConstructL();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   416
	return self;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   417
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   418
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   419
CLexer::~CLexer()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   420
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   421
	delete iLex;
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   422
	delete iReservedLookup;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   423
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   424
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   425
void CLexer::DefineTokenTypeL(TToken::TType aTokenType, const TDesC& aString)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   426
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   427
	iReservedLookup->DefineTokenTypeL(aTokenType, aString);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   428
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   429
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   430
void CLexer::Set(const TDesC& aDes, const TChar& aEscapeChar)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   431
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   432
	iLex->Set(aDes);
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   433
	iEscapeChar = aEscapeChar;
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   434
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   435
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   436
void CLexer::Set(RIoReadHandle& aHandle, const TChar& aEscapeChar)
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   437
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   438
	iLex->Set(aHandle);
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   439
	iEscapeChar = aEscapeChar;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   440
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   441
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   442
void CLexer::Purge()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   443
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   444
	iLex->Purge();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   445
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   446
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   447
void CLexer::SkipToEnd()
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   448
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   449
	iLex->SkipToEnd();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   450
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   451
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   452
TToken CLexer::NextTokenL()
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   453
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   454
	SkipWhiteSpaceL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   455
	iLex->Mark();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   456
	TToken::TType type(TToken::ENull);
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   457
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   458
	while (!iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   459
		{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   460
		type = TToken::EString;
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   461
		TChar c = iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   462
		if (c == iEscapeChar)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   463
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   464
			iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   465
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   466
		else if ((c == '\'') && (iBehaviour & EHandleSingleQuotes))
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   467
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   468
			SkipSingleQuotedCharsL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   469
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   470
		else if ((c == '\"') && (iBehaviour & EHandleDoubleQuotes))
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   471
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   472
			SkipDoubleQuotedCharsL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   473
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   474
		else if ((c == '#') && (iBehaviour & EHandleComments))
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   475
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   476
			if (iLex->MarkedToken().Length() > 1)
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   477
				{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   478
				iLex->UnGet();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   479
				break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   480
				}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   481
			else
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   482
				{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   483
				SkipCommentL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   484
				if (iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   485
					{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   486
					type = TToken::ENull;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   487
					break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   488
					}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   489
				else
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   490
					{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   491
					iLex->Mark();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   492
					}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   493
				}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   494
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   495
		else if (c.IsSpace() && (c != '\n') && (c != '\r'))
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   496
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   497
			iLex->UnGet();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   498
			break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   499
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   500
		else
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   501
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   502
			iLex->UnGet();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   503
			CReservedLookup::TResult result = iReservedLookup->Lookup(iLex->RemainderL(iReservedLookup->Longest()));
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   504
			if (result.iResultType == CReservedLookup::TResult::EMatch)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   505
				{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   506
				if (iLex->MarkedToken().Length() > 0)
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   507
					{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   508
					break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   509
					}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   510
				else
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   511
					{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   512
					iLex->IncL(result.iTokenLength);
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   513
					type = result.iTokenType;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   514
					break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   515
					}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   516
				}
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   517
			iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   518
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   519
		}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   520
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   521
	return TToken(type, iLex->MarkedToken(), iLex->MarkedOffset());
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   522
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   523
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   524
TInt CLexer::CurrentOffset() const
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   525
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   526
	return iLex->Offset();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   527
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   528
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   529
TBool CLexer::MoreL()
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   530
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   531
	SkipWhiteSpaceL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   532
	return !iLex->EosL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   533
	}
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   534
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   535
const TUint16* CLexer::Ptr() const
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   536
	{
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   537
	return iLex->Ptr();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   538
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   539
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   540
CLexer::CLexer(TUint aBehaviour)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   541
	: iBehaviour(aBehaviour)
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   542
	{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   543
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   544
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   545
void CLexer::ConstructL()
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   546
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   547
	iLex = CLex::NewL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   548
	iReservedLookup = CReservedLookup::NewL();
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   549
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   550
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   551
void CLexer::SkipSingleQuotedCharsL()
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   552
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   553
	while (!iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   554
		{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   555
		TChar c = iLex->GetL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   556
		if ((c == iEscapeChar) && !iLex->EosL() && (iLex->Peek() == '\''))
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   557
			{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   558
			// Allow quoted single quote characters. Note, the is a departure from Bash behaviour, but is in line with Perl and is generally helpful.
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   559
			iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   560
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   561
		else if (c == '\'')
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   562
			{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   563
			break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   564
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   565
		}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   566
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   567
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   568
void CLexer::SkipDoubleQuotedCharsL()
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   569
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   570
	while (!iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   571
		{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   572
		TChar c = iLex->GetL();
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   573
		if ((c == iEscapeChar) && !iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   574
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   575
			iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   576
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   577
		else if (c == '"')
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   578
			{
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   579
			break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   580
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   581
		}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   582
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   583
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   584
void CLexer::SkipCommentL()
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   585
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   586
	while (!iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   587
		{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   588
		TChar c = iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   589
		if ((c == '\n') || (c == '\r'))
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   590
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   591
			iLex->UnGet();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   592
			break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   593
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   594
		}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   595
	}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   596
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   597
void CLexer::SkipWhiteSpaceL()
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   598
	{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   599
	while (!iLex->EosL())
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   600
		{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   601
		TChar c = iLex->GetL();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   602
		if (!c.IsSpace() || (c == '\n') || (c == '\r'))
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   603
			{
78
b3ffff030d5c Pulled in from FCL: input, base64, fshell thread pool
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 0
diff changeset
   604
			iLex->UnGet();
0
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   605
			break;
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   606
			}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   607
		}
7f656887cf89 First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
   608
	}