• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Token类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ImportStatement

 public ImportStatement(Token importToken, IList<Token> importChain, IList<Token> fromChain, Token asValue)
     : base(importToken)
 {
     this.ImportChain = importChain.ToArray();
     this.FromChain = fromChain == null ? null : fromChain.ToArray();
     this.AsValue = asValue;
 }
开发者ID:blakeohare,项目名称:pyweek-sentientstorage,代码行数:7,代码来源:ImportStatement.cs


示例2: Build

        public override Token Build(Token lastToken, ScriptEngine engine, Script script, ref SourceCode sourceCode)
        {
            while ((++sourceCode).SpecialChar)
            {
            }
            if (sourceCode.Peek() != '{')
            {
                sourceCode.Throw(String.Format("Error parsing a 'do' statement, expected a '{' but got '{0}' instead.",
                                               sourceCode.Peek()));
            }
            List<List<List<Token>>> code = engine.BuildLongTokens(ref sourceCode, ref script, new[] {'}'});

            if (!sourceCode.SeekToNext("while"))
            {
                sourceCode.Throw("Error parsing a 'do' statement, was expecting a 'while' after the { } block.");
            }

            if (!sourceCode.SeekToNext('('))
            {
                sourceCode.Throw("Error parsing a 'do' statement, was expecting a '(' after 'while'.");
            }

            List<List<Token>> exitCondition = engine.BuildTokensAdvanced(ref sourceCode, ref script, new[] {')'});

            return new DoWhileToken(code, exitCondition);
        }
开发者ID:iammitch,项目名称:Slimterpreter,代码行数:26,代码来源:DoWhileBlockBuilder.cs


示例3: HttpParameter

 public HttpParameter(Token name,
                      string value)
     : this()
 {
     Name = name;
     Value = value;
 }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:HttpParameter.cs


示例4: Expect

 void Expect(Token tok)
 {
     if(Next() == tok)
         Consume();
     else
         Error();
 }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:7,代码来源:ShuntingYardExpressionParser.cs


示例5: GenericParamRow

 /// <summary>
 /// Initializes a new instance of the <see cref="GenericParamRow" /> struct.
 /// </summary>
 /// <param name="number">The number.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="owner">The owner.</param>
 /// <param name="nameString">The name string.</param>
 public GenericParamRow(ushort number, GenericParameterAttributes flags, Token owner, HeapIndexToken nameString)
 {
     Number = number;
     Flags = flags;
     Owner = owner;
     NameString = nameString;
 }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:14,代码来源:GenericParamRow.cs


示例6: AppendAnythingElse

 public override void AppendAnythingElse(TreeConstruction tree, Token token)
 {
     OnMessageRaised(new UnexpectedTokenAfterHtmlError(token.Name));
     tree.ChangeInsertionMode<InBodyInsertionMode>();
     tree.ReprocessFlag = true;
     return;
 }
开发者ID:bakera,项目名称:Test,代码行数:7,代码来源:AfterBodyInsertionMode.cs


示例7: ScriptForEachStatement

 public ScriptForEachStatement(AstNodeArgs args)
     : base(args)
 {
     name = (Token)ChildNodes[1];
       expr = (ScriptExpr)ChildNodes[3];
       statement = (ScriptStatement)ChildNodes[4];
 }
开发者ID:2yangk23,项目名称:MapleShark,代码行数:7,代码来源:ScriptForEachStatement.cs


示例8: BracketIndex

		public BracketIndex(Expression root, Token bracketToken, Expression index, Executable owner)
			: base(root.FirstToken, owner)
		{
			this.Root = root;
			this.BracketToken = bracketToken;
			this.Index = index;
		}
开发者ID:geofrey,项目名称:crayon,代码行数:7,代码来源:BracketIndex.cs


示例9: GenericRCDATAElementParsingAlgorithm

 // Text Parsing
 protected void GenericRCDATAElementParsingAlgorithm(TreeConstruction tree, Token token)
 {
     tree.InsertElementForToken((TagToken)token);
     tree.Parser.ChangeTokenState<RCDATAState>();
     tree.OriginalInsertionMode = tree.CurrentInsertionMode;
     tree.ChangeInsertionMode<TextInsertionMode>();
 }
开发者ID:bakera,项目名称:Test,代码行数:8,代码来源:InsertionMode.cs


示例10: Create

        public static AuthRequest Create(Token token, Trust trust)
        {
            Scope scope = null;

            if (trust != null)
            {
                scope = new Scope()
                {
                    Trust = trust,
                };
            }

            return new AuthRequest()
            {
                Auth = new Auth()
                {
                    Identity = new Identity()
                    {
                        Methods = new[] { "token" },
                        Token = token
                    },
                    Scope = scope
                }
            };
        }
开发者ID:skyquery,项目名称:graywulf-plugins,代码行数:25,代码来源:AuthRequest.cs


示例11: LiteralExpression

        public LiteralExpression(ScriptLoadingContext lcontext, Token t)
            : base(lcontext)
        {
            switch (t.Type)
            {
                case TokenType.Number:
                case TokenType.Number_Hex:
                case TokenType.Number_HexFloat:
                    Value = DynValue.NewNumber(t.GetNumberValue()).AsReadOnly();
                    break;
                case TokenType.String:
                case TokenType.String_Long:
                    Value = DynValue.NewString(t.Text).AsReadOnly();
                    break;
                case TokenType.True:
                    Value = DynValue.True;
                    break;
                case TokenType.False:
                    Value = DynValue.False;
                    break;
                case TokenType.Nil:
                    Value = DynValue.Nil;
                    break;
                default:
                    throw new InternalErrorException("type mismatch");
            }

            if (Value == null)
                throw new SyntaxErrorException(t, "unknown literal format near '{0}'", t.Text);

            lcontext.Lexer.Next();
        }
开发者ID:eddy5641,项目名称:moonsharp,代码行数:32,代码来源:LiteralExpression.cs


示例12: CreateTokenAsync

        public virtual async Task<string> CreateTokenAsync(Token token)
        {
            var header = await CreateHeaderAsync(token);
            var payload = await CreatePayloadAsync(token);

            return await SignAsync(new JwtSecurityToken(header, payload));
        }
开发者ID:FranceConnectSamples,项目名称:franceconnect-identity-provider-dotnet-webapi-aspnetcore,代码行数:7,代码来源:FranceConnectTokenCreationService.cs


示例13: ControlInvokation

 public ControlInvokation(Token Source, Control Control, List<Node> Arguments, Node Body)
     : base(Source)
 {
     this.Control = Control;
     this.Arguments = Arguments;
     this.Body = Body;
 }
开发者ID:Blecki,项目名称:EtcScript,代码行数:7,代码来源:ControlInvokation.cs


示例14: ValidateToken

 internal static void ValidateToken(Token token)
 {
     if (ReferenceEquals(token, null))
         throw new ArgumentNullException(nameof(token));
     if (String.IsNullOrEmpty(token.Value))
         throw new ArgumentException(nameof(token.Value));
 }
开发者ID:Microsoft,项目名称:Git-Credential-Manager-for-Windows,代码行数:7,代码来源:BaseSecureStore.cs


示例15: GenericParamRow

 /// <summary>
 /// Initializes a new instance of the <see cref="GenericParamRow"/> struct.
 /// </summary>
 /// <param name="number">The number.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="owner">The owner table idx.</param>
 /// <param name="nameStringIdx">The name string idx.</param>
 public GenericParamRow(ushort number, GenericParameterAttributes flags, Token owner, HeapIndexToken nameStringIdx)
 {
     this.number = number;
     this.flags = flags;
     this.owner = owner;
     this.nameStringIdx = nameStringIdx;
 }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:14,代码来源:GenericParamRow.cs


示例16: AssemblyRefOSRow

 /// <summary>
 /// Initializes a new instance of the <see cref="AssemblyRefOSRow"/> struct.
 /// </summary>
 /// <param name="platformId">The platform id.</param>
 /// <param name="majorVersion">The major version.</param>
 /// <param name="minorVersion">The minor version.</param>
 /// <param name="assemblyRef">The assembly ref.</param>
 public AssemblyRefOSRow(uint platformId, uint majorVersion, uint minorVersion, Token assemblyRef)
 {
     this.platformId = platformId;
     this.majorVersion = majorVersion;
     this.minorVersion = minorVersion;
     this.assemblyRef = assemblyRef;
 }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:14,代码来源:AssemblyRefOSRow.cs


示例17: ForLoopStatement

		public ForLoopStatement(ScriptLoadingContext lcontext, Token nameToken, Token forToken)
			: base(lcontext)
		{
			//	for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 

			// lexer already at the '=' ! [due to dispatching vs for-each]
			CheckTokenType(lcontext, TokenType.Op_Assignment);

			m_Start = Expression.Expr(lcontext);
			CheckTokenType(lcontext, TokenType.Comma);
			m_End = Expression.Expr(lcontext);

			if (lcontext.Lexer.Current.Type == TokenType.Comma)
			{
				lcontext.Lexer.Next();
				m_Step = Expression.Expr(lcontext);
			}
			else
			{
				m_Step = new LiteralExpression(lcontext, DynValue.NewNumber(1));
			}

			lcontext.Scope.PushBlock();
			m_VarName = lcontext.Scope.DefineLocal(nameToken.Text);
			m_RefFor = forToken.GetSourceRef(CheckTokenType(lcontext, TokenType.Do));
			m_InnerBlock = new CompositeStatement(lcontext);
			m_RefEnd = CheckTokenType(lcontext, TokenType.End).GetSourceRef();
			m_StackFrame = lcontext.Scope.PopBlock();

			lcontext.Source.Refs.Add(m_RefFor);
			lcontext.Source.Refs.Add(m_RefEnd);
		}		
开发者ID:eddy5641,项目名称:LuaSharp,代码行数:32,代码来源:ForLoopStatement.cs


示例18: Lexer

		public Lexer(TextReader rdr)
		{
			this.sb = new StringBuilder();
			this.lineNumber = 1;
			this.rdr = rdr;
			this.tok = Token.EOFile;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:Lexer.cs


示例19: Parse

 public static StatementNode Parse(Token[] tokens, ref int i)
 {
     if (IfNode.IsIf(tokens, i))
     {
         return IfNode.Parse(tokens, ref i);
     }
     else if (WhileNode.IsWhile(tokens, i))
     {
         return WhileNode.Parse(tokens, ref i);
     }
     else if (ForNode.IsFor(tokens, i))
     {
         return ForNode.Parse(tokens, ref i);
     }
     else if (BreakNode.IsBreak(tokens, i))
     {
         return BreakNode.Parse(tokens, ref i);
     }
     else if (ContinueNode.IsContinue(tokens, i))
     {
         return ContinueNode.Parse(tokens, ref i);
     }
     else if (VariableDeclarationNode.IsVariableDeclaration(tokens, i))
     {
         VariableDeclarationNode node = VariableDeclarationNode.Parse(tokens, ref i);
         Parser.Expect(tokens, ref i, TokenType.Semicolon);
         return node;
     }
     else //Assume expression if no previous match
     {
         ExpressionStatementNode node = ExpressionStatementNode.Parse(tokens, ref i);
         Parser.Expect(tokens, ref i, TokenType.Semicolon);
         return node;
     }
 }
开发者ID:GregoryComer,项目名称:CSubCompiler,代码行数:35,代码来源:StatementNode.cs


示例20: FuncArgs

        private IEnumerable<Parselet> FuncArgs(Token<R> fromToken, RantFunctionGroup group)
        { 
            Token<R> funcToken = null;
            var actions = new List<RantAction>();
            var sequences = new List<RantAction>();

            while (!reader.End)
            {
                funcToken = reader.ReadToken();

                if (funcToken.ID == R.Semicolon)
                {
                    // add action to args and continue
                    sequences.Add(actions.Count == 1 ? actions[0] : new RASequence(actions, funcToken));
                    actions.Clear();
                    reader.SkipSpace();
                    continue;
                }
                else if (funcToken.ID == R.RightSquare)
                {
                    // add action to args and return
                    sequences.Add(actions.Count == 1 ? actions[0] : new RASequence(actions, funcToken));
                    AddToOutput(new RAFunction(Stringe.Range(fromToken, funcToken),
                        compiler.GetFunctionInfo(group, sequences.Count, fromToken, funcToken), sequences));
                    yield break;
                }

                yield return GetParselet(funcToken, actions.Add);
            }

            compiler.SyntaxError(fromToken, "Unterminated function: unexpected end of file");
        }
开发者ID:W-h-a-t-s,项目名称:Rant,代码行数:32,代码来源:FunctionTextParselet.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TokenCredentials类代码示例发布时间:2022-05-24
下一篇:
C# ToggleButton类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap