public class RuleFunctionCall : RuleSequence { //NAME S*'(' PARAMS? ')' S* RETURNS? (COMMENT | EOL) public RuleFunctionCall(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleSpaceOptional(m_Parent)); this.AddNode(new RuleName(m_Parent)); this.AddNode(new RuleLPar(m_Parent)); RuleOption y = new RuleOption(m_Parent); y.AddNode(new RuleParams(m_Parent)); this.AddNode(y); this.AddNode(new RuleRPar(m_Parent)); y = new RuleOption(m_Parent); y.AddNode(new RuleReturns(m_Parent)); this.AddNode(y); this.AddNode(new RuleEOLComment(m_Parent)); //Todo parse catch-exception statement RuleOption cat = new RuleOption(m_Parent); RuleSequence z = new RuleSequence(m_Parent); z.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "catch", this)); z.AddNode(new RuleLPar(m_Parent)); z.AddNode(new RuleParams(m_Parent)); z.AddNode(new RuleRPar(m_Parent)); z.AddNode(new RuleEOLComment(m_Parent)); z.AddNode(new RuleLCurlPar(m_Parent)); z.AddNode(new RuleBody(m_Parent)); z.AddNode(new RuleRCurlPar(m_Parent)); cat.AddNode(z); this.AddNode(cat); }
public class RuleUsing : RuleSequence { //using STRING as NAME or using STRING public RuleUsing(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "using" + s_ManyWhitespace, this)); this.AddNode(new RuleString(m_Parent)); RuleSequence x = new RuleSequence(m_Parent); x.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "as" + s_ManyWhitespace, this)); x.AddNode(new RuleName(m_Parent)); RuleOption y = new RuleOption(m_Parent); y.AddNode(x); this.AddNode(y); this.AddNode(new RuleEOLComment(m_Parent)); }
public class RuleSwitch : RuleSequence { //'switch' S* '(' EXPRESSION ')' (COMMENT | EOL) '{' EOL //('case ' VALUE ':' EOL // ... // BREAK )? // 'default:' EOL // ... //'}' public RuleSwitch(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "\\bswitch\\b" + s_ManyWhitespace, this)); this.AddNode(new RuleLPar(m_Parent)); this.AddNode(new RuleName(m_Parent)); this.AddNode(new RuleRPar(m_Parent)); this.AddNode(new RuleEOLComment(m_Parent)); this.AddNode(new RuleLCurlPar(m_Parent)); RuleMultiple x = new RuleMultiple(m_Parent, 0); x.AddNode(new RuleSwitchCase(m_Parent)); this.AddNode(x); RuleOption y = new RuleOption(m_Parent); y.AddNode(new RuleSwitchDefault(m_Parent)); this.AddNode(y); this.AddNode(new RuleRCurlPar(m_Parent)); }
public class RuleFunctionDecl : RuleSequence { //'function ' NAME S*'(' PARAMDECL? ')' S* RETDECL? S* '{' (COMMENT | EOL) FUNCBODY '}' EOL? public RuleFunctionDecl(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "function[ \\t]+", this)); this.AddNode(new RuleName(m_Parent)); this.AddNode(new RuleLPar(m_Parent)); RuleOption y = new RuleOption(m_Parent); y.AddNode(new RuleParamDecl(m_Parent)); this.AddNode(y); this.AddNode(new RuleRPar(m_Parent)); y = new RuleOption(m_Parent); y.AddNode(new RuleRetDecl(m_Parent)); this.AddNode(y); this.AddNode(new RuleEOLComment(m_Parent)); //y = new RuleOption(m_Parent); //body is optional?? this.AddNode(new RuleLCurlPar(m_Parent)); this.AddNode(new RuleBody(m_Parent)); this.AddNode(new RuleRCurlPar(m_Parent)); //this.AddNode(y); }
public class RuleIf : RuleSequence { //'if' S* '(' EXPRESSION ')' (COMMENT | EOL) BODY ('else' (COMMENT | EOL) BODY)? public RuleIf(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "\\bif\\b" + s_ManyWhitespace, this)); this.AddNode(new RuleLPar(m_Parent)); this.AddNode(new RuleBoolExpr(m_Parent)); this.AddNode(new RuleRPar(m_Parent)); this.AddNode(new RuleEOLComment(m_Parent)); this.AddNode(new RuleLCurlPar(m_Parent)); this.AddNode(new RuleBody(m_Parent)); this.AddNode(new RuleRCurlPar(m_Parent)); RuleOption y = new RuleOption(m_Parent); RuleSequence x = new RuleSequence(m_Parent); x.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "\\belse\\b" + s_ManyWhitespace, this)); x.AddNode(new RuleEOLComment(m_Parent)); x.AddNode(new RuleLCurlPar(m_Parent)); x.AddNode(new RuleBody(m_Parent)); x.AddNode(new RuleRCurlPar(m_Parent)); y.AddNode(x); this.AddNode(y); }
public RuleDecl(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleSpaceOptional(m_Parent)); this.AddNode(new RuleBaseType(m_Parent)); this.AddNode(new RuleSpace(m_Parent)); this.AddNode(new RuleName(m_Parent)); RuleSequence z = new RuleSequence(m_Parent); z.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "=" + s_ManyWhitespace, this)); RuleAlternative x = new RuleAlternative(m_Parent); x.AddNode(new RuleString(m_Parent)); x.AddNode(new RuleBool(m_Parent)); x.AddNode(new RuleName(m_Parent)); x.AddNode(new RuleExpr(m_Parent)); z.AddNode(x); RuleOption y = new RuleOption(m_Parent); y.AddNode(z); this.AddNode(y); this.AddNode(new RuleEOLComment(m_Parent)); }