コード例 #1
0
 public void Visit(TokenSymbol tok)
 {
     if (tok.Line < FromLine || tok.Line > ToLine)
     {
         return;
     }
     //Npp.StyleText((int)TextStyle.Default, tok.StartPosition, tok.EndPosition);
 }
コード例 #2
0
        public NeoNep5Service(IClient client) : base(client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            GetTokenBalance     = new TokenBalanceOf(client);
            GetTokenDecimals    = new TokenDecimals(client);
            GetTokenName        = new TokenName(client);
            GetTokenTotalSupply = new TokenTotalSupply(client);
            GetTokenSymbol      = new TokenSymbol(client);
        }
コード例 #3
0
ファイル: SyntaxHighlightVisitor.cs プロジェクト: zhitian/3P
        public void Visit(TokenSymbol tok)
        {
            SciStyleId style = SciStyleId.Default;

            if (_includeDepth > 0 && tok.Value == "}")
            {
                _includeDepth--;
                style = SciStyleId.Include;
            }
            else if (tok.EndPosition - tok.StartPosition == 1 && _operatorChars.Contains(tok.Value[0]))
            {
                style = SciStyleId.Operator;
            }
            SetStyling(tok.EndPosition - tok.StartPosition, style);
        }
コード例 #4
0
        public NeoNep5Service(IClient client, string tokenScriptHash) : base(client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (string.IsNullOrEmpty(tokenScriptHash))
            {
                throw new ArgumentNullException(nameof(tokenScriptHash));
            }

            GetTokenBalance     = new TokenBalanceOf(client, tokenScriptHash);
            GetTokenDecimals    = new TokenDecimals(client, tokenScriptHash);
            GetTokenName        = new TokenName(client, tokenScriptHash);
            GetTokenTotalSupply = new TokenTotalSupply(client, tokenScriptHash);
            GetTokenSymbol      = new TokenSymbol(client, tokenScriptHash);
        }
コード例 #5
0
 //TokenKeyWord
 ///////////////> AbstractToken
 //TokenName
 /// <summary>
 /// Tokenize single word and resolve if it is keyword or name
 /// </summary>
 /// <param name="str"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <returns></returns>
 AbstractToken WordTokenize(string str, int from, out int to)
 {
     to = from;
     if (str[from] == '_' || char.IsLetter(str[from]))
     {
         int  i  = from;
         bool ok = true;
         while (i < str.Length)
         {
             if (separators.Contains(str[i]))
             {
                 break;
             }
             if (!(str[i] == '_' || char.IsLetterOrDigit(str[i])))
             {
                 ok = false;
                 break;
             }
             i++;
         }
         if (ok)
         {
             to = i;
             string res = str.Substring(from, to - from);
             if (keywords.ContainsKey(res))
             {
                 return(keywords[res]);
             }
             else
             {
                 return(new TokenSymbol(res));
             }
         }
     }
     else
     {
         int i = from;
         if (i + 2 < str.Length && str[i] == str[i + 2] && str[i] == '\'')
         {
             AbstractToken result = new TokenSymbol($"{str[i + 1]}");
             to = i + 3;
             return(result);
         }
     }
     return(null);
 }
コード例 #6
0
        public string GetCoinTransferTxRaw(UserId toAddress, TokenSymbol token, ulong amount, ulong fees, uint blockHeight)
        {
            var tx = new CoinTransferTx()
            {
                Fees        = fees,
                TxUid       = UserId,
                ValidHeight = (uint)blockHeight,
                Transfers   = new Vector <CoinTransferTx.SingleTransfer>()
                {
                    new CoinTransferTx.SingleTransfer()
                    {
                        ToUid      = toAddress,
                        CoinSymbol = token,
                        CoinAmount = amount
                    }
                }
            };

            var raw = tx.GetSiginedRaw(_key);

            return(raw);
        }
コード例 #7
0
        /// <summary>
        /// Query the connector details.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public override PairConnector GetPairConnector(TokenSymbol input)
        {
            var       targetConnector  = State.Connectors[input.Symbol];
            Connector relatedConnector = null;

            if (targetConnector != null)
            {
                relatedConnector = State.Connectors[targetConnector.RelatedSymbol];
            }
            if (targetConnector != null && targetConnector.IsDepositAccount)
            {
                return new PairConnector
                       {
                           ResourceConnector = relatedConnector,
                           DepositConnector  = targetConnector
                       }
            }
            ;
            return(new PairConnector
            {
                ResourceConnector = targetConnector,
                DepositConnector = relatedConnector
            });
        }
コード例 #8
0
 private static bool IsRepeatedSymbolSequenceEnding(TokenSymbol previous, TokenSymbol current) => previous != current && previous != TokenSymbol.None && _compressionOptimizableTokens.Contains(previous);
コード例 #9
0
        private string[] SymbolToLines(TokenSymbol symbol, int repeated, int indentLevels)
        {
            switch (symbol)
            {
                case TokenSymbol.Decrement:
                    if (repeated == 1)
                    {
                        return new[] { $"{GetIndents(indentLevels)}buffer[index]--;" };
                    }
                    else
                    {
                        return new[] { $"{GetIndents(indentLevels)}buffer[index] -= {repeated};" };
                    }
                case TokenSymbol.Increment:
                    if (repeated == 1)
                    {
                        return new[] { $"{GetIndents(indentLevels)}buffer[index]++;" };
                    }
                    else
                    {
                        return new[] { $"{GetIndents(indentLevels)}buffer[index] += {repeated};" };
                    }
                case TokenSymbol.InputCharacter:
                    return new[] { $"{GetIndents(indentLevels)}buffer[index] = ReadChar();" };
                case TokenSymbol.LoopBegin:
                    return new[] { "", $"{GetIndents(indentLevels)}while (buffer[index] != 0)", $"{GetIndents(indentLevels)}{{" };
                case TokenSymbol.LoopEnd:
                    return new[] { $"{GetIndents(indentLevels)}}}", "" };
                case TokenSymbol.MoveLeft:
                    if (repeated == 1)
                    {
                        return new[] { $"{GetIndents(indentLevels)}index--;" };
                    }
                    else
                    {
                        return new[] { $"{GetIndents(indentLevels)}index -= {repeated};" };
                    }
                case TokenSymbol.MoveRight:
                    if (repeated == 1)
                    {
                        return new[] { $"{GetIndents(indentLevels)}index++;" };
                    }
                    else
                    {
                        return new[] { $"{GetIndents(indentLevels)}index += {repeated};" };
                    }
                case TokenSymbol.OutputValue:
                    return new[] { $"{GetIndents(indentLevels)}Console.Write((char)buffer[index]);" };
            }

            return null;
        }
コード例 #10
0
 public void Visit(TokenSymbol tok)
 {
     AppendEverything(tok);
     NbItems++;
 }
コード例 #11
0
ファイル: TokenConverterContract.cs プロジェクト: zhxymh/AElf
 /// <summary>
 /// Query the connector details.
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public override Connector GetConnector(TokenSymbol input)
 {
     return(State.Connectors[input.Symbol]);
 }
コード例 #12
0
        public override async Task <Invoke> ExecuteAsync(IClient client)
        {
            var symbol = new TokenSymbol(client, Settings.GetNep5TokenHash());

            return(await symbol.SendRequestAsync());
        }