Example #1
0
		}//Op
		
		/// <summary>
		/// push left-associative operator but first pop and prepare operators with higher or same priority
		/// </summary>
		public Parser Op( Opcode op, int bottom )
		{
			Debug.Assert( op.Prior() > Opcode.Assign.Prior() );
			while( (OpsAt > bottom) && (Top().Prior() >= op.Prior()) ){
				Cgen.Prepare( Pop() );
			}
			if( OpsAt == Ops.Length )
			{
				Array.Resize( ref _ops, Ops.Length << 1 );
			}
			Ops[OpsAt++] = op;
			return this;
		}//Op
Example #2
0
		}//OpsAt
		
		/// <summary>
		/// push right-associative operator (assign or special)
		/// </summary>
		public Parser Op( Opcode op )
		{
			Debug.Assert( ((op == Opcode.Comma) || (op.Prior() <= Opcode.Assign.Prior())) || (op.Unary() && (!op.Postfix())) );
			if( OpsAt == Ops.Length )
			{
				Array.Resize( ref _ops, Ops.Length << 1 );
			}
			Ops[OpsAt++] = op;
			return this;
		}//Op