Skip to content

Commit 96a1ad5

Browse files
committed
Aktualizacja słów kluczowych
1 parent 3205d1f commit 96a1ad5

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

Grammar/Grammar

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -89,56 +89,57 @@ testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
8989
augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
9090
'<<=' | '>>=' | '**=' | '//=')
9191
# 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'
9494
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]
9898
yield_stmt: yield_expr
99-
raise_stmt: 'raise' [test ['from' test]]
99+
raise_stmt: ('raise' | 'wznieś') [test [('from' | 'ode') test]]
100100
import_stmt: import_name | import_from
101-
import_name: 'import' dotted_as_names
101+
import_name: ('import' | 'załaduj') dotted_as_names
102102
# 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]
107107
import_as_names: import_as_name (',' import_as_name)* [',']
108108
dotted_as_names: dotted_as_name (',' dotted_as_name)*
109109
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]
113113

114114
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
115115
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
120120
((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]
126126
# 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]]
128128
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
129129

130130
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
132132
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
138139
comparison: expr (comp_op expr)*
139140
# <> isn't actually a valid comparison operator in Python. It's here for the
140141
# 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'
142143
star_expr: '*' expr
143144
expr: xor_expr ('|' xor_expr)*
144145
xor_expr: and_expr ('^' and_expr)*
@@ -152,7 +153,7 @@ atom_expr: [AWAIT] atom trailer*
152153
atom: ('(' [yield_expr|testlist_comp] ')' |
153154
'[' [testlist_comp] ']' |
154155
'{' [dictorsetmaker] '}' |
155-
NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')
156+
NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False' | 'Nic' | 'Prawda' | 'Fałsz')
156157
testlist_comp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
157158
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
158159
subscriptlist: subscript (',' subscript)* [',']
@@ -165,7 +166,7 @@ dictorsetmaker: ( ((test ':' test | '**' expr)
165166
((test | star_expr)
166167
(comp_for | (',' (test | star_expr))* [','])) )
167168

168-
classdef: 'class' NAME ['(' [arglist] ')'] ':' suite
169+
classdef: ('class' | 'klasa') NAME ['(' [arglist] ')'] ':' suite
169170

170171
arglist: argument (',' argument)* [',']
171172

@@ -185,15 +186,15 @@ argument: ( test [comp_for] |
185186
'*' test )
186187

187188
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]
189190
comp_for: [ASYNC] sync_comp_for
190-
comp_if: 'if' test_nocond [comp_iter]
191+
comp_if: ('if' | 'jeżeli') test_nocond [comp_iter]
191192

192193
# not used in grammar, but may appear in "node" passed from Parser to Compiler
193194
encoding_decl: NAME
194195

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
197198

198199
# the TYPE_COMMENT in suites is only parsed for funcdefs,
199200
# but can't go elsewhere due to ambiguity

0 commit comments

Comments
 (0)