private static Operator CreateLinkedList(LinkedList list, IParseTree root, ScriptLoadingContext lcontext) { Operator opfound = 0; foreach (IParseTree tt in root.EnumChilds()) { Node n = null; if (tt is LuaParser.OperatorbinaryContext) { Operator op = ParseBinaryOperator(tt); opfound |= op; n = new Node() { Op = op }; } else { if (tt is LuaParser.Exp_binaryContext) { Operator op = CreateLinkedList(list, tt, lcontext); opfound |= op; } else { n = new Node() { Expr = NodeFactory.CreateExpression(tt, lcontext) }; } } if (n != null) { if (list.Nodes == null) { list.Nodes = list.Last = n; } else { list.Last.Next = n; n.Prev = list.Last; list.Last = n; } } } return(opfound); }
public static bool IsOperatorExpression(IParseTree tree) { return(tree.EnumChilds().Any(t => s_OperatorTypes.Contains(t.GetType()))); }