Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pierre Donat-Bouillud
audio-adaptive-scheduling
Commits
7ac2a20e
Commit
7ac2a20e
authored
Mar 04, 2019
by
Pierre Donat-Bouillud
Browse files
Fix parsing with several edges on same statement.
parent
3d1ef832
Pipeline
#737
passed with stage
in 2 minutes and 49 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
downsampling_test.ag
0 → 100644
View file @
7ac2a20e
n1 =
{
kind : "source",
in: 0,
out : 1,
text : "salut",
wcet : 20.0,
};
n2 = { kind : "plop", in : 1, out:1, wcet : 21.0,};
n3 = {kind : "plop", in: 1, out:1, wcet :20.0,};
n4 = {kind : "sink", in:1, wcet :5.0,};
n1.1 -> n2.1 -> n3.1 -> n4.1;
deadline = 50.0;
src/audiograph.pest
View file @
7ac2a20e
...
...
@@ -15,9 +15,9 @@ WHITESPACE = _{ " " | "\t" | NEWLINE }
port_ident = ${ident ~ "." ~ port}
edges = {port_ident ~ "->" ~ (edges | port_ident)}
edge = {"->" ~ port_ident}
edges = {port_ident ~ edge+}
deadline = { "deadline" ~ "=" ~ fnumber}
...
...
src/audiograph_parser.rs
View file @
7ac2a20e
...
...
@@ -89,9 +89,10 @@ pub fn parse_audiograph(audiograph : &str, buffer_size: usize, nb_channels: usiz
let
mut
edges
=
Vec
::
new
();
for
inner_rule
in
inner_rules
{
port_ident
=
inner_rule
.into_inner
();
port_ident
=
inner_rule
.into_inner
()
.next
()
.unwrap
()
.into_inner
()
;
let
dst_id
=
port_ident
.next
()
.unwrap
()
.as_str
()
.to_string
();
let
dst_port
=
port_ident
.next
()
.unwrap
()
.as_str
()
.parse
()
.unwrap
();
println!
(
"dst_id = {}; dst_port = {}"
,
dst_id
,
dst_port
);
edges
.push
(
Edge
{
src_id
,
src_port
,
dst_id
:
dst_id
.clone
(),
dst_port
});
src_id
=
dst_id
;
src_port
=
dst_port
;
...
...
@@ -158,6 +159,14 @@ mod tests {
assert!
(
audiograph
.nb_edges
()
==
6
);
}
#[test]
fn
build_audiograph_down_test
()
{
let
audiograph
=
parse_audiograph_from_file
(
"downsampling_test.ag"
,
64
,
2
,
44_100
)
.expect
(
"Impossible to open file."
);
println!
(
"Nodes={} and edges={}"
,
audiograph
.nb_nodes
(),
audiograph
.nb_edges
()
);
assert!
(
audiograph
.nb_nodes
()
==
6
);
assert!
(
audiograph
.nb_edges
()
==
7
);
}
#[test]
fn
audiograph_ident
()
{
assert!
(
AudiographParser
::
parse
(
Rule
::
ident
,
"rte45"
)
.is_ok
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment