|
1 /* |
|
2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 using System; |
|
19 using System.Text; |
|
20 using System.Collections; |
|
21 using SymBuildParsingLib.Token; |
|
22 |
|
23 namespace SymBuildParsingLib.Lexer |
|
24 { |
|
25 public class SymLexedTokens |
|
26 { |
|
27 #region Observer interface |
|
28 public delegate void TokenHandler( SymToken aNewToken ); |
|
29 #endregion |
|
30 |
|
31 #region Events |
|
32 public event TokenHandler iTokenHandlers; |
|
33 #endregion |
|
34 |
|
35 #region Constructors & destructor |
|
36 public SymLexedTokens() |
|
37 { |
|
38 } |
|
39 #endregion |
|
40 |
|
41 #region API |
|
42 public void Enqueue( SymToken aToken ) |
|
43 { |
|
44 iTokens.Enqueue( aToken ); |
|
45 NotifyNewToken( aToken ); |
|
46 } |
|
47 |
|
48 public SymToken Dequeue() |
|
49 { |
|
50 SymToken ret = (SymToken) iTokens.Dequeue(); |
|
51 return ret; |
|
52 } |
|
53 #endregion |
|
54 |
|
55 #region Properties |
|
56 public int Count |
|
57 { |
|
58 get { return iTokens.Count; } |
|
59 } |
|
60 #endregion |
|
61 |
|
62 #region Internal methods |
|
63 private void NotifyNewToken( SymToken aToken ) |
|
64 { |
|
65 if ( iTokenHandlers != null ) |
|
66 { |
|
67 iTokenHandlers( aToken ); |
|
68 } |
|
69 } |
|
70 #endregion |
|
71 |
|
72 #region Data members |
|
73 private Queue iTokens = new Queue( 250 ); |
|
74 #endregion |
|
75 } |
|
76 } |