Skip to content

Commit

Permalink
Fix: make AST_GRAMMAR importable
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-zeller committed Oct 14, 2023
1 parent 05d337c commit da47e81
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions notebooks/PythonFuzzer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,7 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"AST_CONSTANTS_GRAMMAR : Grammar = {\n",
"AST_CONSTANTS_GRAMMAR: Grammar = {\n",
" '<start>': [ '<expr>' ],\n",
"\n",
" # Expressions\n",
Expand Down Expand Up @@ -942,7 +941,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_COMPOSITES_GRAMMAR : Grammar = extend_grammar(\n",
"AST_COMPOSITES_GRAMMAR: Grammar = extend_grammar(\n",
" AST_CONSTANTS_GRAMMAR, {\n",
" '<expr>': AST_CONSTANTS_GRAMMAR['<expr>'] + [\n",
" '<Dict>', '<Set>', '<List>', '<Tuple>'\n",
Expand Down Expand Up @@ -1083,7 +1082,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_EXPRS_GRAMMAR : Grammar = extend_grammar(AST_COMPOSITES_GRAMMAR, {\n",
"AST_EXPRS_GRAMMAR: Grammar = extend_grammar(AST_COMPOSITES_GRAMMAR, {\n",
" '<expr>': AST_COMPOSITES_GRAMMAR['<expr>'] + [\n",
" '<BoolOp>', '<BinOp>', '<UnaryOp>', '<Compare>',\n",
" ],\n",
Expand Down Expand Up @@ -1270,7 +1269,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_IDS_GRAMMAR : Grammar = extend_grammar(AST_EXPRS_GRAMMAR, {\n",
"AST_IDS_GRAMMAR: Grammar = extend_grammar(AST_EXPRS_GRAMMAR, {\n",
" '<expr>': AST_EXPRS_GRAMMAR['<expr>'] + [\n",
" '<Name>', '<Call>'\n",
" ],\n",
Expand Down Expand Up @@ -1416,7 +1415,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_ATTRS_GRAMMAR : Grammar = extend_grammar(AST_IDS_GRAMMAR, {\n",
"AST_ATTRS_GRAMMAR: Grammar = extend_grammar(AST_IDS_GRAMMAR, {\n",
" '<expr>': AST_IDS_GRAMMAR['<expr>'] + [\n",
" '<Attribute>', '<Subscript>', '<Starred>',\n",
" ],\n",
Expand Down Expand Up @@ -1505,7 +1504,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_ASSIGNMENTS_GRAMMAR : Grammar = extend_grammar(AST_ATTRS_GRAMMAR, {\n",
"AST_ASSIGNMENTS_GRAMMAR: Grammar = extend_grammar(AST_ATTRS_GRAMMAR, {\n",
" '<start>': [ '<stmt>' ],\n",
"\n",
" '<stmt>': [\n",
Expand Down Expand Up @@ -1611,7 +1610,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_STMTS_GRAMMAR : Grammar = extend_grammar(AST_ASSIGNMENTS_GRAMMAR, {\n",
"AST_STMTS_GRAMMAR: Grammar = extend_grammar(AST_ASSIGNMENTS_GRAMMAR, {\n",
" '<start>': [ '<stmt>' ],\n",
"\n",
" '<stmt>': AST_ASSIGNMENTS_GRAMMAR['<stmt>'] + [\n",
Expand Down Expand Up @@ -1720,7 +1719,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_WITH_GRAMMAR : Grammar = extend_grammar(AST_STMTS_GRAMMAR, {\n",
"AST_WITH_GRAMMAR: Grammar = extend_grammar(AST_STMTS_GRAMMAR, {\n",
" '<stmt>': AST_STMTS_GRAMMAR['<stmt>'] + [ '<With>' ],\n",
" '<With>': [ 'With(items=<withitem_list>, body=<nonempty_stmt_list><type_comment>?)' ],\n",
"\n",
Expand Down Expand Up @@ -1843,8 +1842,8 @@
"metadata": {},
"outputs": [],
"source": [
"AST_DEFS_GRAMMAR : Grammar = extend_grammar(AST_STMTS_GRAMMAR, {\n",
" '<stmt>': AST_STMTS_GRAMMAR['<stmt>'] + [ '<FunctionDef>' ],\n",
"AST_DEFS_GRAMMAR: Grammar = extend_grammar(AST_WITH_GRAMMAR, {\n",
" '<stmt>': AST_WITH_GRAMMAR['<stmt>'] + [ '<FunctionDef>' ],\n",
"\n",
" '<FunctionDef>': [\n",
" 'FunctionDef(name=<identifier>, args=<arguments>, body=<nonempty_stmt_list>, decorator_list=<expr_list><returns>?<type_comment>?)'\n",
Expand Down Expand Up @@ -1920,7 +1919,7 @@
"metadata": {},
"outputs": [],
"source": [
"AST_MODULE_GRAMMAR : Grammar = extend_grammar(AST_DEFS_GRAMMAR, {\n",
"AST_MODULE_GRAMMAR: Grammar = extend_grammar(AST_DEFS_GRAMMAR, {\n",
" '<start>': [ '<mod>' ],\n",
" '<mod>': [ '<Module>' ],\n",
" '<Module>': [ 'Module(body=<nonempty_stmt_list>, type_ignores=<type_ignore_list>)'],\n",
Expand Down

0 comments on commit da47e81

Please sign in to comment.