Added a couple notes to the larger sample
This commit is contained in:
parent
891650b97d
commit
ab3b9e2fe7
@ -56,13 +56,16 @@ void parse(std::vector<TokenPtr> &tokens) {
|
||||
Rule rule = lhs << rhs;
|
||||
lhs = Str("def", true);
|
||||
rhs = Id(TokenType::Identifier, true);
|
||||
*/
|
||||
|
||||
//Rule rule(TokenType::Function_Def);
|
||||
//rule = Str("def") | Str("int");
|
||||
|
||||
//Rule rule = Str("def", false) << Id(TokenType::Identifier);
|
||||
*/
|
||||
|
||||
|
||||
//Example: "def add(x,y)"
|
||||
//To do the params for real we need kleene star and other looping parsers
|
||||
Rule params;
|
||||
Rule rule(TokenType::Function_Def);
|
||||
rule = Ign(Str("def")) << Id(TokenType::Identifier) << Ign(Str("(")) << params << Ign(Str(")"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user