/// <summary> /// this needs to be called before processing next file token /// </summary> /// <param name="Scope"></param> public void ResetState(String filePath) { m_IsRoot = true; m_Scope = filePath; if (!filePath.Equals("")) { m_Scope = m_Model.GetRelativePath(filePath); // the sequence relative to project-dir } m_Context.ResetCmds(m_Scope); }
public int AnalyseFile(String filePath) { m_Comment = ""; m_SlashStarComment = false; int _Ret = 0; if (!File.Exists(filePath)) { return(-1); } string ext = Path.GetExtension(filePath).ToLower(); if (string.IsNullOrEmpty(ext) || !ext.Equals(".seq")) //only .seq files are parsed { return(-1); } m_Scope = m_Model.GetRelativePath(filePath); // the sequence relative to project-dir m_IsClassDef = false; /* TODO * if (resource.getProjectRelativePath().segment(0).equalsIgnoreCase("SOURCE")) { * m_IsClassDef = true; //Version 1 its in //SOURCE//... * } * if (resource.getProjectRelativePath().segment(0).equalsIgnoreCase("APP")) { * m_IsClassDef = true; //Version 2 its in //APP//PLUGINS//... * }*/ if (!m_IsClassDef) //each SEQ includes itself { m_Model.UpdateObjList(new Obj(m_Scope, "", m_Scope, "")); } int levelCurrent = 0; int levelPrev = -1; int lineNo = 0; foreach (string _line in File.ReadAllLines(filePath)) { evaluate(_line, lineNo); if (_line.Contains("{")) { levelCurrent++; } if (_line.Contains("}")) { levelCurrent--; } uint lev = (uint)levelPrev; NPP.SetFoldLevel(lineNo, lev, levelCurrent > levelPrev); //Todo !! levelPrev = levelCurrent; lineNo++; } return(_Ret); }