public PapMethod(XElement element, string overrideName = null)
        {
            if (overrideName != null)
            {
                Name = overrideName;
            }
            else
            {
                Name = element.Attribute("name")?.Value;
                if (Name == null)
                {
                    throw new InvalidPapException("Methode enthält kein Namensattribut");
                }
            }

            Statements    = new PapSyntaxTreeNodeStatementList(element);
            Documentation = element.GetPreviousComment();
        }
Beispiel #2
0
        public PapSyntaxTreeNodeIf(XElement element)
        {
            Condition = element.Attribute("expr")?.Value;
            if (Condition == null)
            {
                throw new InvalidPapException("IF-Element enthält kein expr-Attribut");
            }

            var then = element.Element("THEN");
            var els  = element.Element("ELSE");

            if (then == null)
            {
                throw new InvalidPapException("IF-Element enthält kein THEN-Unterelement");
            }

            ThenStatements = new PapSyntaxTreeNodeStatementList(then);
            if (els != null)
            {
                ElseStatements = new PapSyntaxTreeNodeStatementList(els);
            }
        }
Beispiel #3
0
 public override StatementBuilder VisitStatementList(PapSyntaxTreeNodeStatementList node)
 {
     return(new MultipleStatementBuilder(node.Nodes.Select(Visit).ToList()));
 }
Beispiel #4
0
 public abstract TResult VisitStatementList(PapSyntaxTreeNodeStatementList node);