Function opg::gen_productions [−][src]
pub(crate) fn gen_productions(contents: &String) -> Vec<Production>
Generate production list for the grammar contents.
Input
contents
the string read from file.
Output
p
the vector of productions.
Example
let mut productions: Vec<Production> = gen_productions(&contents);
Principle
For every line in the file, split it on "->".
Then split the trimmed right side based on "|".
After processing, push the new Production
struct
into the result.