Syntax error with CGProgram

I’m working on this shader and can’t resolve this error. In Unity’s console I get:

Shader error in
‘GraphicsQuality/MediumScan’: Giving
up. Parser is hopelessly lost… at
line 15

Line 15 is the:

CGPROGRAM

Here is the rest of the shader code:

Shader "GraphicsQuality/MediumScan" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_SpecColor ("Specular Color", Color) = (0.5,0.5,0.5,1)
	_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
	_MainTex ("Base (RGB) RefStrGloss (A)", 2D) = "white" {}
	_BumpMap ("Normalmap", 2D) = "bump" {}
	_RimColor ("Rim Color", Color) = (0.48,0.78,1.0,0.0)
    _RimPower ("Rim Power", Range(0,8.0)) = 3.0
}

SubShader {
	Tags { "RenderType"="Opaque" }
	LOD 400
CGPROGRAM
#pragma surface surf BlinnPhong
#pragma target 3.0

sampler2D _MainTex;
sampler2D _BumpMap;

fixed4 _Color;
half _Shininess;
float4 _RimColor;
float _RimPower;

struct Input {
	float2 uv_MainTex;
	float2 uv_BumpMap;
	float3 viewDir;
	INTERNAL_DATA
};

void surf (Input IN, inout SurfaceOutput o) {
	fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
	fixed4 c = tex * _Color;
	o.Albedo = c.rgb;
	
	o.Gloss = tex.a;
	o.Specular = _Shininess;
	
	o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
	half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
    o.Emission = _RimColor.rgb * pow (rim, _RimPower);
ENDCG
}

FallBack "GraphicsQuality/LowScan"
}

I’m sure this is a dumb mistake on my part as I’m pulling bits and pieces from other shaders.

Thanks.

It looks like you’ve got mismatched pairs of {} going on in there. You need to actually end the surf function before you end the program declaration. Study the bottom two lines here:

void surf (Input IN, inout SurfaceOutput o) {
    fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
    fixed4 c = tex * _Color;
    o.Albedo = c.rgb;

    o.Gloss = tex.a;
    o.Specular = _Shininess;

    o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
    half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
    o.Emission = _RimColor.rgb * pow (rim, _RimPower);
ENDCG
}

Notice that you’re declaring ENDCG before the curly brace that ends the surf function. Try swapping those, for a start. There may be more, but it should help the parser give you more meaningful error messages, at least.