MCPcopy Create free account
hub / github.com/chibash/stone / FuncParser

Class FuncParser

src/stone/FuncParser.java:7–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import stone.ast.DefStmnt;
6
7public class FuncParser extends BasicParser {
8 Parser param = rule().identifier(reserved);
9 Parser params = rule(ParameterList.class)
10 .ast(param).repeat(rule().sep(",").ast(param));
11 Parser paramList = rule().sep("(").maybe(params).sep(")");
12 Parser def = rule(DefStmnt.class)
13 .sep("def").identifier(reserved).ast(paramList).ast(block);
14 Parser args = rule(Arguments.class)
15 .ast(expr).repeat(rule().sep(",").ast(expr));
16 Parser postfix = rule().sep("(").maybe(args).sep(")");
17
18 public FuncParser() {
19 reserved.add(")");
20 primary.repeat(postfix);
21 simple.option(args);
22 program.insertChoice(def);
23 }
24}

Callers

nothing calls this directly

Calls 6

identifierMethod · 0.80
ruleMethod · 0.80
repeatMethod · 0.80
astMethod · 0.80
sepMethod · 0.80
maybeMethod · 0.80

Tested by

no test coverage detected