syntaxdef python {

# whitespace
/\s+/m : ;

# comments
/#.*?$/m : {
      region {
         type=comment;
         index=prose;
         findlinks=true;
      }
   }

# strings
/(?s)((u|U)?(r|R)?)("""|''')(.*?)\4/ : {
      region {
         type=string;
      }

      region ${5} {
         index=prose;         
      }  
}

/((u|U)?(r|R)?)"/ : {
       context {
           /\\./: ;
           /$/m : exit;
           "\"" : exit;
       }
       region ${ALL} {
         type=string;
         index=prose;
       }
    }

/((u|U)?(r|R)?)'/ : {
       context {
           /\\./: ;
           /$/m : exit;
           "'" : exit;
       }
       region ${ALL} {
         type=string;
         index=prose;
       }
    }

#numeric literals
/(0(x|X)[0-9A-Fa-f]+(l|L)?)|([0-9]+(\.[0-9]*)?|\.[0-9]+)((e|E)(\+|-)?[0-9]+)?(l|L|j|J)?/ : {
       region {
          type=numeric;
       }
   }

# keywords
/(a(nd|ssert)|break|c(lass|ontinue)|de(f|l)\
|e(l(if|se(|:))|x(cept(|:)|ec))|f(inally|or|rom)\
|global|i(f|mport|n|s)|lambda|not|or|p(ass|rint)\
|r(aise|eturn)|try(|:)|while|yield)\b/ : {
      region {
        type=keyword;
        index=word;
      }
  }



}