Describes the input token stream.
 /// <summary> This constructor is used by the method "generateParseException"
 /// in the generated parser.  Calling this constructor generates
 /// a new object of this type with the fields "currentToken",
 /// "expectedTokenSequences", and "tokenImage" set.  The boolean
 /// flag "specialConstructor" is also set to true to indicate that
 /// this constructor was used to create this object.
 /// This constructor calls its super class with the empty string
 /// to force the "toString" method of parent class "Throwable" to
 /// print the error message in the form:
 /// ParseException: &lt;result of getMessage&gt;
 /// </summary>
 public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal)
     : base(string.Empty)
 {
     specialConstructor = true;
     currentToken = currentTokenVal;
     expectedTokenSequences = expectedTokenSequencesVal;
     tokenImage = tokenImageVal;
 }
예제 #2
0
	private void  jj_rescan_token() {
	    jj_rescan = true;
	    for (int i = 0; i < 12; i++) {
		JJCalls p = jj_2_rtns[i];
		do {
		    if (p.gen > jj_gen) {
			jj_la = p.arg;
			jj_lastpos = jj_scanpos = p.first;
			switch (i) {
			    case 0:
				jj_3_1();
				break;

			    case 1:
				jj_3_2();
				break;

			    case 2:
				jj_3_3();
				break;

			    case 3:
				jj_3_4();
				break;

			    case 4:
				jj_3_5();
				break;

			    case 5:
				jj_3_6();
				break;

			    case 6:
				jj_3_7();
				break;

			    case 7:
				jj_3_8();
				break;

			    case 8:
				jj_3_9();
				break;

			    case 9:
				jj_3_10();
				break;

			    case 10:
				jj_3_11();
				break;

			    case 11:
				jj_3_12();
				break;

			}
		    }
		    p = p.next;
		} while (p != null);
	    }
	    jj_rescan = false;
	}
예제 #3
0
		/// <summary>   Supports the Pluggable Directives
		/// #foo( arg+ )
		/// </summary>
		public SimpleNode Directive()
		{
			ASTDirective directiveNode = new ASTDirective(this, ParserTreeConstants.DIRECTIVE);

			bool isNodeScopeOpen = true;
			nodeTree.OpenNodeScope(directiveNode);
			Token token;
			Directive directive;
			bool doItNow = false;

			try
			{
				/*
				* note that if we were escaped, that is now handled by 
				* EscapedDirective()
				*/
				token = ConsumeToken(ParserConstants.WORD);
				String directiveName = token.Image.Substring(1);

				directive = directives.Create(directiveName, directiveStack);

				Debug.Assert(directiveNode != null);

				directiveNode.Directive = directive;

				/*
				*  Velocimacro support : if the directive is macro directive
				*   then set the flag so after the block parsing, we add the VM
				*   right then. (So available if used w/in the current template )
				*/

				if (directiveName.Equals("macro"))
				{
					doItNow = true;
				}

				/*
				* set the directive name from here.  No reason for the thing to know 
				* about parser tokens
				*/

				directiveNode.DirectiveName = directiveName;

				DirectiveType directiveType;
				if (directive == null)
				{
					// if null, then not a real directive, but maybe a Velocimacro

					//d  =  (Directive) runtimeServices.getVelocimacro( directiveName, currentTemplateName );

					// TODO: adding a null check since RuntimeServices is not finished
					// since the parser can be created without RuntimeServices - this may actually be needed here and in the orgiginal source as well.
					if (runtimeServices != null)
					{
						if (!runtimeServices.IsVelocimacro(directiveName, currentTemplateName))
						{
							token_source.StateStackPop();
							token_source.inDirective = false;
							if (true)
								return directiveNode;
						}
					}

					/*
					 *  Currently, all VMs are LINE directives
					 */
					directiveType = DirectiveType.LINE;
				}
				else
				{
					directiveType = directive.Type;
				}

				/*
				*  now, switch us out of PRE_DIRECTIVE
				*/

				token_source.SwitchTo(ParserConstants.DIRECTIVE);

				ConsumeWhiteSpaces();

				if (directive != null && !directive.AcceptParams)
				{
					int curToken = GetCurrentTokenKind();

					if (curToken == ParserConstants.NEWLINE)
					{
						ConsumeToken(ParserConstants.NEWLINE);
					}
					else
					{
						throw new ParseException(
							"Foreach directives must be the only items on the line (comments or contents are not allowed)");
					}
				}

				if (directive == null || directive.AcceptParams)
				{
					ConsumeToken(ParserConstants.LPAREN);

					while(true)
					{
						switch(GetCurrentTokenKind())
						{
							case ParserConstants.LBRACKET:
							case ParserConstants.WHITESPACE:
							case ParserConstants.STRING_LITERAL:
							case ParserConstants.TRUE:
							case ParserConstants.FALSE:
							case ParserConstants.NUMBER_LITERAL:
							case ParserConstants.WORD:
							case ParserConstants.IDENTIFIER:
							case ParserConstants.LCURLY:
								;
								break;

							default:
								jj_la1[7] = jj_gen;
								//UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1012"'
								goto label_3_brk;
						}
						DirectiveArg();
					}
					//UPGRADE_NOTE: Label 'label_3_brk' was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1011"'
					label_3_brk:
					;

					ConsumeToken(ParserConstants.RPAREN);
				}

				if (directiveType == DirectiveType.LINE)
				{
					return directiveNode;
				}

				directiveStack.Push(directive);

				ASTBlock jjtn001 = new ASTBlock(this, ParserTreeConstants.BLOCK);
				bool jjtc001 = true;
				nodeTree.OpenNodeScope(jjtn001);

				try
				{
					while(true)
					{
						Statement();
						int kind = GetCurrentTokenKind();
						switch(kind)
						{
							case ParserConstants.LPAREN:
							case ParserConstants.RPAREN:
							case ParserConstants.ESCAPE_DIRECTIVE:
							case ParserConstants.SET_DIRECTIVE:
							case ParserConstants.DOUBLE_ESCAPE:
							case ParserConstants.ESCAPE:
							case ParserConstants.TEXT:
							case ParserConstants.SINGLE_LINE_COMMENT:
							case ParserConstants.FORMAL_COMMENT:
							case ParserConstants.MULTI_LINE_COMMENT:
							case ParserConstants.STRING_LITERAL:
							case ParserConstants.IF_DIRECTIVE:
							case ParserConstants.STOP_DIRECTIVE:
							case ParserConstants.NUMBER_LITERAL:
							case ParserConstants.WORD:
							case ParserConstants.IDENTIFIER:
							case ParserConstants.DOT:
							case ParserConstants.LCURLY:
							case ParserConstants.RCURLY:
								break;

							default:
								jj_la1[8] = jj_gen;
								//UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1012"'
								goto label_4_brk;
						}
					}
					//UPGRADE_NOTE: Label 'label_4_brk' was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1011"'
					label_4_brk:
					;
				}
				catch(Exception jjte001)
				{
					nodeTree.ClearNodeScope(jjtn001);
					jjtc001 = false;
					if (jjte001 is SystemException)
					{
						throw;
					}
					if (jjte001 is ParseException)
					{
						throw;
					}
					throw (ApplicationException) jjte001;
				}
				finally
				{
					if (jjtc001)
					{
						nodeTree.CloseNodeScope(jjtn001, true);
					}

					directiveStack.Pop();
				}
				ConsumeToken(ParserConstants.END);
				nodeTree.CloseNodeScope(directiveNode, true);
				isNodeScopeOpen = false;
				/*
				 *  VM : if we are processing a #macro directive, we need to 
				 *     process the block.  In truth, I can just register the name
				 *     and do the work later when init-ing.  That would work
				 *     as long as things were always defined before use.  This way
				 *     we don't have to worry about forward references and such...
				 */

				if (doItNow)
				{
					Macro.processAndRegister(runtimeServices, directiveNode, currentTemplateName);
				}

				return directiveNode;
			}
			catch(Exception jjte000)
			{
				if (isNodeScopeOpen)
				{
					nodeTree.ClearNodeScope(directiveNode);
					isNodeScopeOpen = false;
				}
				else
				{
					nodeTree.PopNode();
				}
				if (jjte000 is SystemException)
				{
					throw;
				}
				if (jjte000 is ParseException)
				{
					throw;
				}
				throw (ApplicationException) jjte000;
			}
			finally
			{
				if (isNodeScopeOpen)
				{
					nodeTree.CloseNodeScope(directiveNode, true);
				}
			}
		}
예제 #4
0
		private bool ScanToken(int kind)
		{
			if (jj_scanpos == jj_lastpos)
			{
				jj_la--;
				if (jj_scanpos.Next == null)
				{
					jj_lastpos = jj_scanpos = jj_scanpos.Next = token_source.NextToken;
				}
				else
				{
					jj_lastpos = jj_scanpos = jj_scanpos.Next;
				}
			}
			else
			{
				jj_scanpos = jj_scanpos.Next;
			}
			if (jj_rescan)
			{
				int i = 0;
				Token tok = token;
				while(tok != null && tok != jj_scanpos)
				{
					i++;
					tok = tok.Next;
				}
				if (tok != null)
				{
					AddErrorToken(kind, i);
				}
			}
			return (jj_scanpos.Kind != kind);
		}
예제 #5
0
		public void ReInit(ParserTokenManager tm)
		{
			token_source = tm;
			token = new Token();
			jj_ntk_Renamed_Field = -1;
			nodeTree.Reset();
			jj_gen = 0;
			for(int i = 0; i < 53; i++)
				jj_la1[i] = -1;
			for(int i = 0; i < callsArray.Length; i++)
				callsArray[i] = new Calls();
		}
예제 #6
0
		public void ReInit(ICharStream stream)
		{
			token_source.ReInit(stream);
			token = new Token();
			jj_ntk_Renamed_Field = -1;
			nodeTree.Reset();
			jj_gen = 0;
			for(int i = 0; i < 53; i++)
				jj_la1[i] = -1;
			for(int i = 0; i < callsArray.Length; i++)
				callsArray[i] = new Calls();
		}
예제 #7
0
		private bool jj_3R_60()
		{
			Token xsp = jj_scanpos;
			if (jj_3R_50(jj_3R_81()))
			{
				jj_scanpos = xsp;
				if (jj_3R_50(jj_3R_82()))
					return true;
				if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #8
0
		private bool jj_3R_86()
		{
			if (jj_3R_89())
				return true;
			if (ToRefactor1())
				return false;
			while(true)
			{
				Token xsp = jj_scanpos;
				if (jj_3R_90())
				{
					jj_scanpos = xsp;
					break;
				}
				if (ToRefactor1())
					return false;
			}
			return false;
		}
예제 #9
0
		private bool jj_3R_19()
		{
			Token xsp;
			xsp = jj_scanpos;
			if (jj_3R_38())
			{
				jj_scanpos = xsp;
				if (jj_3R_39())
					return true;
				if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #10
0
		private bool jj_3R_38()
		{
			if (ScanToken(ParserConstants.IDENTIFIER))
				return true;
			if (ToRefactor1())
				return false;
			while(true)
			{
				Token xsp = jj_scanpos;
				if (jj_3_7())
				{
					jj_scanpos = xsp;
					break;
				}
				if (ToRefactor1())
					return false;
			}
			return false;
		}
예제 #11
0
		private bool jj_3_7()
		{
			if (ScanToken(ParserConstants.DOT))
				return true;
			if (ToRefactor1())
				return false;
			Token xsp = jj_scanpos;
			if (jj_3R_50(jj_3R_29()))
			{
				jj_scanpos = xsp;
				if (jj_3R_50(jj_3R_41()))
					return true;
				if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #12
0
		private bool jj_2_12(int xla)
		{
			jj_la = xla;
			jj_lastpos = jj_scanpos = token;
			bool retval = !jj_3_12();
			Save(11, xla);
			return retval;
		}
예제 #13
0
		private bool jj_2_9(int xla)
		{
			jj_la = xla;
			jj_lastpos = jj_scanpos = token;
			bool retval = !jj_3R_52();
			Save(8, xla);
			return retval;
		}
예제 #14
0
		private bool jj_2_8(int xla)
		{
			jj_la = xla;
			jj_lastpos = jj_scanpos = token;
			bool retval = !jj_3R_50(jj_3R_29());
			Save(7, xla);
			return retval;
		}
예제 #15
0
		private void TokenLexicalActions(Token matchedToken)
		{
			switch(jjmatchedKind)
			{
				case 5:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					if (!inComment)
						lparen++;

					/*
		    * If in REFERENCE and we have seen the dot, then move 
		    * to REFMOD2 -> Modifier()
		    */

					if (curLexState == REFMODIFIER)
						SwitchTo(REFMOD2);
					break;
				case 6:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					RPARENHandler();
					break;
				case 7:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					/*
		    * need to simply switch back to REFERENCE, not drop down the stack
		    * because we can (infinitely) chain, ala 
		    * $foo.bar().blargh().woogie().doogie()
		    */

					SwitchTo(REFERENCE);
					break;
				case 9:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					if (! inComment)
					{
						inDirective = true;

						if (debugPrint)
							Console.Out.Write("#set :  going to {0}", DIRECTIVE);

						StateStackPush();
						inSet = true;
						SwitchTo(DIRECTIVE);
					}
					break;
				case 19:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					inComment = false;
					StateStackPop();
					break;
				case 20:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					inComment = false;
					StateStackPop();
					break;
				case 21:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					inComment = false;
					StateStackPop();
					break;
				case 24:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					/*
		    *  - if we are in DIRECTIVE and haven't seen ( yet, then also drop out. 
		    *      don't forget to account for the beloved yet wierd #set
		    *  - finally, if we are in REFMOD2 (remember : $foo.bar( ) then " is ok!
		    */

					if (curLexState == DIRECTIVE && !inSet && lparen == 0)
						StateStackPop();
					break;
				case 27:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					if (debugPrint)
						Console.Out.WriteLine(" NEWLINE :");

					StateStackPop();

					if (inSet)
						inSet = false;

					if (inDirective)
						inDirective = false;
					break;
				case 43:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					inDirective = false;
					StateStackPop();
					break;
				case 44:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					SwitchTo(DIRECTIVE);
					break;
				case 45:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					SwitchTo(DIRECTIVE);
					break;
				case 46:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					inDirective = false;
					StateStackPop();
					break;
				case 47:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					matchedToken.Kind = EOF;
					break;
				case 49:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					/*
		    * check to see if we are in set
		    *    ex.  #set $foo = $foo + 3
		    *  because we want to handle the \n after
		    */

					if (lparen == 0 && !inSet && curLexState != REFMOD2)
					{
						StateStackPop();
					}
					break;
				case 57:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					/*
		    * push the alpha char back into the stream so the following identifier 
		    * is complete
		    */

					input_stream.Backup(1);

					/*
		    * and munge the <DOT> so we just get a . when we have normal text that 
		    * looks like a ref.ident
		    */

					matchedToken.Image = ".";

					if (debugPrint)
						Console.Out.Write("DOT : switching to {0}", REFMODIFIER);
					SwitchTo(REFMODIFIER);
					break;
				case 59:
					if (image == null)
						image = new StringBuilder(new String(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1))));
					else
						image.Append(input_stream.GetSuffix(jjimageLen + (jjmatchedPos + 1)));
					StateStackPop();
					break;
				default:
					break;
			}
		}
예제 #16
0
		private bool jj_3R_90()
		{
			Token xsp = jj_scanpos;
			if (jj_3R_100(ParserConstants.LOGICAL_EQUALS, jj_3R_89()))
			{
				jj_scanpos = xsp;
				if (jj_3R_100(ParserConstants.LOGICAL_NOT_EQUALS, jj_3R_89()))
					return true;
				if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #17
0
		private bool jj_3R_57()
		{
			if (ScanToken(ParserConstants.LBRACKET))
				return true;
			if (ToRefactor1())
				return false;
			Token xsp = jj_scanpos;
			if (jj_3R_77())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			if (ScanToken(ParserConstants.RBRACKET))
				return true;
			if (ToRefactor1())
				return false;
			return false;
		}
예제 #18
0
		private bool jj_3R_29()
		{
			if (jj_3R_41())
				return true;
			if (ToRefactor1())
				return false;
			if (ScanToken(ParserConstants.LPAREN))
				return true;
			if (ToRefactor1())
				return false;
			Token xsp = jj_scanpos;
			if (jj_3R_42())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			if (ScanToken(ParserConstants.REFMOD2_RPAREN))
				return true;
			if (ToRefactor1())
				return false;
			return false;
		}
예제 #19
0
		private bool jj_3R_82()
		{
			if (jj_3R_84())
				return true;
			if (ToRefactor1())
				return false;
			while(true)
			{
				Token xsp = jj_scanpos;
				if (jj_3R_100(ParserConstants.LOGICAL_OR, jj_3R_84()))
				{
					jj_scanpos = xsp;
					break;
				}
				if (ToRefactor1())
					return false;
			}
			return false;
		}
예제 #20
0
		private bool jj_3_11()
		{
			Token xsp = jj_scanpos;
			if (jj_3R_52())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			if (ScanToken(ParserConstants.LOGICAL_NOT))
				return true;
			if (ToRefactor1())
				return false;
			if (jj_3R_33())
				return true;
			if (ToRefactor1())
				return false;
			return false;
		}
예제 #21
0
		private bool jj_3_3()
		{
			if (ScanToken(ParserConstants.LBRACKET))
				return true;
			if (ToRefactor1())
				return false;
			Token xsp = jj_scanpos;
			if (jj_3R_52())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			xsp = jj_scanpos;
			if (jj_3R_50(jj_3R_19()))
			{
				jj_scanpos = xsp;
				if (jj_3R_50(jj_3R_40()))
					return true;
				if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			xsp = jj_scanpos;
			if (jj_3R_52())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			if (ScanToken(ParserConstants.DOUBLEDOT))
				return true;
			if (ToRefactor1())
				return false;
			return false;
		}
예제 #22
0
		private bool jj_3R_101()
		{
			Token xsp = jj_scanpos;
			if (jj_3R_100(ParserConstants.MULTIPLY, jj_3R_33()))
			{
				jj_scanpos = xsp;
				if (jj_3R_100(ParserConstants.DIVIDE, jj_3R_33()))
				{
					jj_scanpos = xsp;
					if (jj_3R_100(ParserConstants.MODULUS, jj_3R_33()))
						return true;
					if (ToRefactor1())
						return false;
				}
				else if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #23
0
		public Parser(ParserTokenManager tm)
		{
			InitBlock();
			token_source = tm;
			token = new Token();
			jj_ntk_Renamed_Field = -1;
			jj_gen = 0;
			for(int i = 0; i < 53; i++)
				jj_la1[i] = -1;
			for(int i = 0; i < callsArray.Length; i++)
				callsArray[i] = new Calls();
		}
예제 #24
0
		private bool jj_3R_54()
		{
			Token xsp = jj_scanpos;
			if (jj_3R_52())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			xsp = jj_scanpos;
			if (jj_3R_50(jj_3R_55()))
			{
				jj_scanpos = xsp;
				if (jj_3R_50(jj_3R_56()))
				{
					jj_scanpos = xsp;
					if (jj_3R_50(jj_3R_57()))
					{
						jj_scanpos = xsp;
						if (jj_3R_50(jj_3R_58()))
						{
							jj_scanpos = xsp;
							if (jj_3R_50(jj_3R_59()))
							{
								jj_scanpos = xsp;
								if (jj_3R_50(jj_3R_19()))
								{
									jj_scanpos = xsp;
									if (jj_3R_50(jj_3R_40()))
										return true;
									if (ToRefactor1())
										return false;
								}
								else if (ToRefactor1())
									return false;
							}
							else if (ToRefactor1())
								return false;
						}
						else if (ToRefactor1())
							return false;
					}
					else if (ToRefactor1())
						return false;
				}
				else if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			xsp = jj_scanpos;
			if (jj_3R_52())
				jj_scanpos = xsp;
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #25
0
		private Token ConsumeToken(int kind)
		{
			Token oldToken = token;
			if (token.Next == null)
			{
				token = token.Next = token_source.NextToken;
			}
			else
			{
				token = token.Next;
			}
			jj_ntk_Renamed_Field = -1;
			if (token.Kind == kind)
			{
				jj_gen++;
				if (++jj_gc > 100)
				{
					jj_gc = 0;
					for(int i = 0; i < callsArray.Length; i++)
					{
						Calls c = callsArray[i];
						while(c != null)
						{
							if (c.Gen < jj_gen)
								c.First = null;
							c = c.Next;
						}
					}
				}
				return token;
			}
			token = oldToken;
			jj_kind = kind;
			throw GenerateParseException();
		}
예제 #26
0
		private bool jj_3R_96()
		{
			Token xsp = jj_scanpos;
			if (jj_3R_100(ParserConstants.PLUS, jj_3R_95()))
			{
				jj_scanpos = xsp;
				if (jj_3R_100(ParserConstants.MINUS, jj_3R_95()))
					return true;
				if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #27
0
		private void RescanToken()
		{
			jj_rescan = true;
			for(int i = 0; i < 12; i++)
			{
				Calls p = callsArray[i];
				do
				{
					if (p.Gen > jj_gen)
					{
						jj_la = p.Arg;
						jj_lastpos = jj_scanpos = p.First;
						switch(i)
						{
							case 0:
								jj_3R_50(jj_3R_19());
								break;

							case 1:
								jj_3_2();
								break;

							case 2:
								jj_3_3();
								break;

							case 3:
								jj_3_4();
								break;

							case 4:
								jj_3_7();
								break;

							case 5:
								jj_3R_50(jj_3R_29());
								break;

							case 6:
								jj_3_7();
								break;

							case 7:
								jj_3R_50(jj_3R_29());
								break;

							case 8:
								jj_3R_52();
								break;

							case 9:
								jj_3_10();
								break;

							case 10:
								jj_3_11();
								break;

							case 11:
								jj_3_12();
								break;
						}
					}
					p = p.Next;
				} while(p != null);
			}
			jj_rescan = false;
		}
예제 #28
0
		private bool jj_3R_77()
		{
			if (jj_3R_54())
				return true;
			if (ToRefactor1())
				return false;
			while(true)
			{
				Token xsp = jj_scanpos;
				if (jj_3R_100(ParserConstants.COMMA, jj_3R_54()))
				{
					jj_scanpos = xsp;
					break;
				}
				if (ToRefactor1())
					return false;
			}
			return false;
		}
예제 #29
0
		private bool jj_3R_92()
		{
			Token xsp;
			xsp = jj_scanpos;
			if (jj_3R_100(ParserConstants.LOGICAL_LT, jj_3R_91()))
			{
				jj_scanpos = xsp;
				if (jj_3R_100(ParserConstants.LOGICAL_GT, jj_3R_91()))
				{
					jj_scanpos = xsp;
					if (jj_3R_100(ParserConstants.LOGICAL_LE, jj_3R_91()))
					{
						jj_scanpos = xsp;
						if (jj_3R_100(ParserConstants.LOGICAL_GE, jj_3R_91()))
							return true;
						if (ToRefactor1())
							return false;
					}
					else if (ToRefactor1())
						return false;
				}
				else if (ToRefactor1())
					return false;
			}
			else if (ToRefactor1())
				return false;
			return false;
		}
예제 #30
0
	private bool jj_scan_token(int kind) {
	    if (jj_scanpos == jj_lastpos) {
		jj_la--;
		if (jj_scanpos.next == null) {
		    jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.NextToken;
		} else {
		    jj_lastpos = jj_scanpos = jj_scanpos.next;
		}
	    } else {
		jj_scanpos = jj_scanpos.next;
	    }
	    if (jj_rescan) {
		int i = 0;
		Token tok = token;
		while (tok != null && tok != jj_scanpos) {
		    i++;
		    tok = tok.next;
		}
		if (tok != null)
		    jj_add_error_token(kind, i);
	    }
	    return (jj_scanpos.kind != kind);
	}