示例#1
0
 public HttpHelper(string token, string deviceRegToken) => InitClient(token, deviceRegToken);
示例#2
0
 private void analizeCode()
 {
     pile.Add("E");
     //treeSyntactic = new Tree("E");
     treeSyntactic      = new TreeAS("E");
     this.numberOfToken = 0;
     while (this.pile.Count > 0)
     {
         int    pileSize      = this.pile.Count();
         String lastInPile    = this.pile[pileSize - 1];
         token  tokenR        = this.pileTokens[numberOfToken];
         String tokenRequired = tokenR.getName();
         if (namesNoTerminal.Contains(lastInPile))
         {
             Boolean isError = true;
             foreach (RowSA row in this.tableSA)
             {
                 String nameNoTerminal = row.getRow();
                 String column         = row.getCol();
                 if (column == tokenRequired && nameNoTerminal == lastInPile)
                 {
                     //añadir a la pila el valor
                     pile.RemoveAt(pileSize - 1);
                     String values = row.getVal();
                     addDiferentsToPile(values);
                     //treeSyntactic.setValues(values);
                     if (this.numberErrors == 0)
                     {
                         treeSyntactic.setNoTerminal(nameNoTerminal, tokenR);
                     }
                     isError = false;
                     break;
                 }
             }
             if (isError == true)
             {
                 if (lastInPile != "Q'")
                 {
                     addError("Error sintactico", tokenR.getRow().ToString());
                 }
                 pile.RemoveAt(pileSize - 1);
             }
         }
         else
         {
             //el ultimo en la pila no es un no terminal
             if (lastInPile == "reduce")
             {
                 pile.RemoveAt(pileSize - 1);
             }
             else
             {
                 if (lastInPile == tokenRequired)
                 {
                     if (this.numberErrors == 0)
                     {
                         treeSyntactic.setNode(tokenR);
                     }
                     pile.RemoveAt(pileSize - 1);
                     this.numberOfToken++;
                 }
                 else
                 {
                     pile.RemoveAt(pileSize - 1);
                     addError("Se esperaba: " + lastInPile, tokenR.getRow().ToString());
                 }
             }
         }
     }
     this.form1.setTreeAS((object)this.treeSyntactic);
     if (this.numberErrors == 0)
     {
         setPrintAndReadInErrors();
     }
     //CreateTreeFile createtree = new CreateTreeFile(this.treeSyntactic);//this.treeSyntactic
     //TODO Crear arbol, crear grafico
 }
示例#3
0
        /*
         |----------------------------------------------
         |  Ejecutando Constructor Heredado
         |----------------------------------------------
         */

        public void ejecutarConstructorHeredado(lstValores parametros, elementoEntorno tablaEntorno, token linea)
        {
            cuerpoClase.lstConstructoresHeredados.ejecutarConstructorHeredad(parametros, tablaEntorno, linea);
        }
示例#4
0
 where !string.IsNullOrEmpty(token)
 let split = token.Split(':', 2)
示例#5
0
 public scanner(source source = default, ulong mode = default, bool nlsemi = default, ulong line = default, ulong col = default, bool blank = default, token tok = default, @string lit = default, bool bad = default, LitKind kind = default, Operator op = default, long prec = default)
 {
     this.source = source;
     this.mode   = mode;
     this.nlsemi = nlsemi;
     this.line   = line;
     this.col    = col;
     this.blank  = blank;
     this.tok    = tok;
     this.lit    = lit;
     this.bad    = bad;
     this.kind   = kind;
     this.op     = op;
     this.prec   = prec;
 }
示例#6
0
 return(new RepeatingToken(token, mm.min, mm.max));
