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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
af01f9aa
Commit
af01f9aa
authored
Aug 22, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup grammar
parent
dc658c46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
Cython/Parser/Grammar
Cython/Parser/Grammar
+14
-4
No files found.
Cython/Parser/Grammar
View file @
af01f9aa
...
...
@@ -146,6 +146,7 @@ yield_expr: 'yield' [testlist]
# Cython extensions
type: NAME
maybe_typed_name: NAME [('.' NAME)* NAME]
teplate_params: '[' NAME (',' NAME)* ']'
address: '&' factor
...
...
@@ -153,11 +154,20 @@ cast: '<' type ['?'] '>' factor
size_of: 'sizeof' '(' (type) ')'
new_expr: 'new' type '(' [arglist] ')'
cdef_stmt: ('cdef' | 'cpdef') (classdef | cdef_decl | extern_block)
cdef_decl: cvar_decl | struct | enum | fused | cppclass
cdef_stmt: ('cdef' | 'cpdef') (cvar_def | cdef_type_decl | extern_block)
cdef_type_decl: ctype_decl | fused | cclass
ctype_decl: struct | enum | cppclass
# These two are similar but can't be used in an or clause
# as it would cause ambiguity in the LL(1) parser.
# Requires a type
cvar_decl: type NAME NEWLINE
# Allows an assignment
cvar_def: maybe_typed_name NEWLINE
ctypedef_stmt: 'ctypedef' (cvar_decl | struct | enum)
cclass: classdef
fused: 'fused' NAME ':' NEWLINE INDENT ( type NEWLINE)+ DEDENT
enum: 'enum' [NAME] (NEWLINE | ':' enum_suite)
enum_suite: NEWLINE INDENT (NAME ['=' NUMBER] NEWLINE | pass_stmt NEWLINE)+ DEDENT
...
...
@@ -165,7 +175,7 @@ struct: ('struct' | 'union') NAME (NEWLINE | (':' struct_suite))
struct_suite: NEWLINE INDENT (cvar_decl | pass_stmt NEWLINE)+ DEDENT
cppclass: 'cppclass' NAME [teplate_params] [cppclass_bases] (NEWLINE | ':' cppclass_suite)
cppclass_bases: '(' dotted_name (',' dotted_name [teplate_params])*')'
cppclass_suite: NEWLINE INDENT (c
def
_decl | pass_stmt NEWLINE)+ DEDENT
cppclass_suite: NEWLINE INDENT (c
var_decl | ctype
_decl | pass_stmt NEWLINE)+ DEDENT
extern_block: 'extern' 'from' ('*' | STRING) ['namespace' STRING] ':' (pass_stmt | extern_suite)
extern_suite: NEWLINE INDENT (['cdef' | 'cpdef']
cdef_decl
| ctypedef_stmt)+ DEDENT
extern_suite: NEWLINE INDENT (['cdef' | 'cpdef']
(cvar_decl | cdef_type_decl)
| ctypedef_stmt)+ DEDENT
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