summaryrefslogtreecommitdiff
path: root/Cython/Compiler/Lexicon.py
diff options
context:
space:
mode:
Diffstat (limited to 'Cython/Compiler/Lexicon.py')
-rw-r--r--Cython/Compiler/Lexicon.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Cython/Compiler/Lexicon.py b/Cython/Compiler/Lexicon.py
index dade469e7..f1282c87b 100644
--- a/Cython/Compiler/Lexicon.py
+++ b/Cython/Compiler/Lexicon.py
@@ -66,6 +66,7 @@ def make_lexicon():
escapeseq = Str("\\") + (two_oct | three_oct | two_hex |
Str('u') + four_hex | Str('x') + two_hex | AnyChar)
+
deco = Str("@")
bra = Any("([{")
ket = Any(")]}")
@@ -74,9 +75,12 @@ def make_lexicon():
"+=", "-=", "*=", "/=", "%=", "|=", "^=", "&=",
"<<=", ">>=", "**=", "//=")
spaces = Rep1(Any(" \t\f"))
- comment = Str("#") + Rep(AnyBut("\n"))
escaped_newline = Str("\\\n")
lineterm = Eol + Opt(Str("\n"))
+
+ comment_start = Str("#")
+ comment = comment_start + Rep(AnyBut("\n"))
+ option_comment = comment_start + Str("cython:") + Rep(AnyBut("\n"))
return Lexicon([
(name, 'IDENT'),
@@ -93,11 +97,13 @@ def make_lexicon():
#(stringlit, 'STRING'),
(beginstring, Method('begin_string_action')),
+ (option_comment, 'option_comment'),
(comment, IGNORE),
(spaces, IGNORE),
(escaped_newline, IGNORE),
State('INDENT', [
+ (option_comment + lineterm, 'option_comment'),
(Opt(spaces) + Opt(comment) + lineterm, IGNORE),
(indentation, Method('indentation_action')),
(Eof, Method('eof_action'))