示例#7
0
 GetColoredText(token, None);
        private bool tokenizer()
        {
            token newtoken = new token();

            tokens.Clear();
            int idCount = 0;

            foreach (String nLexemes in lexemes)
            {
                if (isKeyword(nLexemes))
                {
                    newtoken = new token(nLexemes, "Keyword");
                    tokens.AddLast(newtoken);
                }
                else if (isOperator(nLexemes))
                {
                    newtoken = new token(nLexemes, "Operator");
                    tokens.AddLast(newtoken);
                }
                else if (isRelop(nLexemes))
                {
                    newtoken = new token(nLexemes, "RelOp");
                    tokens.AddLast(newtoken);
                }
                else if (isPunctuation(nLexemes))
                {
                    newtoken = new token(nLexemes, "Punctuation");
                    tokens.AddLast(newtoken);
                }
                else if (isNumber(nLexemes))
                {
                    newtoken = new token(nLexemes, "NUM");
                    tokens.AddLast(newtoken);
                }
                else if (nLexemes == terminator)
                {
                    newtoken = new token(nLexemes, "Terminator");
                    tokens.AddLast(newtoken);
                }
                else if (isLiteral(nLexemes))
                {
                    newtoken = new token(nLexemes, "Literals");
                    tokens.AddLast(newtoken);
                }
                else if (isId(nLexemes))
                {
                    // using System.CodeDom.Compiler;
                    CodeDomProvider provider = CodeDomProvider.CreateProvider("C#");
                    if (provider.IsValidIdentifier(nLexemes))
                    {
                        int i = 0;
                        foreach (Identifiers id in identifier)
                        {
                            if (id.identifierName == nLexemes)
                            {
                                newtoken = new token(id.identifierName, id.identifierToken);
                                i        = 1;
                            }
                        }
                        if (i == 0)
                        {
                            Identifiers newId = new Identifiers(nLexemes, "ID" + idCount);
                            newtoken = new token(nLexemes, "ID" + idCount);
                            identifier.AddLast(newId);
                            idCount++;
                        }
                        tokens.AddLast(newtoken);
                    }
                    else
                    {
                        MessageBox.Show("Invalid Identifier: " + nLexemes);
                    }
                }
                else
                {
                    toolStripStatusLabel1.Text = "Invalid Token";
                }
            }
            return(true);
        }
