Linux Material Scripts Parsing         Solve *.material scripts parsing problems on Linux

If you're running Ogre on a linux platform, you may see the following error messages when loading *.{LEX()}material{LEX} scripts :

Compiler error: invalid parameters in WoodBall.material(8): ambient requires 3 or 4 colour arguments, or a "vertexcolour" directive
Compiler error: invalid parameters in WoodBall.material(9): diffuse requires 3 or 4 colour arguments, or a "vertexcolour" directive
Compiler error: invalid parameters in WoodBall.material(10): specular must have first 3 arguments be a valid colour
Compiler error: invalid parameters in WoodBall.material(11): emissive requires 3 or 4 colour arguments, or a "vertexcolour" directive


The reason is that the parsing of *.material files depends on some environment variables related to the locale settings. Your LC_ALL variable may be defined with the value of your locale. You just have to unset LC_ALL, to set LC_NUMERIC to C and the other ones with your locale settings. Here is an example for a french programmer (fr_FR) who uses the UTF8 charset :

$ env | grep -E "(LANG|LC)"
LC_NUMERIC=C
LC_ALL=fr_FR.UTF-8
LC_MESSAGES=fr_FR.UTF-8
LC_COLLATE=C
LANG=fr_FR.utf8
LANGUAGE=fr_FR

$ unset LC_ALL

$ env | grep -E "(LANG|LC)"
LC_NUMERIC=C
LC_ALL=fr_FR.UTF-8
LC_MESSAGES=fr_FR.UTF-8
LC_COLLATE=C
LANG=fr_FR.utf8
LANGUAGE=fr_FR

$ running/your/program/is/now/ok