Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
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
Container Registry
Model registry
Operate
Environments
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
66d8885d
Commit
66d8885d
authored
7 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/parse: Pass rule_id to push_result_token, instead of passing rule_t*.
parent
815a8cd1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/parse.c
+6
-6
6 additions, 6 deletions
py/parse.c
with
6 additions
and
6 deletions
py/parse.c
+
6
−
6
View file @
66d8885d
...
...
@@ -414,7 +414,7 @@ STATIC mp_parse_node_t mp_parse_node_new_small_int_checked(parser_t *parser, mp_
return
mp_parse_node_new_small_int
(
val
);
}
STATIC
void
push_result_token
(
parser_t
*
parser
,
const
rule
_t
*
rule
)
{
STATIC
void
push_result_token
(
parser_t
*
parser
,
uint8
_t
rule
_id
)
{
mp_parse_node_t
pn
;
mp_lexer_t
*
lex
=
parser
->
lexer
;
if
(
lex
->
tok_kind
==
MP_TOKEN_NAME
)
{
...
...
@@ -422,7 +422,7 @@ STATIC void push_result_token(parser_t *parser, const rule_t *rule) {
#if MICROPY_COMP_CONST
// if name is a standalone identifier, look it up in the table of dynamic constants
mp_map_elem_t
*
elem
;
if
(
rule
->
rule
_id
==
RULE_atom
if
(
rule_id
==
RULE_atom
&&
(
elem
=
mp_map_lookup
(
&
parser
->
consts
,
MP_OBJ_NEW_QSTR
(
id
),
MP_MAP_LOOKUP
))
!=
NULL
)
{
if
(
MP_OBJ_IS_SMALL_INT
(
elem
->
value
))
{
pn
=
mp_parse_node_new_small_int_checked
(
parser
,
elem
->
value
);
...
...
@@ -433,7 +433,7 @@ STATIC void push_result_token(parser_t *parser, const rule_t *rule) {
pn
=
mp_parse_node_new_leaf
(
MP_PARSE_NODE_ID
,
id
);
}
#else
(
void
)
rule
;
(
void
)
rule
_id
;
pn
=
mp_parse_node_new_leaf
(
MP_PARSE_NODE_ID
,
id
);
#endif
}
else
if
(
lex
->
tok_kind
==
MP_TOKEN_INTEGER
)
{
...
...
@@ -846,7 +846,7 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
uint16_t
kind
=
rule
->
arg
[
i
]
&
RULE_ARG_KIND_MASK
;
if
(
kind
==
RULE_ARG_TOK
)
{
if
(
lex
->
tok_kind
==
(
rule
->
arg
[
i
]
&
RULE_ARG_ARG_MASK
))
{
push_result_token
(
&
parser
,
rule
);
push_result_token
(
&
parser
,
rule
->
rule_id
);
mp_lexer_to_next
(
lex
);
goto
next_rule
;
}
...
...
@@ -890,7 +890,7 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
if
(
lex
->
tok_kind
==
tok_kind
)
{
// matched token
if
(
tok_kind
==
MP_TOKEN_NAME
)
{
push_result_token
(
&
parser
,
rule
);
push_result_token
(
&
parser
,
rule
->
rule_id
);
}
mp_lexer_to_next
(
lex
);
}
else
{
...
...
@@ -1022,7 +1022,7 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
if
(
i
&
1
&
n
)
{
// separators which are tokens are not pushed to result stack
}
else
{
push_result_token
(
&
parser
,
rule
);
push_result_token
(
&
parser
,
rule
->
rule_id
);
}
mp_lexer_to_next
(
lex
);
// got element of list, so continue parsing list
...
...
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