private void button2_Click(object sender, EventArgs e) { textBox3.Clear(); textBox4.Clear(); if (m_Tokens == null) { return; } Parser2 parser = new Parser2(null, "rest"); LinkedList <Tokenizer.Token> _Tokens = new LinkedList <Tokenizer.Token>(); _Tokens.AddLast(m_Tokens); parser.ParseTokens(_Tokens); LinkedList <Parser2.Context.Log> .Enumerator x = parser.GetLogs().GetEnumerator(); while (x.MoveNext()) { if (x.Current.m_Error > 0) { textBox4.Text += x.Current.m_Text + " at " + x.Current.m_Cmd.AsText() + "\r\n"; } } LinkedList <Parser2.CmdBase> .Enumerator Result = parser.GetCmds("").GetEnumerator(); while (Result.MoveNext()) { textBox3.Text += (Result.Current.AsText() + "\r\n"); } }
void RebuildObjList() { // add the basic types to Intelisense ObjDecl _A; for (int i = 0; i < BASIC_TYPES.Count; i++) { _A = new ObjDecl(BASIC_TYPES[i], ObjDecl.TClassType.tCTType, "", "", "", "", 0, 0); UpdateObjDecl(_A); } DateTime _start = DateTime.Now; //Log.getInstance().Add("collecting files ", Log.EnuSeverity.Info, ""); Tokenizer _tokenizer = new Tokenizer(); LinkedList <Tokenizer.Token> _Tokens = new LinkedList <Tokenizer.Token>(); List <String> Dirs = new List <String>(); //stack of directories relative to _path int k = 0; try { String[] _SubProj = getSubProj(); for (int i = 0; i < _SubProj.Length; i++) { Dirs.Add(Path.Combine(m_ProjectDir, getSeqDir(_SubProj[i]))); } while (k < Dirs.Count) { FileInfo[] _files = new DirectoryInfo(Dirs[k]).GetFiles(); for (int i = 0; i < _files.Length; i++) { if (_files[i].Extension.Equals(".seq", StringComparison.OrdinalIgnoreCase)) { _Tokens.AddLast(_tokenizer.TokenizeFile(_files[i].FullName)); } } DirectoryInfo[] _Dirs = new DirectoryInfo(Dirs[k]).GetDirectories(); for (int i = 0; i < _Dirs.Length; i++) { // If the file is a directory (or is in some way invalid) we'll skip it Dirs.Insert(k + 1, _Dirs[i].FullName); } k++; } //Log.getInstance().Add("Tokenized all" , Log.EnuSeverity.Info, ""); Parser2 _parser2 = new Parser2(this, m_ProjectDir); _parser2.ParseTokens(_Tokens); LinkedList <Parser2.Context.Log> .Enumerator _l = _parser2.GetLogs().GetEnumerator(); while (_l.MoveNext()) { Log.getInstance().Add(_l.Current.m_Text, Log.EnuSeverity.Warn, _l.Current.m_Cmd.AsText()); } //update database with parserresult LinkedList <Parser2.CmdBase> .Enumerator _Cmds; List <String> .Enumerator _Scopes = _parser2.GetScopes().GetEnumerator(); while (_Scopes.MoveNext()) { //Log.getInstance().Add("write DB " + _Scopes.Current, Log.EnuSeverity.Info, ""); // if(!m_IsClassDef) { { //each SEQ includes itself this.UpdateObjList(new Obj(_Scopes.Current, "", _Scopes.Current, "", 0, 0)); } _Cmds = _parser2.GetCmds(_Scopes.Current).GetEnumerator(); while (_Cmds.MoveNext()) { PublishCmdToDB(_Scopes.Current, _Cmds.Current); } } Log.getInstance().Add("Parsing done ", Log.EnuSeverity.Info, ""); } catch (Exception ex) { Log.getInstance().Add(ex.Message, Log.EnuSeverity.Error, ""); } finally { } }