Example #1
0
        protected LNode SingleExprInside(Token group, string stmtType, bool allowUnassignedVarDecl, ref VList <LNode> list)
        {
            int oldCount = list.Count;

            list = AppendExprsInside(group, list, false, allowUnassignedVarDecl);
            if (list.Count != oldCount + 1)
            {
                if (list.Count <= oldCount)
                {
                    LNode result = F.Id(S.Missing, group.StartIndex + 1, group.StartIndex + 1);
                    list.Add(result);
                    Error(result, "Missing expression inside '{0}'", stmtType);
                    return(result);
                }
                else
                {
                    Error(list[1], "There should be only one expression inside '{0}'", stmtType);
                    list.Resize(oldCount + 1);
                }
            }
            return(list[0]);
        }