public class RuleRetDecl : RuleSequence { //-> BASETYPE [S NAME ] (, BASETYPE [S NAME])* public RuleRetDecl(Rule Parent) : base(Parent) { RuleAlternative w = new RuleAlternative(this); RuleSequence u = new RuleSequence(this); u.AddNode(new RuleBaseType(this)); u.AddNode(new RuleSpace(this)); u.AddNode(new RuleName(this)); w.AddNode(u); u = new RuleSequence(this); u.AddNode(new RuleBaseType(this)); w.AddNode(u); this.AddNode(new RuleRegex(this, "->" + s_ManyWhitespace, this)); this.AddNode(w); RuleSequence x = new RuleSequence(this); x.AddNode(new RuleSeparator(this)); x.AddNode(w); RuleMultiple y = new RuleMultiple(this, 0); y.AddNode(x); this.AddNode(y); }
public class RuleParams : RuleMultiple { // NAME S (, S NAME S )* public RuleParams(Rule Parent) : base(Parent, 0) { RuleAlternative par = new RuleAlternative(m_Parent); par.AddNode(new RuleName(m_Parent)); par.AddNode(new RuleNumber(m_Parent)); par.AddNode(new RuleString(m_Parent)); par.AddNode(new RuleBool(m_Parent)); RuleSequence z = new RuleSequence(this); z.AddNode(par); RuleSequence x = new RuleSequence(this); x.AddNode(new RuleSeparator(this)); x.AddNode(z); RuleMultiple y = new RuleMultiple(this, 0); y.AddNode(x); RuleSequence w = new RuleSequence(this); w.AddNode(z); w.AddNode(y); this.AddNode(w); }
public class RuleBoolExpr : RuleSequence { //RuleBoolVarExpr (S ('||' / '&&') S RuleBoolVarExpr)*; public RuleBoolExpr(Rule Parent) : base(Parent) { this.AddNode(new RuleBoolVarExpr(Parent)); RuleSequence x = new RuleSequence(Parent); x.AddNode(new RuleRegex(m_Parent, "(\\|\\||\\&\\&)", this)); //todo Number <= Number bool!=bool \\=\\=|\\>\\=|\\<\\=|\\>|\\<|\\!\\= x.AddNode(new RuleBoolVarExpr(Parent)); RuleMultiple y = new RuleMultiple(Parent, 0); y.AddNode(x); this.AddNode(y); }
public class RuleMultExpr : RuleSequence { //power_expression (S ('*' / '/') S power_expression)*; public RuleMultExpr(Rule Parent) : base(Parent) { this.AddNode(new RulePlusExpr(Parent)); RuleSequence x = new RuleSequence(Parent); x.AddNode(new RuleRegex(m_Parent, "(\\*|/)", this)); x.AddNode(new RulePlusExpr(Parent)); RuleMultiple y = new RuleMultiple(Parent, 0); y.AddNode(x); this.AddNode(y); }
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 RuleExpr : RuleSequence { //multiplicative_expression (S ('+' / '-') S multiplicative_expression)* public RuleExpr(Rule Parent) : base(Parent) { m_Parent = this; this.AddNode(new RuleSpaceOptional(m_Parent)); this.AddNode(new RuleMultExpr(m_Parent)); RuleSequence x = new RuleSequence(m_Parent); x.AddNode(new RuleRegex(m_Parent, "(\\+|\\-)", this)); x.AddNode(new RuleMultExpr(m_Parent)); RuleMultiple y = new RuleMultiple(m_Parent, 0); y.AddNode(x); this.AddNode(y); }
public class RuleReturn : RuleAlternative { // return or return(55,false) public RuleReturn(Rule Parent) : base(Parent) { RuleSequence x = new RuleSequence(m_Parent); x.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "return" + s_ManyWhitespace, this)); x.AddNode(new RuleEOLComment(m_Parent)); this.AddNode(x); x = new RuleSequence(m_Parent); x.AddNode(new RuleRegex(m_Parent, s_ManyWhitespace + "return" + s_ManyWhitespace, this)); x.AddNode(new RuleLPar(m_Parent)); x.AddNode(new RuleParams(m_Parent)); x.AddNode(new RuleRPar(m_Parent)); x.AddNode(new RuleEOLComment(m_Parent)); this.AddNode(x); }
private Rule addRule(RuleAlternative Collection, Rule ToAdd) { RuleSequence y = new RuleSequence(ToAdd.GetParent()); y.AddNode(ToAdd); Collection.AddNode(y); return(Collection); }
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 RuleReturns : RuleSequence { //-> NAME (, NAME)* public RuleReturns(Rule Parent) : base(Parent) { RuleSequence u = new RuleSequence(this); u.AddNode(new RuleName(this)); this.AddNode(new RuleRegex(this, "->" + s_ManyWhitespace, this)); this.AddNode(u); RuleSequence x = new RuleSequence(this); x.AddNode(new RuleSeparator(this)); x.AddNode(u); RuleMultiple y = new RuleMultiple(this, 0); y.AddNode(x); this.AddNode(y); }
public class RuleParamDecl : RuleMultiple { // BASETYPE S NAME S (, BASETYPE S NAME S )* public RuleParamDecl(Rule Parent) : base(Parent, 0) { RuleSequence z = new RuleSequence(this); z.AddNode(new RuleBaseType(this)); z.AddNode(new RuleSpace(this)); z.AddNode(new RuleName(this)); RuleSequence x = new RuleSequence(this); x.AddNode(new RuleSeparator(this)); x.AddNode(z); RuleMultiple y = new RuleMultiple(this, 0); y.AddNode(x); RuleSequence w = new RuleSequence(this); w.AddNode(z); w.AddNode(y); this.AddNode(w); }
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)); }
public class RuleNameInstance : RuleAlternative { // Station. but also Station[X]. Station["5"]. Station[5]. public RuleNameInstance(Rule Parent) : base(Parent) { RuleAlternative x = new RuleAlternative(m_Parent); x.AddNode(new RuleName(m_Parent)); x.AddNode(new RuleNumber(m_Parent)); x.AddNode(new RuleString(m_Parent)); RuleSequence y = new RuleSequence(m_Parent); y.AddNode(new RuleSpaceOptional(m_Parent)); y.AddNode(new RuleName(m_Parent)); y.AddNode(new RuleRegex(m_Parent, "\\[", this)); y.AddNode(x); y.AddNode(new RuleRegex(m_Parent, "\\]", this)); y.AddNode(new RuleRegex(m_Parent, "\\.", this)); this.AddNode(y); y = new RuleSequence(m_Parent); y.AddNode(new RuleSpaceOptional(m_Parent)); y.AddNode(new RuleName(m_Parent)); y.AddNode(new RuleRegex(m_Parent, "\\.", this)); this.AddNode(y); }