summaryrefslogtreecommitdiff
path: root/Cython/Parser
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@gmail.com>2014-08-21 23:55:28 -0700
committerRobert Bradshaw <robertwb@gmail.com>2014-08-21 23:55:28 -0700
commit5cb207830ad71b38d46299eef59bbef77dff6c92 (patch)
treeb7cc2d5b835f7509e142fc1f50c964400f3cf996 /Cython/Parser
parent09f79172ae336bb352f917c096492e372695ed4b (diff)
downloadcython-5cb207830ad71b38d46299eef59bbef77dff6c92.tar.gz
Address, sizeof, and type.
Diffstat (limited to 'Cython/Parser')
-rw-r--r--Cython/Parser/Grammar13
1 files changed, 11 insertions, 2 deletions
diff --git a/Cython/Parser/Grammar b/Cython/Parser/Grammar
index 4c3f33da3..ee88d9730 100644
--- a/Cython/Parser/Grammar
+++ b/Cython/Parser/Grammar
@@ -98,7 +98,7 @@ and_expr: shift_expr ('&' shift_expr)*
shift_expr: arith_expr (('<<'|'>>') arith_expr)*
arith_expr: term (('+'|'-') term)*
term: factor (('*'|'/'|'%'|'//') factor)*
-factor: ('+'|'-'|'~') factor | power
+factor: ('+'|'-'|'~') factor | power | address | size_of | cast
power: atom trailer* ['**' factor]
atom: ('(' [yield_expr|testlist_comp] ')' |
'[' [listmaker] ']' |
@@ -120,7 +120,7 @@ dictorsetmaker: ( (test ':' test (comp_for | (',' test ':' test)* [','])) |
classdef: 'class' NAME ['(' [testlist] ')'] ':' suite
arglist: (argument ',')* (argument [',']
- |'*' test (',' argument)* [',' '**' test]
+ |'*' test (',' argument)* [',' '**' test]
|'**' test)
# The reason that keywords are test nodes instead of NAME is that using NAME
# results in an ambiguity. ast.c makes sure it's a NAME.
@@ -140,3 +140,12 @@ testlist1: test (',' test)*
encoding_decl: NAME
yield_expr: 'yield' [testlist]
+
+
+# Cython extensions
+
+type: NAME
+
+address: '&' factor
+cast: '<' type ['?'] '>' factor
+size_of: 'sizeof' '(' (type) ')'