Exemple #1
0
        public Access Accesories(Access List)
        {
            try
            {
                if (currentToken.Tipo == Lexico.TipoToken.TK_PUNTO)
                {
                    currentToken = lex.NextToken();
                    if (currentToken.Tipo != Lexico.TipoToken.TK_ID)
                        throw new Exception("Error Sintactico  -- Se esperaba un ID");
                    Lexico.Token tmp = currentToken;
                    currentToken=lex.NextToken();
                    if (currentToken.Tipo == Lexico.TipoToken.TK_OPENCOR)
                    {
                        AccessArreglo accAr = new AccessArreglo();
                        accAr.Cont = ArrayDim(accAr.Cont);
                        accAr.nombre = tmp.Lexema;
                        List = accAr;
                        List.Next = Accesories(List.Next);
                    }
                    else
                    {

                        AccessMiembro accM = new AccessMiembro();
                        accM.Id = tmp.Lexema;
                        List = accM;
                        //currentToken = lex.NextToken();
                        List.Next = Accesories(List.Next);
                    }
                }
                else if (currentToken.Tipo == Lexico.TipoToken.TK_OPENCOR)
                {
                    AccessArreglo accAr = new AccessArreglo();
                    accAr.Cont = ArrayDim(accAr.Cont);
                    List = accAr;
                    List.Next = Accesories(List.Next);
                }
                else if (currentToken.Tipo == Lexico.TipoToken.TK_OPENPAR)
                {
                    currentToken = lex.NextToken();
                    AccessFunc accFun = new AccessFunc();
                    ListaExpre listaExpre = new ListaExpre();
                    Expresiones e = Expression();
                    if (e != null)
                        listaExpre.Ex.Add(e);
                    if (listaExpre.Ex.Count > 0)
                        accFun.Variables = ExpreList(listaExpre);
                    List = accFun;
                    if (currentToken.Tipo != Lexico.TipoToken.TK_CLOSEPAR)
                        throw new Exception("Error Sintactico -- Se esperaba simbolo )");
                    currentToken = lex.NextToken();
                    return List;
                }
                return List;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public Access Accesories(Access List)
        {
            try
            {
                if (currentToken.Tipo == TipoToken.TK_PUNTO)
                {
                    currentToken = lex.NextToken();
                    if (currentToken.Tipo != TipoToken.TK_ID)
                        throw new Exception("Error Sintactico - Se Esperaba un ID");
                    AccessMiembro accM = new AccessMiembro();
                    accM.Id = currentToken.Lexema;
                    List = accM;
                    currentToken = lex.NextToken();
                    List.Next = Accesories(List.Next);
                    Access a= Accesories(List.Next);

                }
                else if (currentToken.Tipo == TipoToken.TK_OPENCOR)
                {
                    AccessArreglo accAr = new AccessArreglo();
                    accAr.Cont = ArrayDim(accAr.Cont);
                    List = accAr;
                    List.Next = Accesories(List.Next);
                }
                else if (currentToken.Tipo == TipoToken.TK_OPENPAR)
                {
                    currentToken = lex.NextToken();
                    AccessFunc accFun = new AccessFunc();
                    ListaExpre listaExpre = new ListaExpre();
                    Expresiones e = Expr();
                    if(e!=null)
                        listaExpre.Ex.Add(e);
                    //if (listaExpre.Ex.Count > 0)
                    //{
                        accFun.Variables = ExprList(listaExpre);
                        List = accFun;
                        if (currentToken.Tipo != TipoToken.TK_CLOSEPAR)
                            throw new Exception("Error Sintactico - Se Esperaba un )");
                        currentToken = lex.NextToken();
                        return List;
                    /*}
                    else
                    {
                        if (currentToken.Tipo != TipoToken.TK_CLOSEPAR)
                            throw new Exception("Error Sintactico - Se Esperaba un )");
                        currentToken = lex.NextToken();
                        return null;
                    }*/
                }
                return List;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }