コード例 #1
0
ファイル: Calculator.cs プロジェクト: JohnThomson/libpalaso
		private void OnSub(Object sender, ActionEventArgs args)
		{
			Console.Out.WriteLine("sub");
			int second = numberStack.Pop();
			int first = numberStack.Pop();
			numberStack.Push(first - second);
		}
コード例 #2
0
		private void OnDifferenceParserSuccess(object sender, ActionEventArgs args)
		{
			this._differenceParserSuccess = true;
		}
コード例 #3
0
		void OnLetterOrDigitParserSuccess(object sender, ActionEventArgs args)
		{
			this._letterOrDigitParserSuccess = true;
		}
コード例 #4
0
		private void OnLetterParserSuccess(object sender, ActionEventArgs args)
		{
			this._letterParserSuccess = true;
		}
コード例 #5
0
		private void OnSymbolParserSuccess(object sender, ActionEventArgs args)
		{
			this._symbolParserSuccess = true;
		}
コード例 #6
0
			private void OnCollationRules(object sender, ActionEventArgs args)
			{
				StringBuilder sb = new StringBuilder();
				if (_currentCollationLines.Count > 0)
				{
					sb.Append("&[before 1] [first regular] < ");
				}
				while (_currentCollationLines.Count != 0)
				{
					sb.Append(_currentCollationLines.Dequeue());
					if (_currentCollationLines.Count > 0)
					{
						sb.Append(" < "); // primary distinction
					}
				}

				_result = sb.ToString();
			}
コード例 #7
0
			private void OnCollationLine(object sender, ActionEventArgs args)
			{
				StringBuilder sb = new StringBuilder();
				while (_currentCollationGroups.Count != 0)
				{
					sb.Append(_currentCollationGroups.Dequeue());
					if (_currentCollationGroups.Count > 0)
					{
						sb.Append(" << "); // secondary distinction
					}
				}

				_currentCollationLines.Enqueue(sb.ToString());
			}
コード例 #8
0
			private void OnCollationElement(object sender, ActionEventArgs args)
			{
				string collationElement = _currentCollationElement.ToString();
				_usedCollationElements.Add(collationElement);
				if (inCollationGroup)
				{
					_currentCollationElements.Enqueue(collationElement);
				}
				else
				{
					_currentCollationGroups.Enqueue(collationElement);
				}
				_currentCollationElement = new StringBuilder();
			}
コード例 #9
0
			private void OnCharacter(object sender, ActionEventArgs args)
			{
				_currentCollationElement.Append(IcuEscape(args.Value));
			}
コード例 #10
0
			private void OnUnicodeEscapeCharacter(object sender, ActionEventArgs args)
			{
				Debug.Assert(args.Value.Length == 6);
				ushort unicodeCharacterValue = UInt16.Parse(args.Value.Substring(2), NumberStyles.AllowHexSpecifier);
				// is it a surrogate?
				string s;
				if (0xD800 <= unicodeCharacterValue && unicodeCharacterValue <= 0xdfff)
				{
					s = args.Value; // just keep the unicode escape character and let icu handle the error
					// if there isn't a valid one following
				}
				else
				{
					s = Char.ConvertFromUtf32(unicodeCharacterValue);
					s = IcuEscape(s);
				}
				_currentCollationElement.Append(s);
			}
コード例 #11
0
ファイル: Calculator.cs プロジェクト: JohnThomson/libpalaso
		private void OnInteger(object sender, ActionEventArgs args)
		{
			Console.Out.WriteLine("integer: {0}", args.Value);
			numberStack.Push(int.Parse(args.Value));
		}
コード例 #12
0
ファイル: Calculator.cs プロジェクト: JohnThomson/libpalaso
		private void OnExpression(object sender, ActionEventArgs args)
		{
			Console.Out.WriteLine("expression: {0} = {1}", args.Value, numberStack.Peek());
		}