Beispiel #1
0
        public override IAst Parse(Token raw)
        {
            var re = new WhenStmt();

            var exspretion = raw.RawHeader.Replace("when", ""/* Replace is fine becuse only one when is vaild in statment */).Trim().Remove(0, 1);
            exspretion = exspretion.Remove(exspretion.Length - 1, 1);

            re.Expression = Parser.ParseExpression(new Token() { Raw = exspretion, Position = raw.Position - "when".Length });

            foreach (var i in raw.Body)
            {
                re.Body.AddRange(IAst.ParseToken(i));
            }

            return re;
        }
Beispiel #2
0
        public override IAst Parse(Token raw)
        {
            var re = new WhenStmt();

            var exspretion = raw.RawHeader.Replace("when", "" /* Replace is fine becuse only one when is vaild in statment */).Trim().Remove(0, 1);

            exspretion = exspretion.Remove(exspretion.Length - 1, 1);

            re.Expression = Parser.ParseExpression(new Token()
            {
                Raw = exspretion, Position = raw.Position - "when".Length
            });

            foreach (var i in raw.Body)
            {
                re.Body.AddRange(IAst.ParseToken(i));
            }

            return(re);
        }