Skip to content

Commit

Permalink
Bug 641036 - python script with #!/usr/bin/python are not documented …
Browse files Browse the repository at this point in the history
…correctly

Handle #! at first line as a special comment (on *nix systems starts the mentioned program with the file as input)
  • Loading branch information
albert-github committed Dec 25, 2015
1 parent 165498d commit 322d09d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pyscanner.l
Expand Up @@ -487,6 +487,7 @@ STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR")
KEYWORD ("lambda"|"import"|"class"|"assert"|"as"|"from"|"global"|"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")
POUNDCOMMENT "#"[^#\n][^\n]*
SCRIPTCOMMENT "#!".*
STARTDOCSYMS "##"
Expand Down Expand Up @@ -609,6 +610,9 @@ STARTDOCSYMS "##"
"@staticmethod" {
gstat=TRUE;
}
{SCRIPTCOMMENT} { // Unix type script comment
if (yyLineNr != 1) REJECT;
}
{POUNDCOMMENT} { // normal comment
g_packageCommentAllowed = FALSE;
}
Expand Down

0 comments on commit 322d09d

Please sign in to comment.