示例#1
0
文件: Scanner.cs 项目: nickchal/pash
		private void RestoreStateAndPos(Scanner.Context ctx)
		{
			this.buffer.Position = ctx.bPos;
			this._cNum = ctx.cNum;
			this._state = ctx.state;
			this._chr = ctx.cChr;
		}
示例#2
0
文件: Scanner.cs 项目: nickchal/pash
		private void SaveStateAndPos(Scanner.Context ctx)
		{
			ctx.bPos = this.buffer.Position;
			ctx.cNum = this._cNum;
			ctx.state = this._state;
			ctx.cChr = this._chr;
		}
示例#3
0
文件: Scanner.cs 项目: nickchal/pash
		private Scanner.Result Recurse2(Scanner.Context ctx, int next)
		{
			this.SaveStateAndPos(ctx);
			this._state = next;
			if (this._state != 0)
			{
				this.GetChr();
				bool flag = false;
				while (true)
				{
					int num = this.NextState();
					next = num;
					if (num == this._currentStart)
					{
						break;
					}
					if (flag && next > 22)
					{
						this.SaveStateAndPos(ctx);
					}
					this._state = next;
					if (this._state == 0)
					{
						return Scanner.Result.accept;
					}
					this.GetChr();
					flag = this._state <= 22;
				}
				if (!flag)
				{
					return Scanner.Result.noMatch;
				}
				else
				{
					return Scanner.Result.accept;
				}
			}
			else
			{
				return Scanner.Result.accept;
			}
		}