Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
353cdf0e
Commit
353cdf0e
authored
Aug 22, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Misc small grammar tweaks.
parent
c490c8d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+1
-1
Cython/Parser/ConcreteSyntaxTree.pyx
Cython/Parser/ConcreteSyntaxTree.pyx
+3
-2
Cython/Parser/Grammar
Cython/Parser/Grammar
+10
-9
No files found.
Cython/Compiler/Main.py
View file @
353cdf0e
...
@@ -692,7 +692,7 @@ default_options = dict(
...
@@ -692,7 +692,7 @@ default_options = dict(
relative_path_in_code_position_comments
=
True
,
relative_path_in_code_position_comments
=
True
,
c_line_in_traceback
=
True
,
c_line_in_traceback
=
True
,
language_level
=
2
,
language_level
=
2
,
formal_grammar
=
Fals
e
,
formal_grammar
=
Tru
e
,
gdb_debug
=
False
,
gdb_debug
=
False
,
compile_time_env
=
None
,
compile_time_env
=
None
,
common_utility_include_dir
=
None
,
common_utility_include_dir
=
None
,
...
...
Cython/Parser/ConcreteSyntaxTree.pyx
View file @
353cdf0e
...
@@ -62,7 +62,8 @@ def handle_includes(source, path):
...
@@ -62,7 +62,8 @@ def handle_includes(source, path):
if
not
os
.
path
.
exists
(
included
):
if
not
os
.
path
.
exists
(
included
):
return
include_line
.
group
(
0
)
+
' # no such path: '
+
included
return
include_line
.
group
(
0
)
+
' # no such path: '
+
included
return
handle_includes
(
open
(
included
).
read
(),
path
)
return
handle_includes
(
open
(
included
).
read
(),
path
)
return
re
.
sub
(
r'^include\
s+([^
\n]+)\
s+(#.*)?$
', include_here, source, flags=re.M)
# TODO: Proper string tokenizing.
return
re
.
sub
(
r'^include\
s+([^
\n]+[\'"])\
s*(#.*)?$
', include_here, source, flags=re.M)
def p_module(path):
def p_module(path):
cdef perrdetail err
cdef perrdetail err
...
@@ -81,7 +82,7 @@ def p_module(path):
...
@@ -81,7 +82,7 @@ def p_module(path):
&err,
&err,
&flags)
&flags)
if n:
if n:
print_tree(n)
#
print_tree(n)
PyNode_Free(n)
PyNode_Free(n)
else:
else:
PyParser_SetError(&err)
PyParser_SetError(&err)
Cython/Parser/Grammar
View file @
353cdf0e
...
@@ -59,14 +59,15 @@ dotted_as_name: dotted_name ['as' PY_NAME]
...
@@ -59,14 +59,15 @@ dotted_as_name: dotted_name ['as' PY_NAME]
import_as_names: import_as_name (',' import_as_name)* [',']
import_as_names: import_as_name (',' import_as_name)* [',']
dotted_as_names: dotted_as_name (',' dotted_as_name)*
dotted_as_names: dotted_as_name (',' dotted_as_name)*
dotted_name: PY_NAME ('.' PY_NAME)*
dotted_name: PY_NAME ('.' PY_NAME)*
global_stmt:
'global'
PY_NAME (',' PY_NAME)*
global_stmt:
('global' | 'nonlocal')
PY_NAME (',' PY_NAME)*
exec_stmt: 'exec' expr ['in' test [',' test]]
exec_stmt: 'exec' expr ['in' test [',' test]]
assert_stmt: 'assert' test [',' test]
assert_stmt: 'assert' test [',' test]
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
while_stmt: 'while' test ':' suite ['else' ':' suite]
while_stmt: 'while' test ':' suite ['else' ':' suite]
for_stmt: 'for' exprlist ('in' testlist | 'from' expr comp_op PY_NAME comp_op expr ['by' expr])':' suite ['else' ':' suite]
for_stmt: 'for' exprlist ('in' testlist | for_from_clause)':' suite ['else' ':' suite]
for_from_clause: 'from' expr comp_op PY_NAME comp_op expr ['by' expr]
try_stmt: ('try' ':' suite
try_stmt: ('try' ':' suite
((except_clause ':' suite)+
((except_clause ':' suite)+
['else' ':' suite]
['else' ':' suite]
...
@@ -110,7 +111,7 @@ atom: ('(' [yield_expr|testlist_comp] ')' |
...
@@ -110,7 +111,7 @@ atom: ('(' [yield_expr|testlist_comp] ')' |
listmaker: test ( list_for | (',' test)* [','] )
listmaker: test ( list_for | (',' test)* [','] )
testlist_comp: test ( comp_for | (',' test)* [','] )
testlist_comp: test ( comp_for | (',' test)* [','] )
lambdef: 'lambda' [varargslist] ':' test
lambdef: 'lambda' [varargslist] ':' test
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.'
PY_NAME
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.'
(PY_NAME | 'sizeof')
subscriptlist: subscript (',' subscript)* [',']
subscriptlist: subscript (',' subscript)* [',']
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
sliceop: ':' [test]
sliceop: ':' [test]
...
@@ -129,11 +130,11 @@ arglist: (argument ',')* (argument [',']
...
@@ -129,11 +130,11 @@ arglist: (argument ',')* (argument [',']
argument: test [comp_for] | test '=' test
argument: test [comp_for] | test '=' test
list_iter: list_for | list_if
list_iter: list_for | list_if
list_for: 'for' exprlist
'in' testlist_safe [list_iter]
list_for: 'for' exprlist
('in' testlist_safe [list_iter] | for_from_clause)
list_if: 'if' old_test [list_iter]
list_if: 'if' old_test [list_iter]
comp_iter: comp_for | comp_if
comp_iter: comp_for | comp_if
comp_for: 'for' exprlist
'in' or_test [comp_iter]
comp_for: 'for' exprlist
('in' or_test [comp_iter] | for_from_clause)
comp_if: 'if' old_test [comp_iter]
comp_if: 'if' old_test [comp_iter]
testlist1: test (',' test)*
testlist1: test (',' test)*
...
@@ -141,7 +142,7 @@ testlist1: test (',' test)*
...
@@ -141,7 +142,7 @@ testlist1: test (',' test)*
# not used in grammar, but may appear in "node" passed from Parser to Compiler
# not used in grammar, but may appear in "node" passed from Parser to Compiler
encoding_decl: NAME
encoding_decl: NAME
yield_expr: 'yield' [testlist]
yield_expr: 'yield' [
'from'] [
testlist]
# Cython extensions
# Cython extensions
...
@@ -152,7 +153,7 @@ longness: 'char' | 'short' | 'long' | 'long' 'long'
...
@@ -152,7 +153,7 @@ longness: 'char' | 'short' | 'long' | 'long' 'long'
int_type: signedness [longness] | longness | [signedness] [longness] ('int' | 'double') | 'complex'
int_type: signedness [longness] | longness | [signedness] [longness] ('int' | 'double') | 'complex'
type: ['const'] (NAME ('.' PY_NAME)* | int_type | '(' type ')') ['complex'] [type_qualifiers]
type: ['const'] (NAME ('.' PY_NAME)* | int_type | '(' type ')') ['complex'] [type_qualifiers]
maybe_typed_name: ['const'] (NAME [('.' PY_NAME)* ['complex'] [type_qualifiers] NAME] | (int_type | '(' type ')') ['complex'] [type_qualifiers] NAME)
maybe_typed_name: ['const'] (NAME [('.' PY_NAME)* ['complex'] [type_qualifiers] NAME] | (int_type | '(' type ')') ['complex'] [type_qualifiers] NAME)
['not' NAME]
teplate_params: '[' NAME (',' NAME)* ']'
teplate_params: '[' NAME (',' NAME)* ']'
type_qualifiers: type_qualifier+
type_qualifiers: type_qualifier+
type_qualifier: '*' | '**' | '&' | type_index
type_qualifier: '*' | '**' | '&' | type_index
...
@@ -180,7 +181,7 @@ cvar_decl: [visibility] type cname (NEWLINE | cfunc)
...
@@ -180,7 +181,7 @@ cvar_decl: [visibility] type cname (NEWLINE | cfunc)
cvar_def: [visibility] maybe_typed_name (['=' test] (',' PY_NAME ['=' test])* NEWLINE | cfunc)
cvar_def: [visibility] maybe_typed_name (['=' test] (',' PY_NAME ['=' test])* NEWLINE | cfunc)
visibility: 'public' | 'api' | 'readonly'
visibility: 'public' | 'api' | 'readonly'
cfunc: [teplate_params] parameters [
gil_spec] [exception_value
] (':' suite | NEWLINE)
cfunc: [teplate_params] parameters [
exception_value] [gil_spec
] (':' suite | NEWLINE)
exception_value: 'except' (['?'] expr | '*' | '+' [PY_NAME])
exception_value: 'except' (['?'] expr | '*' | '+' [PY_NAME])
gil_spec: 'with' ('gil' | 'nogil') | 'nogil'
gil_spec: 'with' ('gil' | 'nogil') | 'nogil'
...
@@ -200,6 +201,6 @@ extern_block: 'extern' (cvar_decl | 'from' ('*' | STRING) ['namespace' STRING] [
...
@@ -200,6 +201,6 @@ extern_block: 'extern' (cvar_decl | 'from' ('*' | STRING) ['namespace' STRING] [
extern_suite: NEWLINE INDENT (['cdef' | 'cpdef'] (cvar_decl | cdef_type_decl) | ctypedef_stmt)+ DEDENT
extern_suite: NEWLINE INDENT (['cdef' | 'cpdef'] (cvar_decl | cdef_type_decl) | ctypedef_stmt)+ DEDENT
cy_type_kwd: 'struct' | 'union' | 'fused' | 'cppclass' | 'int' | 'double' | 'complex'
cy_type_kwd: 'struct' | 'union' | 'fused' | 'cppclass' | 'int' | 'double' | 'complex'
cy_kwd: cy_type_kwd | signedness | longness | visibility | 'gil' | 'nogil' | 'namespace' | 'const' | 'by' | 'extern'
cy_kwd: cy_type_kwd | signedness | longness | visibility | 'gil' | 'nogil' | 'namespace' | 'const' | 'by' | 'extern'
| 'namespace'
PY_NAME: NAME | cy_kwd
PY_NAME: NAME | cy_kwd
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment