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

C# Runtime.CommonToken类代码示例

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

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



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

示例1: Generated_INDENT_token_is_correct

        public void Generated_INDENT_token_is_correct()
        {
            var leadingWhitespaceToken = new CommonToken
            {
                Type = whitespace,
                Text = " ",
                CharPositionInLine = leadingPosition,
                Line = anyLine,
                StartIndex = anyIndex,
                TokenIndex = anyIndex,
                StopIndex = anyIndex,
                Channel = anyChannel,
            };

            this.emitter.Process(leadingWhitespaceToken);
            var token = this.emitter.NextToken();

            Assert.AreEqual(indent, token.Type);
            Assert.AreEqual("INDENT", token.Text);
            Assert.AreEqual(channel, token.Channel);
            Assert.AreEqual(leadingPosition, token.CharPositionInLine);
            Assert.AreEqual(anyLine, token.Line);
            Assert.AreEqual(anyIndex, token.StartIndex);
            Assert.AreEqual(anyIndex, token.StopIndex);
            Assert.AreEqual(anyIndex, token.TokenIndex);
        }
开发者ID:FallenGameR,项目名称:AntlrAutomation,代码行数:26,代码来源:EmitterTests.cs


示例2: Node

 private AutomationTree Node(string text, params ITree[] children)
 {
     var token = new CommonToken(anyType, text);
     var node = new AutomationTree(token);
     node.AddChildren(children);
     return node;
 }
开发者ID:FallenGameR,项目名称:AntlrAutomation,代码行数:7,代码来源:AutomationTreeTests.cs


示例3: Generated_DEDENT_token_is_correct

        public void Generated_DEDENT_token_is_correct()
        {
            var eofToken = new CommonToken
            {
                Type = Constant.Eof,
                Text = "EOF",
                CharPositionInLine = anyPosition,
                Line = anyLine,
                StartIndex = anyIndex,
                TokenIndex = anyIndex,
                StopIndex = anyIndex,
                Channel = anyChannel,
            };

            this.emitter.Process(this.GetToken(whitespace, " "));
            this.emitter.NextToken();
            this.emitter.NextToken();
            this.emitter.Process(eofToken);
            var token = this.emitter.NextToken();

            Assert.AreEqual(dedent, token.Type);
            Assert.AreEqual("DEDENT", token.Text);
            Assert.AreEqual(channel, token.Channel);
            Assert.AreEqual(anyPosition, token.CharPositionInLine);
            Assert.AreEqual(anyLine, token.Line);
            Assert.AreEqual(anyIndex, token.StartIndex);
            Assert.AreEqual(anyIndex, token.StopIndex);
            Assert.AreEqual(anyIndex, token.TokenIndex);
        }
开发者ID:FallenGameR,项目名称:AntlrAutomation,代码行数:29,代码来源:EmitterTests.cs


示例4: Static_properties_can_be_accessed_with_case_sensitive_names_from_csharp

        public void Static_properties_can_be_accessed_with_case_sensitive_names_from_csharp()
        {
            var child = new AutomationTree(new CommonToken());
            var token = new CommonToken
            {
                Type = anyType,
                Text = anyText,
                CharPositionInLine = anyPosition,
                Line = anyLine,
                TokenIndex = anyTokenIndex,
            };
            var node = new AutomationTree(token);
            node.AddChild(child);
            dynamic tree = node;

            // Case sensitive
            Assert.AreEqual(anyType, tree.Type);
            Assert.AreEqual(anyPosition, tree.CharPositionInLine);
            Assert.AreEqual(1, tree.ChildCount);
            Assert.AreEqual(-1, tree.ChildIndex);
            Assert.AreEqual(anyLine, tree.Line);
            Assert.AreEqual(anyText, tree.Text);
            Assert.AreEqual(anyTokenIndex, tree.TokenStartIndex);
            Assert.AreEqual(anyTokenIndex, tree.TokenStopIndex);
            Assert.AreSame(child, tree.Children[0]);
            Assert.AreSame(token, tree.Token);
            Assert.IsFalse(tree.IsNil);
            Assert.IsNull(tree.Parent);
        }
开发者ID:FallenGameR,项目名称:AntlrAutomation,代码行数:29,代码来源:DynamicMetaTreeTests.cs


示例5: AddToken

 public void AddToken( CommonToken t, int type, int channel)
 {
    ((CommonToken)t).Type = type;
    ((CommonToken)t).Channel = channel;
    t.Line = lastLine;
    lastLine=input.Line;
    t.CharPositionInLine = lastCharPos;
    lastCharPos=input.CharPositionInLine;
    mRawTokens.Add((CommonToken)t);
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:10,代码来源:MXMLLexer.cs


示例6: Emit

 public virtual IToken Emit()
 {
     IToken token = new CommonToken(this.input, base.state.type, base.state.channel, base.state.tokenStartCharIndex, this.CharIndex - 1) {
         Line = base.state.tokenStartLine,
         Text = base.state.text,
         CharPositionInLine = base.state.tokenStartCharPositionInLine
     };
     this.Emit(token);
     return token;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:10,代码来源:Lexer.cs


示例7: GetMissingSymbol

		protected override object GetMissingSymbol(IIntStream input,
										  RecognitionException e,
										  int expectedTokenType,
										  BitSet follow)
		{
			String tokenText = null;
			if ( expectedTokenType==Token.EOF ) tokenText = "<missing EOF>";
			else tokenText = "<missing " + TokenNames[expectedTokenType] + ">";
			CommonToken t = new CommonToken(expectedTokenType, tokenText);
			IToken current = ((ITokenStream)input).LT(1);
			if (current.Type == Token.EOF) {
				current = ((ITokenStream)input).LT(-1);
			}
			t.line = current.Line;
			t.CharPositionInLine = current.CharPositionInLine;
			t.Channel = DEFAULT_TOKEN_CHANNEL;
			return t;
		}
开发者ID:Fedorm,项目名称:core-master,代码行数:18,代码来源:Parser.cs


示例8: GetMissingSymbol

 protected override object GetMissingSymbol( IIntStream input,
                                   RecognitionException e,
                                   int expectedTokenType,
                                   BitSet follow )
 {
     string tokenText = null;
     if ( expectedTokenType == TokenTypes.EndOfFile )
         tokenText = "<missing EOF>";
     else
         tokenText = "<missing " + TokenNames[expectedTokenType] + ">";
     CommonToken t = new CommonToken( expectedTokenType, tokenText );
     IToken current = ( (ITokenStream)input ).LT( 1 );
     if ( current.Type == TokenTypes.EndOfFile )
     {
         current = ( (ITokenStream)input ).LT( -1 );
     }
     t.Line = current.Line;
     t.CharPositionInLine = current.CharPositionInLine;
     t.Channel = DefaultTokenChannel;
     t.InputStream = current.InputStream;
     return t;
 }
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:22,代码来源:Parser.cs


示例9: GetMissingSymbol

 protected override object GetMissingSymbol(IIntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
 {
     string text = null;
     if (expectedTokenType == -1)
     {
         text = "<missing EOF>";
     }
     else
     {
         text = "<missing " + this.TokenNames[expectedTokenType] + ">";
     }
     CommonToken token = new CommonToken(expectedTokenType, text);
     IToken token2 = ((ITokenStream) input).LT(1);
     if (token2.Type == -1)
     {
         token2 = ((ITokenStream) input).LT(-1);
     }
     token.Line = token2.Line;
     token.CharPositionInLine = token2.CharPositionInLine;
     token.Channel = 0;
     return token;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:22,代码来源:Parser.cs


示例10: mNUM_INT


//.........这里部分代码省略.........
                    	        	int LA6_0 = input.LA(1);

                    	        	if ( (LA6_0 == 'e') )
                    	        	{
                    	        	    alt6 = 1;
                    	        	}
                    	        	switch (alt6) 
                    	        	{
                    	        	    case 1 :
                    	        	        // Hql.g:743:19: EXPONENT
                    	        	        {
                    	        	        	mEXPONENT(); if (state.failed) return ;

                    	        	        }
                    	        	        break;

                    	        	}

                    	        	// Hql.g:743:30: (f1= FLOAT_SUFFIX )?
                    	        	int alt7 = 2;
                    	        	int LA7_0 = input.LA(1);

                    	        	if ( (LA7_0 == 'd' || LA7_0 == 'f' || LA7_0 == 'm') )
                    	        	{
                    	        	    alt7 = 1;
                    	        	}
                    	        	switch (alt7) 
                    	        	{
                    	        	    case 1 :
                    	        	        // Hql.g:743:31: f1= FLOAT_SUFFIX
                    	        	        {
                    	        	        	int f1Start1018 = CharIndex;
                    	        	        	mFLOAT_SUFFIX(); if (state.failed) return ;
                    	        	        	f1 = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, f1Start1018, CharIndex-1);
                    	        	        	if ( (state.backtracking==0) )
                    	        	        	{
                    	        	        	  t=f1;
                    	        	        	}

                    	        	        }
                    	        	        break;

                    	        	}

                    	        	if ( (state.backtracking==0) )
                    	        	{

                    	        	  					if (t != null && t.Text.ToUpperInvariant().IndexOf('F')>=0)
                    	        	  					{
                    	        	  						_type = NUM_FLOAT;
                    	        	  					}
                    	        	  					else if (t != null && t.Text.ToUpperInvariant().IndexOf('M')>=0)
                    	        	  					{
                    	        	  						_type = NUM_DECIMAL;
                    	        	  					}
                    	        	  					else
                    	        	  					{
                    	        	  						_type = NUM_DOUBLE; // assume double
                    	        	  					}
                    	        	  				
                    	        	}

                    	        }
                    	        break;

                    	}
开发者ID:briandonahue,项目名称:nhibernate,代码行数:67,代码来源:HqlLexer.cs


示例11: mELEMENT

    // $ANTLR end "DECL_STOP"

    // $ANTLR start "ELEMENT"
    public void mELEMENT() // throws RecognitionException [2]
    {
    		try
    		{
            IToken t = null;
            IToken pi = null;

            // MXMLLexer.g3:108:5: ( ( START_TAG ( ELEMENT | EOL | t= PCDATA | t= CDATA | t= COMMENT | pi= PI )* END_TAG | EMPTY_ELEMENT ) )
            // MXMLLexer.g3:108:7: ( START_TAG ( ELEMENT | EOL | t= PCDATA | t= CDATA | t= COMMENT | pi= PI )* END_TAG | EMPTY_ELEMENT )
            {
            	// MXMLLexer.g3:108:7: ( START_TAG ( ELEMENT | EOL | t= PCDATA | t= CDATA | t= COMMENT | pi= PI )* END_TAG | EMPTY_ELEMENT )
            	int alt14 = 2;
            	alt14 = dfa14.Predict(input);
            	switch (alt14) 
            	{
            	    case 1 :
            	        // MXMLLexer.g3:108:9: START_TAG ( ELEMENT | EOL | t= PCDATA | t= CDATA | t= COMMENT | pi= PI )* END_TAG
            	        {
            	        	mSTART_TAG(); 
            	        	// MXMLLexer.g3:109:13: ( ELEMENT | EOL | t= PCDATA | t= CDATA | t= COMMENT | pi= PI )*
            	        	do 
            	        	{
            	        	    int alt13 = 7;
            	        	    alt13 = dfa13.Predict(input);
            	        	    switch (alt13) 
            	        		{
            	        			case 1 :
            	        			    // MXMLLexer.g3:109:14: ELEMENT
            	        			    {
            	        			    	mELEMENT(); 

            	        			    }
            	        			    break;
            	        			case 2 :
            	        			    // MXMLLexer.g3:110:15: EOL
            	        			    {
            	        			    	mEOL(); 

            	        			    }
            	        			    break;
            	        			case 3 :
            	        			    // MXMLLexer.g3:111:15: t= PCDATA
            	        			    {
            	        			    	int tStart607 = CharIndex;
            	        			    	mPCDATA(); 
            	        			    	t = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, tStart607, CharIndex-1);
            	        			    	 AddToken( (CommonToken)t, PCDATA, 0);

            	        			    }
            	        			    break;
            	        			case 4 :
            	        			    // MXMLLexer.g3:113:15: t= CDATA
            	        			    {
            	        			    	int tStart643 = CharIndex;
            	        			    	mCDATA(); 
            	        			    	t = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, tStart643, CharIndex-1);
            	        			    	 AddToken( (CommonToken)t, CDATA, 0);

            	        			    }
            	        			    break;
            	        			case 5 :
            	        			    // MXMLLexer.g3:115:15: t= COMMENT
            	        			    {
            	        			    	int tStart679 = CharIndex;
            	        			    	mCOMMENT(); 
            	        			    	t = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, tStart679, CharIndex-1);

            	        			    }
            	        			    break;
            	        			case 6 :
            	        			    // MXMLLexer.g3:116:15: pi= PI
            	        			    {
            	        			    	int piStart697 = CharIndex;
            	        			    	mPI(); 
            	        			    	pi = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, piStart697, CharIndex-1);

            	        			    }
            	        			    break;

            	        			default:
            	        			    goto loop13;
            	        	    }
            	        	} while (true);

            	        	loop13:
            	        		;	// Stops C# compiler whining that label 'loop13' has no statements

            	        	mEND_TAG(); 

            	        }
            	        break;
            	    case 2 :
            	        // MXMLLexer.g3:119:11: EMPTY_ELEMENT
            	        {
            	        	mEMPTY_ELEMENT(); 

            	        }
//.........这里部分代码省略.........
开发者ID:heon21st,项目名称:flashdevelop,代码行数:101,代码来源:MXMLLexer.cs


示例12: mDOCTYPE

    // $ANTLR end "DOCUMENT"

    // $ANTLR start "DOCTYPE"
    public void mDOCTYPE() // throws RecognitionException [2]
    {
    		try
    		{
            IToken dt = null;
            IToken rootElementName = null;
            IToken sys = null;
            IToken sys1 = null;
            IToken pub = null;
            IToken sys2 = null;
            IToken dtd = null;
            IToken close = null;

            // MXMLLexer.g3:60:5: (dt= DOCTYPE_tag WS rootElementName= GENERIC_ID WS ( (sys= SYSTEM_tag WS sys1= VALUE | pub= PUBLIC_tag WS pub= VALUE WS sys2= VALUE ) ( WS )? )? (dtd= INTERNAL_DTD )? close= TAG_CLOSE )
            // MXMLLexer.g3:61:9: dt= DOCTYPE_tag WS rootElementName= GENERIC_ID WS ( (sys= SYSTEM_tag WS sys1= VALUE | pub= PUBLIC_tag WS pub= VALUE WS sys2= VALUE ) ( WS )? )? (dtd= INTERNAL_DTD )? close= TAG_CLOSE
            {
            	int dtStart120 = CharIndex;
            	mDOCTYPE_tag(); 
            	dt = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, dtStart120, CharIndex-1);
            	AddToken( (CommonToken)dt, DOCTYPE_tag, 0);
            	mWS(); 
            	int rootElementNameStart128 = CharIndex;
            	mGENERIC_ID(); 
            	rootElementName = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, rootElementNameStart128, CharIndex-1);
            	 
            	mWS(); 
            	// MXMLLexer.g3:64:9: ( (sys= SYSTEM_tag WS sys1= VALUE | pub= PUBLIC_tag WS pub= VALUE WS sys2= VALUE ) ( WS )? )?
            	int alt4 = 2;
            	int LA4_0 = input.LA(1);

            	if ( (LA4_0 == 'P' || LA4_0 == 'S') )
            	{
            	    alt4 = 1;
            	}
            	switch (alt4) 
            	{
            	    case 1 :
            	        // MXMLLexer.g3:65:13: (sys= SYSTEM_tag WS sys1= VALUE | pub= PUBLIC_tag WS pub= VALUE WS sys2= VALUE ) ( WS )?
            	        {
            	        	// MXMLLexer.g3:65:13: (sys= SYSTEM_tag WS sys1= VALUE | pub= PUBLIC_tag WS pub= VALUE WS sys2= VALUE )
            	        	int alt2 = 2;
            	        	int LA2_0 = input.LA(1);

            	        	if ( (LA2_0 == 'S') )
            	        	{
            	        	    alt2 = 1;
            	        	}
            	        	else if ( (LA2_0 == 'P') )
            	        	{
            	        	    alt2 = 2;
            	        	}
            	        	else 
            	        	{
            	        	    NoViableAltException nvae_d2s0 =
            	        	        new NoViableAltException("", 2, 0, input);

            	        	    throw nvae_d2s0;
            	        	}
            	        	switch (alt2) 
            	        	{
            	        	    case 1 :
            	        	        // MXMLLexer.g3:65:15: sys= SYSTEM_tag WS sys1= VALUE
            	        	        {
            	        	        	int sysStart181 = CharIndex;
            	        	        	mSYSTEM_tag(); 
            	        	        	sys = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sysStart181, CharIndex-1);
            	        	        	AddToken( (CommonToken)sys, SYSTEM_tag, 0);
            	        	        	mWS(); 
            	        	        	int sys1Start189 = CharIndex;
            	        	        	mVALUE(); 
            	        	        	sys1 = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sys1Start189, CharIndex-1);

            	        	        }
            	        	        break;
            	        	    case 2 :
            	        	        // MXMLLexer.g3:66:15: pub= PUBLIC_tag WS pub= VALUE WS sys2= VALUE
            	        	        {
            	        	        	int pubStart207 = CharIndex;
            	        	        	mPUBLIC_tag(); 
            	        	        	pub = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, pubStart207, CharIndex-1);
            	        	        	AddToken( (CommonToken)pub, PUBLIC_tag, 0);
            	        	        	mWS(); 
            	        	        	int pubStart215 = CharIndex;
            	        	        	mVALUE(); 
            	        	        	pub = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, pubStart215, CharIndex-1);
            	        	        	mWS(); 
            	        	        	int sys2Start221 = CharIndex;
            	        	        	mVALUE(); 
            	        	        	sys2 = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, sys2Start221, CharIndex-1);

            	        	        }
            	        	        break;

            	        	}

            	        	// MXMLLexer.g3:68:13: ( WS )?
            	        	int alt3 = 2;
//.........这里部分代码省略.........
开发者ID:heon21st,项目名称:flashdevelop,代码行数:101,代码来源:MXMLLexer.cs


示例13: mWS

    // $ANTLR end "LETTER"

    // $ANTLR start "WS"
    public void mWS() // throws RecognitionException [2]
    {
    		try
    		{
            IToken ws = null;

            // MXMLLexer.g3:206:14: ( (ws= OTHERWS | EOL )+ )
            // MXMLLexer.g3:207:9: (ws= OTHERWS | EOL )+
            {
            	// MXMLLexer.g3:207:9: (ws= OTHERWS | EOL )+
            	int cnt34 = 0;
            	do 
            	{
            	    int alt34 = 3;
            	    int LA34_0 = input.LA(1);

            	    if ( (LA34_0 == '\t' || LA34_0 == ' ') )
            	    {
            	        alt34 = 1;
            	    }
            	    else if ( (LA34_0 == '\n' || LA34_0 == '\r') )
            	    {
            	        alt34 = 2;
            	    }


            	    switch (alt34) 
            		{
            			case 1 :
            			    // MXMLLexer.g3:207:10: ws= OTHERWS
            			    {
            			    	int wsStart1367 = CharIndex;
            			    	mOTHERWS(); 
            			    	ws = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, wsStart1367, CharIndex-1);
            			    	AddToken( (CommonToken)ws, WS, 0);

            			    }
            			    break;
            			case 2 :
            			    // MXMLLexer.g3:208:11: EOL
            			    {
            			    	mEOL(); 

            			    }
            			    break;

            			default:
            			    if ( cnt34 >= 1 ) goto loop34;
            		            EarlyExitException eee =
            		                new EarlyExitException(34, input);
            		            throw eee;
            	    }
            	    cnt34++;
            	} while (true);

            	loop34:
            		;	// Stops C# compiler whinging that label 'loop34' has no statements


            }

        }
        finally 
    	{
        }
    }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:69,代码来源:MXMLLexer.cs


示例14: mVALUE

    // $ANTLR end "PCDATA"

    // $ANTLR start "VALUE"
    public void mVALUE() // throws RecognitionException [2]
    {
    		try
    		{
            IToken v = null;

            // MXMLLexer.g3:181:16: (v= VALUE_int )
            // MXMLLexer.g3:182:3: v= VALUE_int
            {
            	int vStart1160 = CharIndex;
            	mVALUE_int(); 
            	v = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, vStart1160, CharIndex-1);
            	AddToken( (CommonToken)v, VALUE, 0);

            }

        }
        finally 
    	{
        }
    }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:24,代码来源:MXMLLexer.cs


示例15: mUNDEF_TOKEN

	private void mUNDEF_TOKEN()
	{
		Enter_UNDEF_TOKEN();
		EnterRule("UNDEF_TOKEN", 178);
		TraceIn("UNDEF_TOKEN", 178);
		try
		{
			CommonToken define=null;

			// cs.g:1168:12: ( '#' ( TS )* 'undef' ( TS )+ define= IDENTIFIER )
			DebugEnterAlt(1);
			// cs.g:1169:2: '#' ( TS )* 'undef' ( TS )+ define= IDENTIFIER
			{
			DebugLocation(1169, 2);
			Match('#'); 
			DebugLocation(1169, 8);
			// cs.g:1169:8: ( TS )*
			try { DebugEnterSubRule(32);
			while (true)
			{
				int alt32=2;
				try { DebugEnterDecision(32, decisionCanBacktrack[32]);
				int LA32_0 = input.LA(1);

				if ((LA32_0=='\t'||LA32_0==' '))
				{
					alt32=1;
				}


				} finally { DebugExitDecision(32); }
				switch ( alt32 )
				{
				case 1:
					DebugEnterAlt(1);
					// cs.g:1169:8: TS
					{
					DebugLocation(1169, 8);
					mTS(); 

					}
					break;

				default:
					goto loop32;
				}
			}

			loop32:
				;

			} finally { DebugExitSubRule(32); }

			DebugLocation(1169, 14);
			Match("undef"); 

			DebugLocation(1169, 24);
			// cs.g:1169:24: ( TS )+
			int cnt33=0;
			try { DebugEnterSubRule(33);
			while (true)
			{
				int alt33=2;
				try { DebugEnterDecision(33, decisionCanBacktrack[33]);
				int LA33_0 = input.LA(1);

				if ((LA33_0=='\t'||LA33_0==' '))
				{
					alt33=1;
				}


				} finally { DebugExitDecision(33); }
				switch (alt33)
				{
				case 1:
					DebugEnterAlt(1);
					// cs.g:1169:24: TS
					{
					DebugLocation(1169, 24);
					mTS(); 

					}
					break;

				default:
					if (cnt33 >= 1)
						goto loop33;

					EarlyExitException eee33 = new EarlyExitException( 33, input );
					DebugRecognitionException(eee33);
					throw eee33;
				}
				cnt33++;
			}
			loop33:
				;

			} finally { DebugExitSubRule(33); }

//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:101,代码来源:csLexer.cs


示例16: mEND_TAG

    // $ANTLR end "TAG_CLOSE"

    // $ANTLR start "END_TAG"
    public void mEND_TAG() // throws RecognitionException [2]
    {
    		try
    		{
            IToken open = null;
            IToken name = null;
            IToken close = null;

            // MXMLLexer.g3:162:5: (open= END_TAG_OPEN ( WS )? name= GENERIC_ID ( WS )? close= TAG_CLOSE )
            // MXMLLexer.g3:162:7: open= END_TAG_OPEN ( WS )? name= GENERIC_ID ( WS )? close= TAG_CLOSE
            {
            	int openStart1017 = CharIndex;
            	mEND_TAG_OPEN(); 
            	open = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, openStart1017, CharIndex-1);
            	AddToken( (CommonToken)open, END_TAG_OPEN, 0);
            	// MXMLLexer.g3:162:75: ( WS )?
            	int alt25 = 2;
            	int LA25_0 = input.LA(1);

            	if ( ((LA25_0 >= '\t' && LA25_0 <= '\n') || LA25_0 == '\r' || LA25_0 == ' ') )
            	{
            	    alt25 = 1;
            	}
            	switch (alt25) 
            	{
            	    case 1 :
            	        // MXMLLexer.g3:162:75: WS
            	        {
            	        	mWS(); 

            	        }
            	        break;

            	}

            	int nameStart1026 = CharIndex;
            	mGENERIC_ID(); 
            	name = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, nameStart1026, CharIndex-1);
            	// MXMLLexer.g3:162:95: ( WS )?
            	int alt26 = 2;
            	int LA26_0 = input.LA(1);

            	if ( ((LA26_0 >= '\t' && LA26_0 <= '\n') || LA26_0 == '\r' || LA26_0 == ' ') )
            	{
            	    alt26 = 1;
            	}
            	switch (alt26) 
            	{
            	    case 1 :
            	        // MXMLLexer.g3:162:95: WS
            	        {
            	        	mWS(); 

            	        }
            	        break;

            	}

            	int closeStart1033 = CharIndex;
            	mTAG_CLOSE(); 
            	close = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, closeStart1033, CharIndex-1);
            	AddToken( (CommonToken)close, TAG_CLOSE, 0);

            }

        }
        finally 
    	{
        }
    }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:73,代码来源:MXMLLexer.cs


示例17: mCOMMENT

    // $ANTLR end "END_TAG"

    // $ANTLR start "COMMENT"
    public void mCOMMENT() // throws RecognitionException [2]
    {
    		try
    		{
            IToken c = null;

            // MXMLLexer.g3:165:17: (c= COMMENT_int )
            // MXMLLexer.g3:166:2: c= COMMENT_int
            {
            	int cStart1052 = CharIndex;
            	mCOMMENT_int(); 
            	c = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, cStart1052, CharIndex-1);
            	AddToken( (CommonToken)c, COMMENT, 0);

            }

        }
        finally 
    	{
        }
    }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:24,代码来源:MXMLLexer.cs


示例18: mELSE_TOKEN

	private void mELSE_TOKEN()
	{
		Enter_ELSE_TOKEN();
		EnterRule("ELSE_TOKEN", 179);
		TraceIn("ELSE_TOKEN", 179);
		try
		{
			CommonToken e=null;

			// cs.g:1175:11: ( ( '#' ( TS )* e= 'else' | '#' ( TS )* 'elif' ( TS )+ PP_EXPRESSION ) )
			DebugEnterAlt(1);
			// cs.g:1176:2: ( '#' ( TS )* e= 'else' | '#' ( TS )* 'elif' ( TS )+ PP_EXPRESSION )
			{
			DebugLocation(1176, 2);
			// cs.g:1176:2: ( '#' ( TS )* e= 'else' | '#' ( TS )* 'elif' ( TS )+ PP_EXPRESSION )
			int alt37=2;
			try { DebugEnterSubRule(37);
			try { DebugEnterDecision(37, decisionCanBacktrack[37]);
			try
			{
				alt37 = dfa37.Predict(input);
			}
			catch (NoViableAltException nvae)
			{
				DebugRecognitionException(nvae);
				throw;
			}
			} finally { DebugExitDecision(37); }
			switch (alt37)
			{
			case 1:
				DebugEnterAlt(1);
				// cs.g:1176:4: '#' ( TS )* e= 'else'
				{
				DebugLocation(1176, 4);
				Match('#'); 
				DebugLocation(1176, 10);
				// cs.g:1176:10: ( TS )*
				try { DebugEnterSubRule(34);
				while (true)
				{
					int alt34=2;
					try { DebugEnterDecision(34, decisionCanBacktrack[34]);
					int LA34_0 = input.LA(1);

					if ((LA34_0=='\t'||LA34_0==' '))
					{
						alt34=1;
					}


					} finally { DebugExitDecision(34); }
					switch ( alt34 )
					{
					case 1:
						DebugEnterAlt(1);
						// cs.g:1176:10: TS
						{
						DebugLocation(1176, 10);
						mTS(); 

						}
						break;

					default:
						goto loop34;
					}
				}

				loop34:
					;

				} finally { DebugExitSubRule(34); }

				DebugLocation(1176, 18);
				int eStart = CharIndex;
				Match("else"); 
				int eStartLine2148 = Line;
				int eStartCharPos2148 = CharPositionInLine;
				e = new CommonToken(input, TokenTypes.Invalid, TokenChannels.Default, eStart, CharIndex-1);
				e.Line = eStartLine2148;
				e.CharPositionInLine = eStartCharPos2148;

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// cs.g:1177:4: '#' ( TS )* 'elif' ( TS )+ PP_EXPRESSION
				{
				DebugLocation(1177, 4);
				Match('#'); 
				DebugLocation(1177, 10);
				// cs.g:1177:10: ( TS )*
				try { DebugEnterSubRule(35);
				while (true)
				{
					int alt35=2;
					try { DebugEnterDecision(35, decisionCanBacktrack[35]);
					int LA35_0 = input.LA(1);

//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:101,代码来源:csLexer.cs


示例19: mGENERIC_ID

    // $ANTLR end "VALUE_int"

    // $ANTLR start "GENERIC_ID"
    public void mGENERIC_ID() // throws RecognitionException [2]
    {
    		try
    		{
            IToken id = null;

            // MXMLLexer.g3:192:2: (id= GENERIC_ID_int )
            // MXMLLexer.g3:193:2: id= GENERIC_ID_int
            {
            	int idStart1243 = CharIndex;
            	mGENERIC_ID_int(); 
            	id = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, idStart1243, CharIndex-1);
            	AddToken( (CommonToken)id, GENERIC_ID, 0);

            }

        }
        finally 
    	{
        }
    }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:24,代码来源:MXMLLexer.cs


示例20: mPP_EQUALITY_EXPRESSION

	private void mPP_EQUALITY_EXPRESSION()
	{
		Enter_PP_EQUALITY_EXPRESSION();
		EnterRule("PP_EQUALITY_EXPRESSION", 184);
		TraceIn("PP_EQUALITY_EXPRESSION", 184);
		try
		{
			CommonToken ne=null;

			// cs.g:1238:23: ( PP_UNARY_EXPRESSION ( TS )* ( ( '==' | ne= '!=' ) ( TS )* PP_UNARY_EXPRESSION ( TS )* )* )
			DebugEnterAlt(1);
			// cs.g:1239:2: PP_UNARY_EXPRESSION ( TS )* ( ( '==' | ne= '!=' ) ( TS )* PP_UNARY_EXPRESSION ( TS )* )*
			{
			DebugLocation(1239, 2);
			mPP_UNARY_EXPRESSION(); 
			DebugLocation(1239, 24);
			// cs.g:1239:24: ( TS )*
			try { DebugEnterSubRule(47);
			while (true)
			{
				int alt47=2;
				try { DebugEnterDecision(47, decisionCanBacktrack[47]);
				int LA47_0 = input.LA(1);

				if ((LA47_0=='\t'||LA47_0==' '))
				{
					alt47=1;
				}


				} finally { DebugExitDecision(47); }
				switch ( alt47 )
				{
				case 1:
					DebugEnterAlt(1);
					// cs.g:1239:24: TS
					{
					DebugLocation(1239, 24);
					mTS(); 

					}
					break;

				default:
					goto loop47;
				}
			}

			loop47:
				;

			} finally { DebugExitSubRule(47); }

			DebugLocation(1239, 30);
			// cs.g:1239:30: ( ( '==' | ne= '!=' ) ( TS )* PP_UNARY_EXPRESSION ( TS )* )*
			try { DebugEnterSubRule(51);
			while (true)
			{
				int alt51=2;
				try { DebugEnterDecision(51, decisionCanBacktrack[51]);
				int LA51_0 = input.LA(1);

				if ((LA51_0=='!'||LA51_0=='='))
				{
					alt51=1;
				}


				} finally { DebugExitDecision(51); }
				switch ( alt51 )
				{
				case 1:
					DebugEnterAlt(1);
					// cs.g:1239:31: ( '==' | ne= '!=' ) ( TS )* PP_UNARY_EXPRESSION ( TS )*
					{
					DebugLocation(1239, 31);
					// cs.g:1239:31: ( '==' | ne= '!=' )
					int alt48=2;
					try { DebugEnterSubRule(48);
					try { DebugEnterDecision(48, decisionCanBacktrack[48]);
					int LA48_0 = input.LA(1);

					if ((LA48_0=='='))
					{
						alt48=1;
					}
					else if ((LA48_0=='!'))
					{
						alt48=2;
					}
					else
					{
						NoViableAltException nvae = new NoViableAltException("", 48, 0, input);

						DebugRecognitionException(nvae);
						throw nvae;
					}
					} finally { DebugExitDecision(48); }
					switch (alt48)
					{
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:101,代码来源:csLexer.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Runtime.CommonTokenStream类代码示例发布时间:2022-05-24
下一篇:
C# Runtime.BitSet类代码示例发布时间: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