1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/**
* Name: python
* Description: Python programming language.
* Author: Andy Eskilsson <Andy.Eskilsson@telelogic.se>
*/
state python_string extends Highlight
{
/\\\\./ {
language_print ($0);
}
python_string_end {
language_print ($0);
return;
}
}
state python extends HighlightEntry
{
/* Comments. */
/#/ {
comment_face (true);
language_print ($0);
call (eat_one_line);
comment_face (false);
}
/* Python strings */
/(\"\"\"|[\'][\'][\'])/ {
python_string_end = regexp($0);
string_face (true);
language_print ($0);
call (python_string);
string_face (false);
}
/(\"|[\'])/ {
python_string_end = regexp( $0 );
string_face (true);
language_print ($0);
call (python_string);
string_face (false);
}
/* Function */
/([ \t]*)(def)([ \t]+)([^(]*)/ {
/* indentation */
language_print ($1);
/* def */
keyword_face (true);
language_print ($2);
keyword_face (false);
/* middle */
language_print ($3);
/* Function name. */
function_name_face (true);
language_print ($4);
function_name_face (false);
}
/* Keywords
(build-re '(and assert break class continue def del elif else
else: except except: exec finally for from global if import in
is lambda not or pass print raise return try try: while
yield)) */
/\b(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/ {
keyword_face (true);
language_print ($0);
keyword_face (false);
}
}
/*
Local variables:
mode: c
End:
*/
|