1:   /* Created by SharpDevelop.
2:    * User: Eduardo Rocha Monteiro ([email protected])
3:    * Date: 26/11/2004
4:    * Time: 17:22
5:   */
6:  
7:   using System;
8:   using System.IO;
9:   using System.Collections;
10:   using Compilador.AnalisadorLexicoN.AutomatoN;
11:   using Compilador.AnalisadorLexicoN;
12:   using Compilador.Util;
13:  
14:   namespace Compilador.AnalisadorLexicoN
15:   {
16:       /// <summary>
17:       /// Description of AnalisadorLexico.
18:       /// </summary>
19:       public class AnalisadorLexico
20:       {
21:           int 0;
22:           Automato _automato;
23:           FPrimHash _fPrimHash;        
24:           ItemLexico _itemLexico;
25:           Acoes _acoes;
26:           int _estadoAtual;
27:           char []_progFonte;
28:           int _progSize;
29:           public AnalisadorLexico(string automatoTxt,string funcoesTxt,string progFonteTxt)
30:           {
31:               _estadoAtual 1;
32:               _acoes new Acoes();
33:               StreamReader sr new StreamReader(progFonteTxt);
34:               string sr.ReadToEnd();
35:               _progSize =a.Length;
36:               _progFonte a.ToCharArray();
37:               _automato new Automato(automatoTxt);
38:               _fPrimHash new FPrimHash(funcoesTxt,11);                                        
39:           }
40:           
41:           public ItemLexico ProximoItemLexico()
42:           {
43:               _itemLexico     new ItemLexico();
44:               _automato    _automato.Posiciona(_estadoAtual);                
45:               while(i<_progSize)
46:               {                                            
47:                   while(i<_progSize && (_progFonte[i]==' ' || _progFonte[i]=='\n'))
48:                       i++;
49:                   while(i<_progSize && _progFonte[i]!=' ' && _progFonte[i]!='\n')
50:                   {
51:                       if(AnalisaCaracter(_progFonte[i]))
52:                       {
53:                           _estadoAtual _automato._estadoSeguinte;
54:                           
55:                           if(_estadoAtual==100)
56:                           {
57:                               _itemLexico  _acoes.ExecAcao(_progFonte[i],_automato._acao,_fPrimHash);                        
58:                               _estadoAtual=1;
59:                               if(_automato._index==|| _automato._index==6)
60:                               {
61:                                   i--;
62:                               }
63:                               _automato _automato.Posiciona(_estadoAtual);                                                                
64:                               i++;
65:                               return _itemLexico;    
66:                           }
67:                           _itemLexico  _acoes.ExecAcao(_progFonte[i],_automato._acao,_fPrimHash);                        
68:                           _automato _automato.Posiciona(_estadoAtual);                                                                
69:                           i++;                    
70:                       }
71:                       else
72:                       {
73:                           _automato _automato.next;
74:                           _estadoAtual _automato._estadoAtual;
75:                           if(_estadoAtual!=_automato._estadoAtual)
76:                               Console.WriteLine("ERRO");
77:                       }                                                            
78:                   }                
79:               }
80:               return null;
81:           }        
82:           public bool AnalisaCaracter(char charToCheck)
83:           {            
84:               if(Conjuntos.IsIn(charToCheck,_automato._caracterLido))
85:                   return true;
86:               return false;                
87:           }
88:       }
89:   }

This page was automatically generated by SharpDevelop.

1