Advertisement
uniblab

processing words

Dec 4th, 2020 (edited)
1,149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. var line = System.Console.In.ReadLine().TrimToNull();
  2. while ( !System.String.IsNullOrEmpty( line ) ) {
  3.     foreach ( var word in ReadWord( line ) ) {
  4.         var operator = FindWord( word );
  5.         if ( null == operator ) {
  6.             var wordNotFound = new System.InvalidOperationException( "word not found: " + word );
  7.             wordNotFound.Data.Add( "word", word );
  8.             throw wordNotFound;
  9.         }
  10.         stack = operator.Execute( stack );
  11.     }
  12.     line = System.Console.In.ReadLine().TrimToNull();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement