当前位置: 首页>>代码示例>>C#>>正文


C# IToken类代码示例

本文整理汇总了C#中IToken的典型用法代码示例。如果您正苦于以下问题:C# IToken类的具体用法?C# IToken怎么用?C# IToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IToken类属于命名空间,在下文中一共展示了IToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFunctionDefinitionEndToken

		IToken GetFunctionDefinitionEndToken()
		{
			if (functionDefinitionEndToken == null) {
				functionDefinitionEndToken = ast.GetToken(methodDefinition.TokenStopIndex);
			}
			return functionDefinitionEndToken;
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:7,代码来源:JavaScriptMethodRegion.cs

示例2: ASTNode

		public ASTNode(IToken token)
		{
			_startIndex = -1;
			_stopIndex = -1;
			_childIndex = -1;
			_token = token;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:ASTNode.cs

示例3: EmitAssign

        public void EmitAssign(IToken token, object value)
        {
            EmitPop(token);

            //function.Add(AsmTemplate.Assign(token.Text, value));
               // MapFunction(token);
        }
开发者ID:jnsergio,项目名称:NPortugol,代码行数:7,代码来源:Emissor.cs

示例4: DefineTemplateAlias

        public override CompiledTemplate DefineTemplateAlias(IToken aliasT, IToken targetT)
        {
            CompiledTemplate result = base.DefineTemplateAlias(aliasT, targetT);
            _templateInformation.Add(new TemplateInformation(aliasT, targetT, result));

            return result;
        }
开发者ID:sebandraos,项目名称:LangSvcV2,代码行数:7,代码来源:TemplateGroupWrapper.cs

示例5: CreateConsumerRequest

 public IConsumerRequest CreateConsumerRequest(IOAuthContext context, IOAuthConsumerContext consumerContext, IToken token)
 {
 	if (context == null) throw new ArgumentNullException("context");
 	if (consumerContext == null) throw new ArgumentNullException("consumerContext");
 	
 	return new ConsumerRequest(context, consumerContext, token);
 }
开发者ID:javicrespo,项目名称:DevDefined.OAuth,代码行数:7,代码来源:DefaultConsumerRequestFactory.cs

示例6: Delete

 public void Delete(IToken token)
 {
     if (_tokens.ContainsKey(token.UserId))
     {
         _tokens.Remove(token.UserId);
     }
 }
开发者ID:ChrisRomp,项目名称:Xero-Net,代码行数:7,代码来源:MemoryRequestTokenStore.cs

示例7: Syntax

        protected override ParsedSyntax Syntax(ParsedSyntax left, IToken token, ParsedSyntax right)
        {
            if(left == null || right == null)
                return base.Syntax(left, token, right);

            return left.Equal(token, right);
        }
开发者ID:hahoyer,项目名称:HWClassLibrary.cs,代码行数:7,代码来源:Equal.cs

示例8: GetComments

        public static string[] GetComments(IToken[] FileTokens, List<IToken> alreadyTakenComments, int lastTokenLineNo,
            int prevTokenIndex, int nextTokenIndex, bool acn = false)
        {
            List<string> comments = new List<string>();
            int WS = acn ? acnLexer.WS : asn1Lexer.WS;
            int COMMENT = acn ? acnLexer.COMMENT : asn1Lexer.COMMENT;
            int COMMENT2 = acn ? acnLexer.COMMENT2 : asn1Lexer.COMMENT2;

            //first see if there comments on the same line

            while (nextTokenIndex >= 0 && nextTokenIndex < FileTokens.Length)
            {
                IToken t = FileTokens[nextTokenIndex++];
                if (alreadyTakenComments.Contains(t))
                {
                    break;
                }
                if (t.Line != lastTokenLineNo)
                {
                    break;
                }
                if (t.Type == WS)
                {
                    continue;
                }
                else if (t.Type == COMMENT || t.Type == COMMENT2)
                {
                        comments.Insert(0, t.Text);
                        alreadyTakenComments.Add(t);
                }
                else
                {
                    break;
                }

            }

            //if no comments were found at the same line, then look back (above)
            if (comments.Count == 0)
            {

                while (prevTokenIndex >= 0 && prevTokenIndex < FileTokens.Length)
                {
                    IToken t = FileTokens[prevTokenIndex--];
                    if (alreadyTakenComments.Contains(t))
                        break;
                    if (t.Type == WS)
                        continue;
                    else if (t.Type == COMMENT || t.Type == COMMENT2)
                    {
                            comments.Insert(0, t.Text);
                            alreadyTakenComments.Add(t);
                    }
                    else
                        break;
                }
            }

            return comments.ToArray();
        }
开发者ID:Kampbell,项目名称:asn1scc,代码行数:60,代码来源:Comments.cs

示例9: SetAccessToken

        // helper extension method to sign each JSON request with OAuth
        public static void SetAccessToken(this JsonServiceClient client, IToken access_token)
        {
            // we use a request filter to add the required OAuth header
            client.LocalHttpWebRequestFilter += webservice_request => {

                OAuthConsumerContext consumer_context = new OAuthConsumerContext ();

                consumer_context.SignatureMethod = "HMAC-SHA1";
                consumer_context.ConsumerKey = access_token.ConsumerKey;
                consumer_context.ConsumerSecret = "anyone";
                consumer_context.UseHeaderForOAuthParameters = true;

                // the OAuth process creates a signature, which uses several data from
                // the web request like method, hostname, headers etc.
                OAuthContext request_context = new OAuthContext ();
                request_context.Headers = webservice_request.Headers;
                request_context.RequestMethod = webservice_request.Method;
                request_context.RawUri = webservice_request.RequestUri;

                // now create the signature for that context
                consumer_context.SignContextWithToken (request_context, access_token);

                // BUG TODO the oauth_token is not included when generating the header,
                // this is a bug ing DevDefined.OAuth. We add it manually as a workaround
                request_context.AuthorizationHeaderParameters.Add ("oauth_token", access_token.Token);

                string oauth_header = request_context.GenerateOAuthParametersForHeader ();

                webservice_request.Headers.Add ("Authorization", oauth_header);

            };
        }
开发者ID:j-4,项目名称:tomboy-library,代码行数:33,代码来源:OAuthRestHelper.cs

示例10: AsNotQuoted

        public static string AsNotQuoted(IToken token)
        {
            if (token == null)
                return null;

            return AsNotQuoted(token.Text);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:InputString.cs

示例11: CaretToken

 public CaretToken(IToken oldToken)
     : base(oldToken)
 {
     this.channel = TokenConstants.DefaultChannel;
     this._originalToken = oldToken;
     this.type = CaretTokenType;
 }
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:7,代码来源:CaretToken.cs

示例12: CreateSignature

        public string CreateSignature(IToken token, Uri uri, string verb, string verifier = null, string callback = null)
        {
            var oAuthParameters = new OAuthParameters(
                new ConsumerKey(token.ConsumerKey),
                new TokenKey(token.TokenKey),
                "HMAC-SHA1",
                new DefaultTimestampSequence(),
                new DefaultNonceSequence(),
                string.Empty,
                "1.0",
                verifier,
                token.Session, false, callback);

            var signatureBaseString =
                new SignatureBaseString(
                    new Request
                    {
                        Url = uri,
                        Verb = verb
                    },
                    oAuthParameters);

            var signature = new HmacSha1().Sign(signatureBaseString, token.ConsumerSecret, token.TokenSecret);

            oAuthParameters.SetSignature(signature);

            return new AuthorizationHeader(oAuthParameters, string.Empty).Value;
        }
开发者ID:ChrisRomp,项目名称:Xero-Net,代码行数:28,代码来源:HmacSha1Signer.cs

示例13: GetText

 /// <summary>
 /// In our implementation, Token.TokenIndex always returns -1.
 /// We can not insert all the intermediate tokens like Antlr does in the default implementation.
 /// This method just returns the text of the starting and ending tokens.
 /// </summary>
 public override string GetText(IToken start, IToken stop)
 {
     if (start != null || stop != null)
     {
         if (start == stop)
         {
             return start.Text;
         }
         else
         {
             return start.Text + " ... " + stop.Text;
         }
     }
     else if (start != null)
     {
         return start.Text + " ...";
     }
     else if (stop != null)
     {
         return "... " + stop.Text;
     }
     else
     {
         return String.Empty;
     }
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:31,代码来源:TokensLinesTokenStream.cs

示例14: CreateToken

        public static Token2 CreateToken(IToken token)
        {
            int length = token.StopIndex - token.StartIndex + 1;
            int startPosition = token.StartIndex;
            int endPosition = token.StopIndex;
            switch (token.Type)
            {
                case Java6ColorizerLexer.DOUBLELITERAL:
                case Java6ColorizerLexer.FLOATLITERAL:
                    return new NumericLiteralToken(token.Type, startPosition, endPosition);

                case Java6ColorizerLexer.STRINGLITERAL:
                    return new StringLiteralToken(token.Type, startPosition, endPosition);

                case Java6ColorizerLexer.BLOCK_COMMENT:
                case Java6ColorizerLexer.LINE_COMMENT:
                    return new CommentLiteralToken(token.Type, startPosition, endPosition);

                case Java6ColorizerLexer.IDENTIFIER:
                    if (Keywords.Contains(token.Text))
                    {
                        return new KeywordToken(token.Type, startPosition, endPosition);
                    }
                    return new IdentifierToken(token.Type, startPosition, endPosition);
            }
            //System.Diagnostics.Debug.WriteLine(string.Format("case JavaLexer.{0}:"), );
            return new InvalidToken(token.Type, startPosition, endPosition);
        }
开发者ID:smartmobili,项目名称:parsing,代码行数:28,代码来源:TokenFactory.cs

示例15: TokenWrapper

 public TokenWrapper(IToken token, string tokenName)
 {
     TokenName = tokenName;
     Token = token;
     Type = new TokenType {Type = token.Type};
     tokenHashCode = Type.GetHashCode();
 }
开发者ID:yas4891,项目名称:MUTEX,代码行数:7,代码来源:TokenWrapper.cs


注:本文中的IToken类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。