示例#1
0
        ReferenceAccess direct_variable_declaratorExpr()
        {
            Id id = variable_nameExpr();

            if (peek("["))
            {
                List<Expr> indexList = new List<Expr>();
                variable_arrayExpr(indexList);

                IndiceArreglo indicearreglo = new IndiceArreglo(indexList, id.lexeme);
                return indicearreglo;
            }
            else
                return id;
        }
示例#2
0
        ReferenceAccess postId_expr(ReferenceAccess id)
        {
            switch (currentToken.Tipo)
            {
                case TokenType.LEFT_SQUARE_BRACKET:
                    List<Expr> indexList = new List<Expr>();
                    variable_arrayExpr(indexList);

                    IndiceArreglo indicearreglo = new IndiceArreglo(indexList, id.lexeme);
                    return indicearreglo;

                case TokenType.LEFT_PARENTHESIS:
                    List <Expr> parameterList = function_call();

                    LlamadaFuncion llamadafuncion = new LlamadaFuncion(id.lexeme, parameterList);
                    return llamadafuncion;

                case TokenType.DOT:
                    //List<ReferenceAccess> membersList = new List<ReferenceAccess>();
                    MiembroRegistro miembroRegistro = (MiembroRegistro)id_access(id);
                    return miembroRegistro;

                    //MiembroRegistro miembroRegistro = new MiembroRegistro(id.lexeme, membersList);
                    //return miembroRegistro;

                default:
                    throw new Exception("Error en la expresion postId linea: " + Lexer.line + " columna: " + Lexer.column + " currenttoken -> " + currentToken.Lexema);
            }
        }