A machine gun-toting attacker wounded three people on a high-speed train in France before being overpowered by passengers.