Exemple #1
0
		private void OnSub(Object sender, ActionEventArgs args)
		{
			Console.Out.WriteLine("sub");
			int second = numberStack.Pop();
			int first = numberStack.Pop();
			numberStack.Push(first - second);
		}
		private void OnDifferenceParserSuccess(object sender, ActionEventArgs args)
		{
			this._differenceParserSuccess = true;
		}
		void OnLetterOrDigitParserSuccess(object sender, ActionEventArgs args)
		{
			this._letterOrDigitParserSuccess = true;
		}
		private void OnLetterParserSuccess(object sender, ActionEventArgs args)
		{
			this._letterParserSuccess = true;
		}
		private void OnSymbolParserSuccess(object sender, ActionEventArgs args)
		{
			this._symbolParserSuccess = true;
		}
			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();
			}
			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());
			}
			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();
			}
			private void OnCharacter(object sender, ActionEventArgs args)
			{
				_currentCollationElement.Append(IcuEscape(args.Value));
			}
			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);
			}
Exemple #11
0
		private void OnInteger(object sender, ActionEventArgs args)
		{
			Console.Out.WriteLine("integer: {0}", args.Value);
			numberStack.Push(int.Parse(args.Value));
		}
Exemple #12
0
		private void OnExpression(object sender, ActionEventArgs args)
		{
			Console.Out.WriteLine("expression: {0} = {1}", args.Value, numberStack.Peek());
		}