Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
3997be44
Commit
3997be44
authored
11 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
Add single_input rule to grammar, for REPL.
parent
9f770c65
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/grammar.h
+5
-2
5 additions, 2 deletions
py/grammar.h
with
5 additions
and
2 deletions
py/grammar.h
+
5
−
2
View file @
3997be44
...
@@ -6,11 +6,12 @@
...
@@ -6,11 +6,12 @@
// # single_input is a single interactive statement;
// # single_input is a single interactive statement;
// # file_input is a module or sequence of commands read from an input file;
// # file_input is a module or sequence of commands read from an input file;
// # eval_input is the input for the eval() functions.
// # eval_input is the input for the eval() functions.
// # NB: compound_stmt in single_input is followed by extra NEWLINE!
// # NB: compound_stmt in single_input is followed by extra NEWLINE!
--> not in Micropython
// single_input: NEWLINE | simple_stmt | compound_stmt
NEWLINE
// single_input: NEWLINE | simple_stmt | compound_stmt
// file_input: (NEWLINE | stmt)* ENDMARKER
// file_input: (NEWLINE | stmt)* ENDMARKER
// eval_input: testlist NEWLINE* ENDMARKER
// eval_input: testlist NEWLINE* ENDMARKER
DEF_RULE
(
single_input
,
nc
,
or
(
3
),
tok
(
NEWLINE
),
rule
(
simple_stmt
),
rule
(
compound_stmt
))
DEF_RULE
(
file_input
,
nc
,
and
(
1
),
opt_rule
(
file_input_2
))
DEF_RULE
(
file_input
,
nc
,
and
(
1
),
opt_rule
(
file_input_2
))
DEF_RULE
(
file_input_2
,
c
(
generic_all_nodes
),
one_or_more
,
rule
(
file_input_3
))
DEF_RULE
(
file_input_2
,
c
(
generic_all_nodes
),
one_or_more
,
rule
(
file_input_3
))
DEF_RULE
(
file_input_3
,
nc
,
or
(
2
),
tok
(
NEWLINE
),
rule
(
stmt
))
DEF_RULE
(
file_input_3
,
nc
,
or
(
2
),
tok
(
NEWLINE
),
rule
(
stmt
))
...
@@ -129,6 +130,7 @@ DEF_RULE(name_list, nc, list, tok(NAME), tok(DEL_COMMA))
...
@@ -129,6 +130,7 @@ DEF_RULE(name_list, nc, list, tok(NAME), tok(DEL_COMMA))
DEF_RULE
(
assert_stmt
,
c
(
assert_stmt
),
and
(
3
),
tok
(
KW_ASSERT
),
rule
(
test
),
opt_rule
(
assert_stmt_extra
))
DEF_RULE
(
assert_stmt
,
c
(
assert_stmt
),
and
(
3
),
tok
(
KW_ASSERT
),
rule
(
test
),
opt_rule
(
assert_stmt_extra
))
DEF_RULE
(
assert_stmt_extra
,
nc
,
and
(
2
),
tok
(
DEL_COMMA
),
rule
(
test
))
DEF_RULE
(
assert_stmt_extra
,
nc
,
and
(
2
),
tok
(
DEL_COMMA
),
rule
(
test
))
// 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 ':' suite ['else' ':' suite]
// for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
...
@@ -139,6 +141,7 @@ DEF_RULE(assert_stmt_extra, nc, and(2), tok(DEL_COMMA), rule(test))
...
@@ -139,6 +141,7 @@ DEF_RULE(assert_stmt_extra, nc, and(2), tok(DEL_COMMA), rule(test))
// with_item: test ['as' expr]
// with_item: test ['as' expr]
// suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
// suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
DEF_RULE
(
compound_stmt
,
nc
,
or
(
8
),
rule
(
if_stmt
),
rule
(
while_stmt
),
rule
(
for_stmt
),
rule
(
try_stmt
),
rule
(
with_stmt
),
rule
(
funcdef
),
rule
(
classdef
),
rule
(
decorated
))
DEF_RULE
(
if_stmt
,
c
(
if_stmt
),
and
(
6
),
tok
(
KW_IF
),
rule
(
test
),
tok
(
DEL_COLON
),
rule
(
suite
),
opt_rule
(
if_stmt_elif_list
),
opt_rule
(
else_stmt
))
DEF_RULE
(
if_stmt
,
c
(
if_stmt
),
and
(
6
),
tok
(
KW_IF
),
rule
(
test
),
tok
(
DEL_COLON
),
rule
(
suite
),
opt_rule
(
if_stmt_elif_list
),
opt_rule
(
else_stmt
))
DEF_RULE
(
if_stmt_elif_list
,
nc
,
one_or_more
,
rule
(
if_stmt_elif
))
DEF_RULE
(
if_stmt_elif_list
,
nc
,
one_or_more
,
rule
(
if_stmt_elif
))
DEF_RULE
(
if_stmt_elif
,
nc
,
and
(
4
),
tok
(
KW_ELIF
),
rule
(
test
),
tok
(
DEL_COLON
),
rule
(
suite
))
DEF_RULE
(
if_stmt_elif
,
nc
,
and
(
4
),
tok
(
KW_ELIF
),
rule
(
test
),
tok
(
DEL_COLON
),
rule
(
suite
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment