diff options
-rw-r--r-- | src/pycode.l | 8 | ||||
-rw-r--r-- | src/pyscanner.l | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/pycode.l b/src/pycode.l index 65788cc..0362de4 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -190,7 +190,7 @@ SHORTSTRINGITEM ({SHORTSTRINGCHAR}|{ESCAPESEQ}) SHORTSTRINGCHAR [^\\\n"] STRINGLITERAL {STRINGPREFIX}?( {SHORTSTRING} | {LONGSTRING}) STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR") -KEYWORD ("lambda"|"import"|"class"|"assert"|"with"|"as"|"from"|"global"|"def"|"True"|"False") +KEYWORD ("lambda"|"import"|"class"|"assert"|"with"|"as"|"from"|"global"|"async"|"def"|"True"|"False") FLOWKW ("or"|"and"|"is"|"not"|"print"|"for"|"in"|"if"|"try"|"except"|"yield"|"raise"|"break"|"continue"|"pass"|"if"|"return"|"while"|"elif"|"else"|"finally") QUOTES ("\""[^"]*"\"") SINGLEQUOTES ("'"[^']*"'") @@ -302,6 +302,12 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU endFontClass(yyscanner); BEGIN( FunctionDec ); } + "async"{BB}"def"{BB} { + startFontClass(yyscanner,"keyword"); + codify(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( FunctionDec ); + } "class"{BB} { startFontClass(yyscanner,"keyword"); diff --git a/src/pyscanner.l b/src/pyscanner.l index 4a9552e..96d62ca 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -261,10 +261,20 @@ STARTDOCSYMS "##" searchFoundDef(yyscanner); BEGIN( FunctionDec ); } + ^{B}"async"{BB}"def"{BB} { // start of an async function/method definition with indent + DBG_CTX((stderr,"Found async def at %d\n",yyextra->yyLineNr)); + yyextra->indent=computeIndent(yytext); + searchFoundDef(yyscanner); + BEGIN( FunctionDec ); + } "def"{BB} { // start of a function/method definition searchFoundDef(yyscanner); BEGIN( FunctionDec ); } + "async"{BB}"def"{BB} { // start of a function/method definition + searchFoundDef(yyscanner); + BEGIN( FunctionDec ); + } ^{B}"class"{BB} { // start of a class definition with indent DBG_CTX((stderr,"Found class at %d\n",yyextra->yyLineNr)); |