
syntaxdef java {


/\s+/m : ;


/(abstract|b(oolean|reak|yte)|c(a(se|tch)|har|lass|on(st|tinue))\
|d(efault|o(|uble))|e(lse|xtends)|f(alse|inal(|ly)|loat|or)|goto\
|i(f|mp(lements|ort)|n(stanceof|t(|erface)))|long|n(ative|ew|ull)\
|p(ackage|r(ivate|otected)|ublic)|return|s(hort|tatic|uper|witch|ynchronized)\
|t(h(is|row(|s))|r(ansient|ue|y))|vo(id|latile)|while)\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;
        }
    }

# char literal
/'/ : {
    context {
            /\\./: ;
            /$/m : exit;
            "'" : exit;
        }
        region ${ALL} {
               type=char_literal;
        }
    }


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


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

   context javadoc {

      /(\B@[a-zA-Z0-9-_.]+)\s*([^@\*]*)/ : {
         region ${1} {
            type=commentmeta;
	     }
      }
   }

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

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

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

   }

}



