Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Rules / Parser / Parser.cs / 1305376 / Parser.cs
// ----------------------------------------------------------------------------
// Copyright (C) 2006 Microsoft Corporation All Rights Reserved
// ---------------------------------------------------------------------------
#define CODE_ANALYSIS
using System.CodeDom;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.Activities.Common;
#region Grammar
//
// Grammar (left-factored with empty productions removed):
// ---------------------------------------------------------
//
// condition --> binary-expression
//
// binary-expression --> unary-expresssion binary-expression-tail
// --> unary-expression
//
// binary-expression-tail --> binary-operator-precedence unary-expression binary-expression-tail
// --> binary-operator-precedence unary-expression
//
// binary-operator-precedence --> 0:{ || OR }
// --> 1:{ && AND }
// --> 2:{ | }
// --> 3:{ & }
// --> 4:{ == != }
// --> 5:{ < > <= >= }
// --> 6:{ + - }
// --> 7:{ * / % MOD }
//
// unary-expression --> unary-operator unary-expression
// --> postfix-expression
//
// unary-operator --> -
// --> !
// --> NOT
// --> ( type-spec )
//
// postfix-expression --> primary-expression postfix-expression-tail
// --> primary-expression
//
// postfix-expression-tail --> postfix-operator postfix-expression-tail
// --> postfix-operator
//
// postfix-operator --> member-operator
// --> element-operator
//
// member-operator --> . IDENTIFIER method-call-arguments
// --> . IDENTIFIER
//
// element-operator --> [ expression-list ]
//
// expression-list --> logical-expression expression-list-tail
// --> logical-expression
//
// expression-list-tail --> , logical-expression expression-list-tail
// --> , logical-expression
//
// method-call-arguments --> ( argument-list )
// --> ( )
//
// argument-list --> argument argument-list-tail
// --> argument
//
// argument-list-tail --> , argument argument-list-tail
// --> , argument
//
// argument --> direction logical-expression
// --> logical-expression
//
// direction --> IN
// --> OUT
// --> REF
//
// primary-expression --> ( logical-expression )
// --> IDENTIFIER
// --> IDENTIFIER method-call-arguments
// --> type-name
// --> object-creation-expression
// --> array-creation-expression
// --> THIS
// --> integer-constant
// --> decimal-constant
// --> float-constant
// --> character-constant
// --> string-constant
// --> TRUE
// --> FALSE
// --> NULL
//
// object-creation-expression --> NEW type-name method-call-arguments
//
// array-creation-expression --> NEW array-spec
// --> NEW array-spec array-initializer
//
// array-spec --> type-name array-rank-specifiers
//
// array-rank-specifiers --> [ binary-expression ]
// --> [ ]
//
// array-initializer --> { variable-initializer-list }
// { }
//
// variable-initializer-list --> variable-initializer variable-initializer-list-tail
// --> variable-initializer
//
// variable-initializer-list-tail --> , variable-initializer variable-initializer-list-tail
// --> , variable-initializer
//
// variable-initializer --> binary-expression
//
// type-spec --> type-name
// --> type-name rank-specifiers
//
// rank-specifiers --> rank-specifier rank-specifier-tail
// --> rank-specifier
//
// rank-specifier-tail --> rank-specifier rank-specifier-tail
//
// rank-specifier --> [ dim-separators ]
// --> [ ]
//
// dim-separators --> , dim-separators-tail
// --> ,
//
// dim-separators-tail --> , dim-separators-tail
//
// type-name --> CHAR
// --> BYTE
// --> SBYTE
// --> SHORT
// --> USHORT
// --> INT
// --> UINT
// --> LONG
// --> ULONG
// --> FLOAT
// --> DOUBLE
// --> DECIMAL
// --> BOOL
// --> STRING
// --> namespace-qualified-type-name
//
// namespace-qualified-type-name --> NAMESPACE-NAME namespace-qualifier-tail . TYPE-NAME
// --> NAMESPACE-NAME . TYPE-NAME
// --> TYPE-NAME
//
// namespace-qualifier-tail --> . NAMESPACE-NAME namespace-qualifier-tail
//
// statement-list --> statement statement-list-tail
// --> statement
//
// statement-list-tail --> statement statement-list-tail
// --> statement
//
// statement --> assign-statement
// --> update-statement
// --> HALT
//
// assign-statement --> postfix-expression ASSIGN logical-expression
// --> postfix-expression
//
// update-statement --> UPDATE ( "path" )
// --> UPDATE postfix-expression
#endregion
namespace System.Workflow.Activities.Rules
{
#region ParserContext class
internal class ParserContext
{
private List tokens;
private int currentToken;
internal Dictionary