diff options
-rw-r--r-- | doc/ply.html | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/doc/ply.html b/doc/ply.html index 30905e2..b35ba44 100644 --- a/doc/ply.html +++ b/doc/ply.html @@ -558,15 +558,12 @@ column information as a separate step. For instance, just count backwards unti <blockquote> <pre> -# Compute column. +# Compute column. # input is the input text string # token is a token instance def find_column(input, token): - last_cr = input.rfind('\n', 0, token.lexpos) - if last_cr < 0: - last_cr = 0 - column = (token.lexpos - last_cr) + 1 - return column + line_start = input.rfind('\n', 0, token.lexpos) + 1 + return (token.lexpos - line_start) + 1 </pre> </blockquote> |