# definitions for glsl
include "c_comment.lang"

state preproc start '^[[:blank:]]*#(?:[[:blank:]]*include)' begin
        string delim "<" ">" 
        string delim "\"" "\"" escape "\\"
        include "c_comment.lang"
end

preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)'

include "number.lang"

include "c_string.lang"

keyword = "attribute|const|uniform|varying",
  "centroid",
  "break|continue|do|for|while",
  "if|else",
  "in|out|inout",
  "invariant|discard|return|struct"

predef_var =
  "gl_BackColor|gl_BackLightModelProduct|gl_BackLightProduct|gl_BackMaterial",
  "gl_BackSecondaryColor|gl_ClipPlane|gl_ClipVertex|gl_Color|gl_DepthRange",
  "gl_DepthRangeParameters|gl_EyePlaneQ|gl_EyePlaneR|gl_EyePlaneS|gl_EyePlaneT",
  "gl_Fog|gl_FogColor|gl_FogFragCoord|gl_FogParameters",
  "gl_FragColor|gl_FragCoord|gl_FragData|gl_FragDepth|gl_FragFacing",
  "gl_FrontColor|gl_FrontLightModelProduct|gl_FrontLightProduct",
  "gl_FrontMaterial|gl_FrontSecondaryColor|gl_LightModel",
  "gl_LightModelParameters|gl_LightModelProducts|gl_LightProducts",
  "gl_LightSource|gl_LightSourceParameters|gl_MaterialParameters",
  "gl_MaxClipPlanes|gl_MaxCombinedTextureImageUnits|gl_MaxDrawBuffers",
  "gl_MaxFragmentUniformComponents|gl_MaxLights|gl_MaxTextureCoords",
  "gl_MaxTextureImageUnits|gl_MaxTextureUnits|gl_MaxVaryingFloats",
  "gl_MaxVertexAttributes|gl_MaxVertexTextureImageUnits|gl_MaxVertexUniformComponents",
  "gl_ModelViewMatrix|gl_ModelViewMatrixInverse|gl_ModelViewMatrixInverseTranspose",
  "gl_ModelViewMatrixTranspose|gl_ModelViewProjectionMatrix|gl_ModelViewProjectionMatrixInverse",
  "gl_ModelViewProjectionMatrixInverseTranspose|gl_ModelViewProjectionMatrixTranspose",
  "gl_MultiTexCoord0|gl_MultiTexCoord1|gl_MultiTexCoord2|gl_MultiTexCoord2",
  "gl_MultiTexCoord3|gl_MultiTexCoord4|gl_MultiTexCoord5|gl_MultiTexCoord6",
  "gl_MultiTexCoord7|gl_NormScale|gl_Normal|gl_NormalMatrix|gl_ObjectPlaneQ",
  "gl_ObjectPlaneR|gl_ObjectPlaneS|gl_ObjectPlaneT|gl_Point|gl_PointParameters",
  "gl_PointSize|gl_Position|gl_ProjectionMatrix|gl_ProjectionMatrixInverse",
  "gl_ProjectionMatrixInverseTranspose|gl_ProjectionMatrixTranspose",
  "gl_SecondaryColor|gl_SecondaryColor|gl_TexCoord|gl_TextureEnvColor",
  "gl_TextureMatrix|gl_TextureMatrixInverse|gl_TextureMatrixInverseTranspose",
  "gl_TextureMatrixTranspose|gl_Vertex"

predef_var = `\.(ambient|diffuse|specular|position|halfVector|spotDirection|spotExponent|spotCutoff|spotCosCutoff)`

predef_var = `\.(constantAttenuation|linearAttenuation|quadraticAttenuation|sceneColor|emission|shininess)`

predef_var = `\.(fadeThresholdSize|distanceConstantAttenuation|distanceLinearAttenuation|distanceQuadraticAttenuation)`

predef_var = `\.([xyzw]{1,4}|[rgba]{1,4}|[stpq]{1,4}|near|far|diff|color|density|start|end|scale|size|sizeMin|sizeMax)`

predef_func = "radians|degrees|sin|cos|tan|asin|acos|atan",
 "pow|exp|log|exp2|log2|sqrt|inversesqrt",
 "abs|sign|floor|ceil|fract|mod|min|max|clamp|mix|step|smoothstep",
 "length|distance|dot|cross|normalize|ftransform|faceforward|reflect|refract",
 "matrixCompMult",
 "lessThan|lessThenEqual|greaterThan|greaterThanEqual|equal|notEqual",
 "any|all|not",
 "texture1D|texture1DProj|texture1DLod|texture1DProjLod",
 "texture2D|texture2DProj|texture2DLod|texture2DProjLod",
 "texture3D|texture3DProj|texture3DLod|texture3DProjLod",
 "textureCube|textureCubeLod",
 "shadow1D|shadow1DProj|shadow1DLod|shadow1DProjLod",
 "shadow2D|shadow2DProj|shadow2DLod|shadow2DProjLod",
 "dFdx|dFdy|fwidth|noise1|noise2|noise3|noise4"

type = "float|int|void|bool|true|false",
  "mat2|mat3|mat4",
  "mat2x2|mat2x3|mat2x4",
  "mat3x2|mat3x3|mat3x4",
  "mat4x2|mat4x3|mat4x4",
  "vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4",
  "sampler1D|sampler2D|sampler3D|samplercube",
  "sampler1Dshadow|sampler2Dshadow"

include "symbols.lang"

cbracket = "{|}"

include "function.lang"