示例#9
0
        private static List <token> HandleDirectives(List <token> tokens, Dictionary <string, List <token> > defines, Program.IncludeFileLocator file_locator)
        {
            List <token> ret = new List <token>();

            if (tokens == null)
            {
                return(ret);
            }

            for (int i = 0; i < tokens.Count; i++)
            {
                token tok = tokens[i];

                if (tok.type == token.token_type.preprocessor_directive)
                {
                    string directive = tok.directive;

                    if (directive == "#include")
                    {
                        HandleInclude(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#if")
                    {
                        HandleIf(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#ifdef")
                    {
                        HandleIfDef(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#define")
                    {
                        HandleDefine(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#error")
                    {
                        HandleError(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#warning")
                    {
                        HandleWarning(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#pragma")
                    {
                        HandlePragma(ret, tokens, i, defines, file_locator);
                    }
                    else if (directive == "#ifndef")
                    {
                        HandleIfndef(ret, tokens, i, defines, file_locator);
                    }
                    else
                    {
                        throw new Exception("Unsupported preprocessor directive: " + tok.value);
                    }
                }
                else
                {
                    if ((tok.type == token.token_type.identifier) && defines.ContainsKey(tok.value))
                    {
                        ret.AddRange(defines[tok.value]);
                    }
                    else
                    {
                        ret.Add(tok);
                    }
                }
            }

            return(ret);
        }
示例#10
0
        private static List <token> Tokenize(string spliced_lines)
        {
            /* The tokenizer tries to identify various preprocessor tokens, in a
             * greedy manner (i.e. it attempts to match the longest possible token
             * first)
             */

            StringBuilder cur_str = new StringBuilder();
            List <token>  ret     = new List <token>();

            int i = 0;

            while (i < spliced_lines.Length)
            {
                if (IsWhitespace(spliced_lines[i]))
                {
                    if (cur_str.ToString() != "")
                    {
                        string identifier = cur_str.ToString();

                        if (((identifier[0] == '.') && (IsDigit(identifier[1]))) || (IsDigit(identifier[0])))
                        {
                            ret.Add(new token {
                                type = token.token_type.number, value = identifier
                            });
                        }
                        else
                        {
                            ret.Add(new token {
                                type = token.token_type.identifier, value = identifier
                            });
                        }
                    }
                    cur_str = new StringBuilder();
                    i++;
                    continue;
                }

                List <token> matched_tokens = new List <token>();
                foreach (token_match tok_match in tokens)
                {
                    token tok = MatchToken(spliced_lines, i, tok_match);
                    if (tok != null)
                    {
                        matched_tokens.Add(tok);
                    }
                }

                if (matched_tokens.Count > 0)
                {
                    if (cur_str.ToString() != "")
                    {
                        string identifier = cur_str.ToString();

                        if (((identifier[0] == '.') && (IsDigit(identifier[1]))) || (IsDigit(identifier[0])))
                        {
                            ret.Add(new token {
                                type = token.token_type.number, value = identifier
                            });
                        }
                        else
                        {
                            ret.Add(new token {
                                type = token.token_type.identifier, value = identifier
                            });
                        }
                    }
                    cur_str = new StringBuilder();

                    // identify the longest token
                    token largest        = null;
                    int   largest_length = -1;

                    foreach (token matched_token in matched_tokens)
                    {
                        if (matched_token.value.Length > largest_length)
                        {
                            largest        = matched_token;
                            largest_length = matched_token.value.Length;
                        }
                    }

                    ret.Add(largest);
                    i += largest_length;
                }
                else
                {
                    cur_str.Append(spliced_lines[i]);
                    i++;
                }
            }

            return(ret);
        }
示例#11
0
        public itemEntorno getDestino(elementoEntorno elementoEntorno, itemValor item)
        {
            itemEntorno retorno = null;

            if (hayErrores())
            {
                return(retorno);
            }



            if (item.isTypeObjeto())
            {
                if (lstAtributos.listaAtributos.Count == 2)
                {
                    if (hijos.Count > 0)

                    /*
                     |----------------------------
                     | sPunto + valId + LST_CORCHETES_VAL
                     */
                    {
                        objetoClase tempObjeto = item.getObjeto();

                        String item1     = lstAtributos.listaAtributos[1].nombretoken;
                        token  nombreVar = lstAtributos.getToken(1);
                        if (item1.Equals("valId"))
                        {
                            _LST_CORCHETES_VAL lstCorchetes = (_LST_CORCHETES_VAL)getNodo("LST_CORCHETES_VAL");
                            return(getEntornoId(lstAtributos.listaAtributos[1].tok, tempObjeto.tablaEntorno.raiz, lstCorchetes.getLstInt(elementoEntorno, nombreVar)));
                        }
                    }
                    else

                    /*
                     |----------------------------
                     | sPunto + valId
                     */
                    {
                        objetoClase tempObjeto = item.getObjeto();

                        String item1     = lstAtributos.listaAtributos[1].nombretoken;
                        token  nombreVar = lstAtributos.getToken(1);
                        if (item1.Equals("valId"))
                        {
                            _LST_CORCHETES_VAL lstCorchetes = (_LST_CORCHETES_VAL)getNodo("LST_CORCHETES_VAL");
                            return(getEntornoId(lstAtributos.listaAtributos[1].tok, tempObjeto.tablaEntorno.raiz, new List <int>()));
                        }
                    }
                }
                else if (lstAtributos.listaAtributos.Count == 4)
                {
                    if (hijos.Count == 2)

                    /*
                     |----------------------------
                     | sPunto + valId + sAbreParent + LST_VAL + sCierraParent + LST_CORCHETES_VAL
                     */
                    {
                        tablaSimbolos.tablaErrores.insertErrorSemantic("No se le puede asignar un valor a la expresión metodo" + lstAtributos.getToken(1).val + "()[]", lstAtributos.getToken(1));
                    }
                    else if (hijos.Count == 1)
                    {
                        if (hijos[0].nombre.Equals("LST_VAL"))

                        /*
                         |----------------------------
                         | sPunto + valId + sAbreParent + LST_VAL + sCierraParent
                         */
                        {
                            tablaSimbolos.tablaErrores.insertErrorSemantic("No se le puede asignar un valor a la expresión metodo" + lstAtributos.getToken(1).val + "()", lstAtributos.getToken(1));
                        }
                    }
                }
            }
            else
            {
                tablaSimbolos.tablaErrores.insertErrorSyntax("[objeto.objeto]El atributo/arreglo/metodo al que se quiere acceder no es de tipo objeto", new token());
            }

            return(null);
        }
示例#12
0
        public IHttpActionResult ConnectToFacebook(LoginModel user)
        {
            if (!_cache.Contains("tokenFB"))
            {
                return(BadRequest("First login in facebook"));
            }

            dynamic tokenFB = _cache["tokenFB"];

            _cache.Remove("tokenFB");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            string hashedPassword = Auth.HashPassword(user.Password);

            List <user> users = _db.user.Where(x => x.login == user.Login && x.password == hashedPassword).ToList();

            if (users.Count != 1)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Invalid login or password")));
            }

            FacebookProvider fbProvider = new FacebookProvider();

            string   tokenValue = tokenFB.access_token;
            TimeSpan expire     = TimeSpan.FromSeconds(Double.Parse(tokenFB.expires_in.ToString()));

            dynamic userDataFB = fbProvider.GetUserData(tokenValue);
            string  email      = userDataFB.email;

            using (DbContextTransaction dbtransaction = _db.Database.BeginTransaction())
            {
                try
                {
                    user userFromDB = users.First();
                    userFromDB.mailFB = email;

                    _db.user.Attach(userFromDB);
                    _db.Entry(userFromDB).State = EntityState.Modified;
                    _db.SaveChanges();

                    token newToken = new token()
                    {
                        tokenValue = tokenValue,
                        expire     = DateTime.Now + expire,
                        type       = 1,
                        active     = true,
                        userId     = userFromDB.id
                    };

                    _db.token.Add(newToken);
                    _db.SaveChanges();

                    dbtransaction.Commit();
                }
                catch
                {
                    dbtransaction.Rollback();
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Connected to Facebook failed!")));
                }
            }
            return(Ok(tokenFB));
        }
示例#13
0
        static string generateToken()
        {
            dbDekkOnlineDataContext db = new dbDekkOnlineDataContext();
            DateTime now = DateTime.Now.Date;

            string username = ConfigurationManager.AppSettings["dekkProUsername"];
            string password = ConfigurationManager.AppSettings["dekkProPassword"];

            dekkProURL = ConfigurationManager.AppSettings["dekkProUrl"];

            var    cToken      = new token();
            var    checkTokens = (from tok in db.tokens where tok.tokDate >= now orderby tok.tokId descending select tok);
            string token       = "";

            if (checkTokens.Count() > 0)
            {
                cToken           = checkTokens.FirstOrDefault();
                token            = cToken.tokData;
                lastUpdate       = cToken.tokStockLastUpdate;
                lastUpdateCats   = cToken.tokCategoriesLastUpdate;
                lastUpdateBrands = cToken.tokBrandsLastUpdate;
            }
            else
            {
                cToken = db.tokens.FirstOrDefault();
                if (cToken == null)
                {
                    cToken = new token();
                    db.tokens.InsertOnSubmit(cToken);
                }
                else
                {
                    lastUpdate = cToken.tokStockLastUpdate;
                }
                cToken.tokDate = now;


                string         urlToken = ConfigurationManager.AppSettings["dekkProUrlTokken"];;
                HttpWebRequest myRT     = (HttpWebRequest)WebRequest.Create(urlToken);
                myRT.ContentType = "application/x-www-form-urlencoded";


                var postData = "grant_type=password";
                postData += "&username="******"&password="******"POST";
                myRT.ContentLength = data.Length;


                Stream postStream = myRT.GetRequestStream();
                postStream.Write(data, 0, data.Length);
                postStream.Flush();
                postStream.Close();

                var response = (HttpWebResponse)myRT.GetResponse();

                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                token = responseString.Split(',')[0].Split(':')[1].Substring(1).TrimEnd('"');

                cToken.tokData = token;
                db.SubmitChanges();
            }

            return(token);
        }
示例#14
0
 var(token, expires) = tokenInfo;
示例#15
0
文件: Exec.cs 项目: stazz/NuGetUtils
         await configuration.RestoreIfNeeded( token, restorer, sdkPackageID, sdkPackageVersion )
#endif
         , getFiles: getFiles
tokens.WhereAsArray(static (token, state) => IsObjectCreationToken(token, state), state));
示例#17
0
 public whitespace(token last = default, ctrlSymbol kind = default)
 {
     this.last = last;
     this.kind = kind;
 }
示例#18
0
 public void Create(token entity)
 {
     _unitOfWork.TokenRepository.Insert(entity);
     _unitOfWork.Save();
     _unitOfWork.Commit();
 }
        public itemValor getValIdCorchetes(token idVal, elementoEntorno elem, List <int> lstIndex)
        {
            itemValor retorno = new itemValor();

            retorno.setTypeNulo();

            itemEntorno et = elem.getItemValor(idVal.valLower);

            if (et != null)
            {
                if (et.dimension.Count == lstIndex.Count)
                {
                    int indiceFinal = 1;
                    //validando si no se salió de los indices
                    for (int i = 0; i < et.dimension.Count; i++)
                    {
                        if (lstIndex[i] < et.dimension[i])
                        {
                            if (i == 0)
                            //inicilizo la lista
                            {
                                indiceFinal = lstIndex[i];
                            }
                            else
                            {
                                indiceFinal = indiceFinal * et.dimension[i] + lstIndex[i];
                            }
                        }
                        else
                        {
                            tablaSimbolos.tablaErrores.insertErrorSemantic("El índice está fuera de rango de la matriz: " + idVal.val + " , rango máximo permitido para la dimensión:" + i + " es " + (et.dimension[i] - 1), idVal);
                            return(retorno);
                        }
                    }

                    //validando que no salga del arreglo de adentro

                    if (indiceFinal < et.valor.arrayValores.Count)
                    {
                        return(et.valor.arrayValores[indiceFinal]);
                    }
                    else
                    {
                        tablaSimbolos.tablaErrores.insertErrorSemantic("No se puede acceder a la posición  de la matriz: " + idVal.val, idVal);
                        return(retorno);
                    }
                    //println("El indice al que quiero acceder es al indice :" + indiceFinal + " de la matriz :" + idVal.val);
                }
                else
                {
                    tablaSimbolos.tablaErrores.insertErrorSemantic("No coinciden las dimensiones en la matriz: " + idVal.val + " para acceder a ella", idVal);
                    return(retorno);
                }
            }
            else
            {
                tablaSimbolos.tablaErrores.insertErrorSemantic("La variable : " + idVal.val + "no se encuentra en el ambito correcto para su acceso, no se ha declarado  o no tiene permisos para acceder a ella", idVal);
            }



            return(retorno);
        }
示例#20
0
throw new OperationCanceledException(token: cancellationToken);
        public itemValor getValCorchetes(token idVal, elementoEntorno elem, List <int> lstIndex, itemValor itemVal)

        /*
         |----------------------------
         | getValCorchetes
         *--------------------
         * Sireve para los metodos que retornanan arreglos
         */
        {
            itemValor retorno = new itemValor();

            retorno.setTypeNulo();

            if (hayErrores())
            {
                return(retorno);
            }

            if (itemVal.dimensiones.Count == lstIndex.Count)
            {
                int indiceFinal = 1;
                //validando si no se salió de los indices
                for (int i = 0; i < itemVal.dimensiones.Count; i++)
                {
                    if (lstIndex[i] < itemVal.dimensiones[i])
                    {
                        if (i == 0)
                        //inicilizo la lista
                        {
                            indiceFinal = lstIndex[i];
                        }
                        else
                        {
                            indiceFinal = indiceFinal * itemVal.dimensiones[i] + lstIndex[i];
                        }
                    }
                    else
                    {
                        tablaSimbolos.tablaErrores.insertErrorSemantic("El índice está fuera de rango de la matriz: " + idVal.val + " , rango máximo permitido para la dimensión:" + i + " es " + (itemVal.dimensiones[i] - 1), idVal);
                        return(retorno);
                    }
                }

                //validando que no salga del arreglo de adentro

                if (indiceFinal < itemVal.arrayValores.Count)
                {
                    return(itemVal.arrayValores[indiceFinal]);
                }
                else
                {
                    tablaSimbolos.tablaErrores.insertErrorSemantic("No se puede acceder a la posición  de la matriz: " + idVal.val, idVal);
                    return(retorno);
                }
                //println("El indice al que quiero acceder es al indice :" + indiceFinal + " de la matriz :" + idVal.val);
            }
            else
            {
                tablaSimbolos.tablaErrores.insertErrorSemantic("No coinciden las dimensiones en la matriz: " + idVal.val + " para acceder a ella", idVal);
                return(retorno);
            }
        }
示例#22
0
 if (GetExpressionType(token, compileErrors, variables, methods) == "Error")
 {
     return(false);
        /*
         |-------------------------------------------------------------------------------------------------------------------
         | EJECUCIÓN FINAL
         |-------------------------------------------------------------------------------------------------------------------
         | elementoEntorno,es el ambito actual
         | itemValor es el objeto donde voy a seguir buscandos
         | solo puedo recibir item de tipo objeto
         */

        public itemValor getValor(elementoEntorno elementoEntorno, itemValor item)
        {
            itemValor retorno = new itemValor();

            retorno.setTypeVacio();



            if (hayErrores())
            {
                return(retorno);
            }


            if (item.isTypeObjeto())
            {
                if (lstAtributos.listaAtributos.Count == 2)
                {
                    if (hijos.Count > 0)

                    /*
                     |----------------------------
                     | sPunto + valId + LST_CORCHETES_VAL
                     */
                    {
                        token      nombreVar  = lstAtributos.getToken(1);
                        nodoModelo nodoLstCor = getNodo("LST_CORCHETES_VAL");
                        if (nodoLstCor != null)
                        {
                            _LST_CORCHETES_VAL lstCorchetes = (_LST_CORCHETES_VAL)nodoLstCor;
                            List <int>         listaEntero  = lstCorchetes.getLstInt(elementoEntorno, nombreVar);
                            String             item1        = lstAtributos.listaAtributos[1].nombretoken;
                            //mapeando el indice

                            if (item1.Equals("valId"))

                            {
                                objetoClase tempObjeto = item.getObjeto();

                                if (tempObjeto != null)
                                {
                                    return(getValIdCorchetes(lstAtributos.listaAtributos[1].tok, tempObjeto.tablaEntorno.raiz, listaEntero));
                                    //return getValId(lstAtributos.listaAtributos[1].tok, tempObjeto.tablaEntorno.raiz);
                                }
                                else
                                {
                                    tablaSimbolos.tablaErrores.insertErrorSemantic("No se pudo parsear el objeto", lstAtributos.listaAtributos[1].tok);
                                    return(retorno);
                                }
                            }
                            else
                            {
                                println("sPunto + valId + LST_CORCHETES_VAL -> No viene val id");
                            }
                        }
                    }
                    else

                    /*
                     |----------------------------
                     | sPunto + valId
                     */
                    {
                        String item1 = lstAtributos.listaAtributos[1].nombretoken;

                        if (item1.Equals("valId"))

                        {
                            objetoClase tempObjeto = item.getObjeto();

                            if (tempObjeto != null)
                            {
                                return(getValId(lstAtributos.listaAtributos[1].tok, tempObjeto.tablaEntorno.raiz));
                            }
                            else
                            {
                                tablaSimbolos.tablaErrores.insertErrorSemantic("No se pudo parsear el objeto", lstAtributos.listaAtributos[1].tok);
                                return(retorno);
                            }
                        }
                    }
                }
                else if (lstAtributos.listaAtributos.Count == 4)
                {
                    if (hijos.Count == 2)

                    /*
                     |----------------------------
                     | sPunto + valId + sAbreParent + LST_VAL + sCierraParent + LST_CORCHETES_VAL
                     */
                    {
                        if (hayErrores())
                        {
                            return(retorno);
                        }

                        String esteId = lstAtributos.listaAtributos[1].nombretoken;

                        if (esteId.Equals("valId"))

                        {
                            objetoClase tempObjeto = item.getObjeto();


                            //esto es del metodo
                            nodoModelo nodoTemp               = getNodo("LST_VAL");
                            _LST_VAL   lstParametros          = (_LST_VAL)nodoTemp;
                            itemValor  itemValorRetornoMetodo = tempObjeto.ejecutarMetodoFuncion(lstAtributos.getToken(1), lstParametros.getLstValores(elementoEntorno), tempObjeto.tablaEntorno.raiz);

                            //esto es de la parte del arreglo
                            nodoModelo         nodoLstCorchetes = getNodo("LST_CORCHETES_VAL");
                            _LST_CORCHETES_VAL lstCorchetes     = (_LST_CORCHETES_VAL)nodoLstCorchetes;
                            List <int>         listaEntero      = lstCorchetes.getLstInt(elementoEntorno, lstAtributos.listaAtributos[1].tok);

                            if (itemValorRetornoMetodo.dimensiones.Count == listaEntero.Count)
                            //tienen la misma dimension
                            {
                                return(getValCorchetes(lstAtributos.getToken(1), elementoEntorno, listaEntero, itemValorRetornoMetodo));
                            }
                            else
                            //no tienen la misma dimensión.
                            {
                                tablaSimbolos.tablaErrores.insertErrorSemantic("El metodo: " + lstAtributos.getToken(1).val + " no devuelve la misma cantidad de dimensiones que a las que se quiere acceder", lstAtributos.getToken(1));
                                return(retorno);
                            }
                        }
                        else
                        {
                            println(" sPunto + valId + sAbreParent + LST_VAL + sCierraParent + LST_CORCHETES_VAL  -> no viene valId");
                            return(retorno);
                        }
                    }
                    else if (hijos.Count == 1)
                    {
                        if (hijos[0].nombre.Equals("LST_CORCHETES_VAL"))

                        /*
                         |----------------------------
                         | sPunto + valId + sAbreParent +  sCierraParent + LST_CORCHETES_VAL
                         */
                        {
                            if (hayErrores())
                            {
                                return(retorno);
                            }

                            String esteId = lstAtributos.listaAtributos[1].nombretoken;

                            if (esteId.Equals("valId"))

                            {
                                objetoClase tempObjeto = item.getObjeto();


                                //esto es del metodo
                                nodoModelo nodoTemp      = getNodo("LST_VAL");
                                lstValores sinParametros = new lstValores();
                                //elementoEntorno.este.tablaEntorno.raiz
                                itemValor itemValorRetornoMetodo = tempObjeto.ejecutarMetodoFuncion(lstAtributos.getToken(1), sinParametros, tempObjeto.tablaEntorno.raiz);

                                //esto es de la parte del arreglo
                                nodoModelo         nodoLstCorchetes = getNodo("LST_CORCHETES_VAL");
                                _LST_CORCHETES_VAL lstCorchetes     = (_LST_CORCHETES_VAL)nodoLstCorchetes;
                                List <int>         listaEntero      = lstCorchetes.getLstInt(elementoEntorno, lstAtributos.listaAtributos[1].tok);

                                if (itemValorRetornoMetodo.dimensiones.Count == listaEntero.Count)
                                //tienen la misma dimension
                                {
                                    return(getValCorchetes(lstAtributos.getToken(1), elementoEntorno, listaEntero, itemValorRetornoMetodo));
                                }
                                else
                                //no tienen la misma dimensión.
                                {
                                    tablaSimbolos.tablaErrores.insertErrorSemantic("El metodo: " + lstAtributos.getToken(1).val + " no devuelve la misma cantidad de dimensiones que a las que se quiere acceder", lstAtributos.getToken(1));
                                    return(retorno);
                                }
                            }
                            else
                            {
                                println(" sPunto + valId + sAbreParent + LST_VAL + sCierraParent + LST_CORCHETES_VAL  -> no viene valId");
                                return(retorno);
                            }
                        }
                        else if (hijos[0].nombre.Equals("LST_VAL"))

                        /*
                         |----------------------------
                         | sPunto + valId + sAbreParent + LST_VAL + sCierraParent
                         */
                        {
                            #region cuerpo
                            String esteId = lstAtributos.listaAtributos[1].nombretoken;

                            objetoClase tempObjeto = item.getObjeto();

                            if (esteId.Equals("valId"))

                            {
                                nodoModelo nodoTemp      = getNodo("LST_VAL");
                                _LST_VAL   lstParametros = (_LST_VAL)nodoTemp;
                                itemValor  reto          = tempObjeto.ejecutarMetodoFuncion(lstAtributos.getToken(1), lstParametros.getLstValores(elementoEntorno), tempObjeto.tablaEntorno.raiz);
                                reto.nombrePregunta = item.nombrePregunta;

                                return(reto);
                            }
                            else
                            {
                                println("sPunto + valId + sAbreParent + LST_VAL + sCierraParent ");
                            }

                            #endregion
                        }
                    }
                    else if (hijos.Count == 0)

                    /*
                     |----------------------------
                     | sPunto + valId + sAbreParent + sCierraParent
                     */
                    {
                        #region cuerpo
                        String esteId = lstAtributos.listaAtributos[1].nombretoken;

                        objetoClase tempObjeto = item.getObjeto();


                        println("el nombre del objeto es " + tempObjeto.cuerpoClase.nombreClase.val);
                        if (esteId.Equals("valId"))

                        {
                            nodoModelo nodoTemp      = getNodo("LST_VAL");
                            lstValores sinParametros = new lstValores();
                            return(tempObjeto.ejecutarMetodoFuncion(lstAtributos.getToken(1), sinParametros, tempObjeto.tablaEntorno.raiz));
                        }
                        else
                        {
                            println("sPunto + valId + sAbreParent + sCierraParent ");
                        }

                        #endregion
                    }
                }
            }
            else
            {
                tablaSimbolos.tablaErrores.insertErrorSyntax("[objeto.objeto]El atributo/arreglo/metodo al que se quiere acceder no es de tipo objeto", new token());
            }

            return(retorno);
        }
示例#24
0
 public opAritmetica(nodoModelo hijo1, nodoModelo hijo2, tablaSimbolos tabla, token signo) : base(hijo1, hijo2, tabla, signo)
 {
 }
示例#25
0
 return(Sort(array, progress, token, Compare(sortOrder)));
示例#26
0
                          string refreshToken = default, string scope     = default, DateTime expiration = default) => new AuthorizationInfo(
token: token ?? Token,
示例#27
0
 select(token, replacements);
示例#28
0
        //-------------------------------------------------
        //  machine_config - constructor
        //-------------------------------------------------
        public machine_config(game_driver gamedrv, emu_options options)
        {
            m_minimum_quantum = attotime.zero;
            m_gamedrv         = gamedrv;
            m_options         = options;
            m_root_device     = null;
            m_default_layouts = new Dictionary <string, internal_layout>();  //([] (char const *a, char const *b) { return 0 > std::strcmp(a, b); })
            m_current_device  = null;


            // add the root device
            device_add("root", gamedrv.type, 0);

            // intialize slot devices - make sure that any required devices have been allocated
            foreach (device_slot_interface slot in new slot_interface_iterator(root_device()))
            {
                device_t owner            = slot.device();
                string   slot_option_name = owner.tag().Substring(1); // + 1;

                // figure out which device goes into this slot
                bool   has_option = options.has_slot_option(slot_option_name);
                string selval;
                bool   is_default;
                if (!has_option)
                {
                    // The only time we should be getting here is when emuopts.cpp is invoking
                    // us to evaluate slot/image options, and the internal state of emuopts.cpp has
                    // not caught up yet
                    selval     = slot.default_option();
                    is_default = true;
                }
                else
                {
                    slot_option opt = options.slot_option(slot_option_name);
                    selval     = opt.value().c_str();
                    is_default = !opt.specified();
                }

                if (!string.IsNullOrEmpty(selval))
                {
                    // TODO: make this thing more self-contained so it can apply itself - shouldn't need to know all this here
                    device_slot_interface.slot_option option = slot.option(selval);

                    if ((option != null) && (is_default || option.selectable()))
                    {
                        // create the device
                        using (token tok = begin_configuration(owner))
                        {
                            device_t new_dev = device_add(option.name(), option.devtype(), option.clock());
                            slot.set_card_device(new_dev);

                            string default_bios = option.default_bios();
                            if (!string.IsNullOrEmpty(default_bios))
                            {
                                new_dev.set_default_bios_tag(default_bios);
                            }

                            var additions = option.machine_config();
                            if (additions != null)
                            {
                                additions(this, new_dev);
                            }

                            input_device_default [] input_device_defaults = option.input_device_defaults();
                            if (input_device_defaults != null)
                            {
                                new_dev.set_input_default(input_device_defaults);
                            }
                        }
                    }
                    else
                    {
                        throw new emu_fatalerror("Unknown slot option '{0}' in slot '{1}'", selval, owner.tag().Substring(1));
                    }
                }
            }

            // then notify all devices that their configuration is complete
            foreach (device_t device in new device_iterator(root_device()))
            {
                if (!device.configured())
                {
                    device.config_complete();
                }
            }
        }
示例#29
0
 public And(nodoModelo hijo1, nodoModelo hijo2, tablaSimbolos tabla, token signo) : base(hijo1, hijo2, tabla, signo)
 {
 }
示例#30
0
            public token nextToken()
            {
                if (stop) return current = new token(-1, -1, true, "eof", "eof");
                if (pos == file.Length)
                {
                    stop = true;
                    return current = new token(startCol, startRow, true, lexeme, stanje);
                }
                if (file[pos] == '\n')
                {
                    col = 1;
                    row++;
                    pos++;
                    return nextToken();
                }
                if (file[pos] == ' ' || file[pos] == '\t' || file[pos] == '\r')
                {
                    pos++;
                    col++;
                    return nextToken();
                }

                if (abeceda.IndexOf(file[pos]) == -1) throw new Exception("Napaka v datoteki, znak ni del abecede");

                String produkcija = pravila[stanje][abeceda.IndexOf(file[pos])];
                if (produkcija == "~" && končna.IndexOf(stanje) == -1)
                {//produkcije ni v tabeli, stanje pa ni končno
                    throw new Exception("Napaka v datoteki, nisem našel končne produkcije");
                }

                if ((produkcija == "~" || pos == file.Length) && končna.IndexOf(stanje) != -1)
                {//produkcije ni v tabeli, stanje je pa končno, vrnemo token.

                    String oldLexeme = lexeme;
                    String oldStanje = stanje;
                    stanje = "start";
                    lexeme = "";
                    int oldCol = startCol, oldRow = startRow;
                    startCol = col;
                    startRow = row;
                    //int oldPos = pos;
                    //pos++;
                    //col++;

                    return current = new token(oldCol, oldRow, false, oldLexeme, oldStanje);
                }

                //produkcija je veljavna
                lexeme += file[pos];
                stanje = produkcija;
                pos++;
                col++;
                return nextToken();
            }
示例#31
0
文件: token.cs 项目: zjmit/go2cs
 private static uint length(this token t)
 {
     return(uint32((t - matchType) >> (int)(lengthShift)));
 }