Boundary--value problems for a class of first order partial differential equations in Sobolev spaces and applications to the Euler flow