@@ -89,56 +89,57 @@ testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
89
89
augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
90
90
'<<=' | '>>=' | '**=' | '//=')
91
91
# For normal and annotated assignments, additional restrictions enforced by the interpreter
92
- del_stmt: 'del' exprlist
93
- pass_stmt: 'pass'
92
+ del_stmt: ( 'del' | 'usuń') exprlist
93
+ pass_stmt: 'pass' | 'odpocznij'
94
94
flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt
95
- break_stmt: 'break'
96
- continue_stmt: 'continue'
97
- return_stmt: 'return' [testlist_star_expr]
95
+ break_stmt: 'break' | 'przerwij'
96
+ continue_stmt: 'continue' | 'kontynuuj'
97
+ return_stmt: ( 'return' | 'zwróć') [testlist_star_expr]
98
98
yield_stmt: yield_expr
99
- raise_stmt: 'raise' [test ['from' test]]
99
+ raise_stmt: ( 'raise' | 'wznieś') [test [( 'from' | 'ode') test]]
100
100
import_stmt: import_name | import_from
101
- import_name: 'import' dotted_as_names
101
+ import_name: ( 'import' | 'załaduj') dotted_as_names
102
102
# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
103
- import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
104
- 'import' ('*' | '(' import_as_names ')' | import_as_names))
105
- import_as_name: NAME ['as' NAME]
106
- dotted_as_name: dotted_name ['as' NAME]
103
+ import_from: (( 'from' | 'ode') (('.' | '...')* dotted_name | ('.' | '...')+)
104
+ ( 'import' | 'załaduj') ('*' | '(' import_as_names ')' | import_as_names))
105
+ import_as_name: NAME [( 'as' | 'jako') NAME]
106
+ dotted_as_name: dotted_name [( 'as' | 'jako') NAME]
107
107
import_as_names: import_as_name (',' import_as_name)* [',']
108
108
dotted_as_names: dotted_as_name (',' dotted_as_name)*
109
109
dotted_name: NAME ('.' NAME)*
110
- global_stmt: 'global' NAME (',' NAME)*
111
- nonlocal_stmt: 'nonlocal' NAME (',' NAME)*
112
- assert_stmt: 'assert' test [',' test]
110
+ global_stmt: ( 'global' | 'światowy') NAME (',' NAME)*
111
+ nonlocal_stmt: ( 'nonlocal' | 'nielokalny') NAME (',' NAME)*
112
+ assert_stmt: ( 'assert' | 'zapewnij') test [',' test]
113
113
114
114
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
115
115
async_stmt: ASYNC (funcdef | with_stmt | for_stmt)
116
- if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite]
117
- while_stmt: 'while' namedexpr_test ':' suite ['else' ':' suite]
118
- for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite]
119
- try_stmt: ('try' ':' suite
116
+ if_stmt: ( 'if' | 'jeżeli') namedexpr_test ':' suite (( 'elif' | 'albo') namedexpr_test ':' suite)* [( 'else' | 'inaczej') ':' suite]
117
+ while_stmt: ( 'while' | 'dopóki') namedexpr_test ':' suite [( 'else' | 'ostatecznie') ':' suite]
118
+ for_stmt: ( 'for' | 'dla') exprlist ( 'in' | 'spośród') testlist ':' [TYPE_COMMENT] suite [( 'else' | 'ostatecznie') ':' suite]
119
+ try_stmt: (( 'try' | 'spróbuj') ':' suite
120
120
((except_clause ':' suite)+
121
- ['else' ':' suite]
122
- ['finally' ':' suite] |
123
- 'finally' ':' suite))
124
- with_stmt: 'with' with_item (',' with_item)* ':' [TYPE_COMMENT] suite
125
- with_item: test ['as' expr]
121
+ [( 'else' | 'TODO_jak_to_nazwać') ':' suite]
122
+ [( 'finally' | 'ostatecznie') ':' suite] |
123
+ ( 'finally' | 'ostatecznie') ':' suite))
124
+ with_stmt: ( 'with' | 'weźże') with_item (',' with_item)* ':' [TYPE_COMMENT] suite
125
+ with_item: test [( 'as' | 'jako') expr]
126
126
# NB compile.c makes sure that the default except clause is last
127
- except_clause: 'except' [test ['as' NAME]]
127
+ except_clause: ( 'except' | 'złap') [test [( 'as' | 'jako') NAME]]
128
128
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
129
129
130
130
namedexpr_test: test [':=' test]
131
- test: or_test ['if' or_test 'else' test] | lambdef
131
+ test: or_test [( 'if' | 'jeżeli') or_test ( 'else' | 'inaczej') test] | lambdef
132
132
test_nocond: or_test | lambdef_nocond
133
- lambdef: 'lambda' [varargslist] ':' test
134
- lambdef_nocond: 'lambda' [varargslist] ':' test_nocond
135
- or_test: and_test ('or' and_test)*
136
- and_test: not_test ('and' not_test)*
137
- not_test: 'not' not_test | comparison
133
+ lambdef: ('lambda' | 'anonim') [varargslist] ':' test
134
+ lambdef_nocond: ('lambda' | 'anonim') [varargslist] ':' test_nocond
135
+ or_test: and_test (('or' | 'lub') and_test)*
136
+ # Note(sdatko): nie definiujemy `and` jako `i`, ponieważ to popularny iterator...
137
+ and_test: not_test (('and' | 'oraz') not_test)*
138
+ not_test: ('not' | 'nie') not_test | comparison
138
139
comparison: expr (comp_op expr)*
139
140
# <> isn't actually a valid comparison operator in Python. It's here for the
140
141
# sake of a __future__ import described in PEP 401 (which really works :-)
141
- comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
142
+ comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'wewnątrz'|' not' 'in'|'poza'|' is'|'jest'|' is' 'not'|'nie' 'jest '
142
143
star_expr: '*' expr
143
144
expr: xor_expr ('|' xor_expr)*
144
145
xor_expr: and_expr ('^' and_expr)*
@@ -152,7 +153,7 @@ atom_expr: [AWAIT] atom trailer*
152
153
atom: ('(' [yield_expr|testlist_comp] ')' |
153
154
'[' [testlist_comp] ']' |
154
155
'{' [dictorsetmaker] '}' |
155
- NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')
156
+ NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False' | 'Nic' | 'Prawda' | 'Fałsz' )
156
157
testlist_comp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
157
158
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
158
159
subscriptlist: subscript (',' subscript)* [',']
@@ -165,7 +166,7 @@ dictorsetmaker: ( ((test ':' test | '**' expr)
165
166
((test | star_expr)
166
167
(comp_for | (',' (test | star_expr))* [','])) )
167
168
168
- classdef: 'class' NAME ['(' [arglist] ')'] ':' suite
169
+ classdef: ( 'class' | 'klasa') NAME ['(' [arglist] ')'] ':' suite
169
170
170
171
arglist: argument (',' argument)* [',']
171
172
@@ -185,15 +186,15 @@ argument: ( test [comp_for] |
185
186
'*' test )
186
187
187
188
comp_iter: comp_for | comp_if
188
- sync_comp_for: 'for' exprlist 'in' or_test [comp_iter]
189
+ sync_comp_for: ( 'for' | 'dla') exprlist ( 'in' | 'spośród') or_test [comp_iter]
189
190
comp_for: [ASYNC] sync_comp_for
190
- comp_if: 'if' test_nocond [comp_iter]
191
+ comp_if: ( 'if' | 'jeżeli') test_nocond [comp_iter]
191
192
192
193
# not used in grammar, but may appear in "node" passed from Parser to Compiler
193
194
encoding_decl: NAME
194
195
195
- yield_expr: 'yield' [yield_arg]
196
- yield_arg: 'from' test | testlist_star_expr
196
+ yield_expr: ( 'yield' | 'krzycz') [yield_arg]
197
+ yield_arg: ( 'from' | 'ode') test | testlist_star_expr
197
198
198
199
# the TYPE_COMMENT in suites is only parsed for funcdefs,
199
200
# but can't go elsewhere due to ambiguity
0 commit comments