private string GetTokenFromVault(TokenTypes tokenType) { var token = vault.RetrieveAll().FirstOrDefault((x) => x.Resource == tokenType.ToString()); if (token != null) { token.RetrievePassword(); return(token.Password); } return(string.Empty); }
public static string ToString(TokenTypes type) { switch (type) { case TokenTypes.oParen: return("'('"); case TokenTypes.cParen: return("')'"); case TokenTypes.oCurly: return("'{'"); case TokenTypes.cCurly: return("'}'"); } return(type.ToString()); }
public Result CheckToken(TokenTypes expectToken, Token currentToken) { if (expectToken == currentToken.Type) { return new Result() { Succes = true, Excpetion = null } } ; return(new Result { Succes = false, Excpetion = new SyntacticException($"Expected a {expectToken.ToString()} Token ", currentToken.Row, currentToken.Column) }); }
public LexerToken MatchGet(TokenTypes expected) { LexerToken t = buffer.ElementAt(consumeOffset); if (!t.IsType(expected)) { throw new Exceptions.ParsingException(string.Format( Config.UserCulture, Properties.Resources.ex_Parsing_Failed_TokenMismatch, expected.ToString(), t.Text, CurrentTokenNeighbourhood())); } Consume(); return(t); }
public void Match(TokenTypes expected, string content) { if (!buffer.ElementAt(consumeOffset).IsType(expected) || !buffer.ElementAt(consumeOffset).Text.Equals(content)) { throw new Exceptions.ParsingException(string.Format( Config.UserCulture, Properties.Resources.ex_Parsing_Failed_TokenMismatchEx, expected.ToString(), buffer.ElementAt(consumeOffset).Text, CurrentTokenNeighbourhood(), content)); } Consume(); }
public LexerToken MatchGet(TokenTypes expected) { LexerToken t = buffer.ElementAt(consumeOffset); if(!t.IsType(expected)) throw new Exceptions.ParsingException(string.Format( Config.UserCulture, Properties.Resources.ex_Parsing_Failed_TokenMismatch, expected.ToString(), t.Text, CurrentTokenNeighbourhood())); Consume(); return t; }
public void Match(TokenTypes expected, string content) { if(!buffer.ElementAt(consumeOffset).IsType(expected) || !buffer.ElementAt(consumeOffset).Text.Equals(content)) throw new Exceptions.ParsingException(string.Format( Config.UserCulture, Properties.Resources.ex_Parsing_Failed_TokenMismatchEx, expected.ToString(), buffer.ElementAt(consumeOffset).Text, CurrentTokenNeighbourhood(), content)); Consume(); }
/// <summary> /// Retrieves the method definition identified by the given token in the scope. /// </summary> /// <param name="token">The token of the method to retrieve.</param> /// <returns></returns> RuntimeMethod IModuleTypeSystem.GetMethod(TokenTypes token) { switch (TokenTypes.TableMask & token) { case TokenTypes.MethodDef: return methods[(int)(TokenTypes.RowIndexMask & token) - 1]; case TokenTypes.MemberRef: MemberRefRow row = metadata.ReadMemberRefRow(token); string nameString = metadata.ReadString(row.NameStringIdx); RuntimeType type = ((IModuleTypeSystem)this).GetType(row.ClassTableIdx); MethodSignature sig = (MethodSignature)Signature.FromMemberRefSignatureToken(metadata, row.SignatureBlobIdx); CilGenericType genericType = type as CilGenericType; if (genericType != null) { sig.ApplyGenericType(genericType.GenericArguments); } foreach (RuntimeMethod method in type.Methods) { if (method.Name != nameString) continue; if (!method.Signature.Matches(sig)) continue; return method; } throw new MissingMethodException(type.Name, nameString); case TokenTypes.MethodSpec: return DecodeMethodSpec(token); default: throw new NotSupportedException(@"Can't get method for token " + token.ToString("x")); } }
/// <summary> /// Retrieves the field definition identified by the given token in the scope. /// </summary> /// <param name="token">The token of the field to retrieve.</param> /// <returns></returns> RuntimeField IModuleTypeSystem.GetField(TokenTypes token) { switch (TokenTypes.TableMask & token) { case TokenTypes.Field: return fields[(int)(token & TokenTypes.RowIndexMask) - 1]; case TokenTypes.MemberRef: return GetFieldForMemberReference(token); default: throw new NotSupportedException(@"Can't get method for token " + token.ToString("x")); } }
public virtual BaseType GetBaseType() { return(TypesTable.Instance.GetType(Type.ToString().ToLower())); }
public void Match(TokenTypes expected) { if(!buffer.ElementAt(consumeOffset).IsType(expected)) throw new ParsingException(string.Format(MathNet.Symbolics.Properties.Resources.ex_Parsing_Failed_TokenMismatch, expected.ToString(), buffer.ElementAt(consumeOffset).Text, CurrentTokenNeighbourhood())); Consume(); }
public override string ToString() { return("Token '" + text + "' - " + types.ToString()); }
public void Match(TokenTypes expected) { if (!buffer.ElementAt(consumeOffset).IsType(expected)) { throw new ParsingException(string.Format(MathNet.Symbolics.Properties.Resources.ex_Parsing_Failed_TokenMismatch, expected.ToString(), buffer.ElementAt(consumeOffset).Text, CurrentTokenNeighbourhood())); } Consume(); }
private static string GetHeaderValue(string tokenValue, TokenTypes tokenType) { var tokenTypeName = tokenType.ToString(); return($"{tokenTypeName} {tokenValue}"); }
public string toString() { return(text + "[" + type.ToString() + "]"); }