
syntaxdef sql {


/\s+/m : ;


/(as|ascii|an(d|si_nulls)|b(egin|inary|ool|yte)|c(ase|har|on(st|tinue)|reate)\
|d(atetime|ec(lare|imal)|efault|elete|o(|uble)|rop)|e(lse|nd|ncryption|x(ecute|ists))|f(alse|loat|or|rom|u(ll|nction))|g(o|oto|r(ant|oup by))\
|having|i(f|n|n(ner|sert)|nt|nto|s)|join|key|l(eft|ike|ong)|money|n(ative|ew|ocount|olock|ot|ull)|o(ff|n|r)\
|pr(i(mary|nt)|ocedure)|quoted_identifier|r(eturn|ight|owlock)|s(et|elect|(mall(datetime|int|money))|ysname)\
|t(able|hen|inyint|o|op|rue)|upd(ate|lock)|u(niqueidentifier|se)|v(archar|oid)|w(ith|he(n|re)|hile))\b/ : {
      region {
        type=keyword;
        index=word;
      }
}

/[\p{L}_\$][\p{L}\p{N}_\$]*/ : {
      region {
         type=identifier;
         index=word;
      }
  }


# string literals
/"/ : {
    context {
        /\\./: ;
        /$/m : exit;
        "\"" : exit;
    }
    region ${ALL} {
           type=string;
    }
}

/'/ : {
    context {
        /\\./: ;
        /$/m : exit;
        "'" : exit;
    }
    region ${ALL} {
           type=string;
    }
}


/(0x[0-9a-f]+l?)|([0-9]+(\.[0-9]*)?|\.[0-9]+)(e(\+|-)?[0-9]+)?(f|l|d)?/i : {
       region {
          type=numeric;
       }
   }

/\/\/.*$/m : {
      todo(${0});
      region {
         type=comment;
	     index=prose;
	     findlinks=true;
      }
   }

/\-\-.*$/m : {
      todo(${0});
      region {
         type=comment;
	     index=prose;
	     findlinks=true;
      }
   }


/\/\*(.*?)\*\//s : {
      todo(${1});
      region {
         type=comment;
         findlinks=true;
      }
      region ${1} {
	     index=prose;
      }
   }


   context todo {
      /(?i)todo\s.*/ : {
        region {
          type=todo;
        }
      }

   }
}



