public void Visit(TokenSymbol tok) { if (tok.Line < FromLine || tok.Line > ToLine) { return; } //Npp.StyleText((int)TextStyle.Default, tok.StartPosition, tok.EndPosition); }
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); }
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); }
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); }
//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); }
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); }
/// <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 }); }
private static bool IsRepeatedSymbolSequenceEnding(TokenSymbol previous, TokenSymbol current) => previous != current && previous != TokenSymbol.None && _compressionOptimizableTokens.Contains(previous);
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; }
public void Visit(TokenSymbol tok) { AppendEverything(tok); NbItems++; }
/// <summary> /// Query the connector details. /// </summary> /// <param name="input"></param> /// <returns></returns> public override Connector GetConnector(TokenSymbol input) { return(State.Connectors[input.Symbol]); }
public override async Task <Invoke> ExecuteAsync(IClient client) { var symbol = new TokenSymbol(client, Settings.GetNep5TokenHash()); return(await symbol.SendRequestAsync()); }