diff options
Diffstat (limited to 'mcs/ilasm/parser/ScannerAdapter.cs')
-rw-r--r-- | mcs/ilasm/parser/ScannerAdapter.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/mcs/ilasm/parser/ScannerAdapter.cs b/mcs/ilasm/parser/ScannerAdapter.cs new file mode 100644 index 00000000000..45a0cc89744 --- /dev/null +++ b/mcs/ilasm/parser/ScannerAdapter.cs @@ -0,0 +1,60 @@ +// ScannerAdapter.cs
+// (C) Sergey Chaban (serge@wildwestsoftware.com)
+
+using System;
+
+namespace Mono.ILASM {
+
+ /// <summary>
+ /// </summary>
+ public class ScannerAdapter : yyParser.yyInput {
+
+ private ITokenStream tokens;
+
+ /// <summary>
+ /// </summary>
+ /// <param name="tokens"></param>
+ public ScannerAdapter (ITokenStream tokens)
+ {
+ this.tokens = tokens;
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public ITokenStream BaseStream {
+ get {
+ return tokens;
+ }
+ }
+
+ //
+ // yyParser.yyInput interface
+ //
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public bool advance ()
+ {
+ return (tokens.NextToken != ILToken.EOF);
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public int token ()
+ {
+ return tokens.LastToken.TokenId;
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public object value ()
+ {
+ return tokens.LastToken.Value;
+ }
+ }
+}
+
|