本文整理汇总了C#中CSsemi.CSemiExp类的典型用法代码示例。如果您正苦于以下问题:C# CSsemi.CSemiExp类的具体用法?C# CSsemi.CSemiExp怎么用?C# CSsemi.CSemiExp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSsemi.CSemiExp类属于命名空间,在下文中一共展示了CSsemi.CSemiExp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: doAnalysis
static public void doAnalysis(string[] files)
{
int skipCount = 0;
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
Repository rep = Repository.getInstance();
List<Elem> fileSetInfo = new List<Elem>(); // store type and name of file set, use for relationship analysis
foreach (string file in files)
{
if(Display.showFiles)
Display.displayString("");
Display.displayFiles(act, "Processing file: " + file);
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
try
{
while (semi.getSemi())
{
parser.parse(semi);
}
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
foreach (Elem e in rep.locations)
{
e.filename = file;
}
List<Elem> table = rep.locations;
if (table.Count == 0)
{
++skipCount;
continue;
}
fileSetInfo.AddRange(rep.locations); // push all elements in current file into inquiry table
semi.close();
rep.LocationsTable[file] = table; // Obtained all the types and names of the file set, locationTable is actually a inquiry table
rep.locations = new List<Elem>();
}
doAnalysis_Again(fileSetInfo, files);
displaySkipped(skipCount);
//displayAnalysis(rep);
//analysisSummary(rep);
}
开发者ID:bizarreWizard,项目名称:dependency_analyzer,代码行数:60,代码来源:Analyzer.cs
示例2: doAnalysis
//----------<parse1 starts here, it identifies all the types>-----------------
public void doAnalysis(string[] files)
{
foreach (object file in files)
{
string filename = Convert.ToString(file);
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
try
{
while (semi.getSemi())
parser.parse(semi, filename);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
Repository rep = Repository.getInstance();
List<Elem> table = rep.locations; //storing the repository data into a List
semi.close();
}
}
开发者ID:WaverV,项目名称:Projects,代码行数:35,代码来源:Analyzer.cs
示例3: doAnalysis
// function that parse all the files and build a inquiry table
static void doAnalysis(string[] files, bool relation, bool xml)
{
List<Elem> fileSetInfo = new List<Elem>(); // store type and name of file set, use for relationship analysis
List<Elem> summaryTAB = new List<Elem>(); // store size and complexity, use for display summary of the whole file set
foreach (object file in files)
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); // creat a repository
Parser parser = builder.build(); // creat a parser object and five rule object, attach the rules to parser
try
{
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
Repository rep = Repository.getInstance();
fileSetInfo.AddRange(rep.locations); // push all elements in current file into inquiry table
semi.close();
}
secondAnalysis(files, fileSetInfo, summaryTAB, relation, xml);
}
开发者ID:bizarreWizard,项目名称:code_analyzer_engine,代码行数:33,代码来源:Analyzer.cs
示例4: doRelationAnalysis
// ------------< to find Relationship between types defiend >--------------
public static void doRelationAnalysis(string[] files)
{
string filename = null;
foreach (object file in files)
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzerRelation builder = new BuildCodeAnalyzerRelation(semi);
Parser parser = builder.build();
try
{
filename = file.ToString();
while (semi.getSemi())
parser.parse(semi, filename);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
semi.close();
}
}
开发者ID:sunilkumarlakkad,项目名称:Code-Analyzer,代码行数:30,代码来源:Analyzer.cs
示例5: doAnalysis
//------< to find types defiend, functions and Complexity and size of functions >-----
public static void doAnalysis(string[] files)
{
string filename = null;
foreach (object file in files)
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
try
{
filename = file.ToString();
while (semi.getSemi())
parser.parse(semi, filename);
// filename store with types and function to identify which types belongs to which file.
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
semi.close();
typetable= RepositoryForOutput.storageForOutput_;
}
}
开发者ID:karantech9,项目名称:Dependency-Analyzer,代码行数:34,代码来源:Analyzer.cs
示例6: doAnalysis
static public void doAnalysis(string[] files,bool relationship) {
BuildCodeAnalyzer builder;
BuildCodeAnalyzer_relation builder_relation;
Parser parser;
Parser parser_;
for(int i=0;i<2;i++) {
foreach (object file in files) {
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
CSsemi.CSemiExp semi_relation = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string)) {
Console.Write("\n Can't open {0}\n\n", file);
return;
}
if (!semi_relation.open(file as string)) {
Console.Write("\n Can't open {0}\n\n", file);
return;
}
if (i == 0) {
builder = new BuildCodeAnalyzer(semi);
parser = builder.build();
Repository rep1 = Repository.getInstance();
rep1.setfilename(Path.GetFileName(file.ToString()));
try {
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
}
else {
builder_relation = new BuildCodeAnalyzer_relation(semi_relation);
parser_ = builder_relation.build_relation();
Repository rep1 = Repository.getInstance();
rep1.setfilename(Path.GetFileName(file.ToString()));
try {
while (semi_relation.getSemi())
parser_.parse(semi_relation);
}
catch (Exception ex) {
Console.Write("\n\n {0}\n", ex.Message);
}
}
semi.close(); }
if (!relationship)
return;
}
}
开发者ID:nigandhi,项目名称:Code-Analyzer,代码行数:50,代码来源:Analyzer.cs
示例7: doAnalysis
static void doAnalysis(string[] files)
{
Console.Write("\n Demonstrating Parser");
Console.Write("\n ======================\n");
foreach (object file in files)
{
Console.Write("\n Processing file {0}\n", file as string);
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
Console.Write("\n Type and Function Analysis");
Console.Write("\n ----------------------------\n");
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
try
{
while (semi.getSemi())
parser.parse(semi);
Console.Write("\n\n locations table contains:");
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
Repository rep = Repository.getInstance();
List<Elem> table = rep.locations;
foreach (Elem e in table)
{
Console.Write("\n {0,10}, {1,25}, {2,5}, {3,5} , {4,5}", e.type, e.name, e.begin, e.end, e.end - e.begin + 1);
}
Console.WriteLine();
Console.Write("\n\n That's all folks!\n\n");
semi.close();
}
}
开发者ID:DhivyaNarayanan,项目名称:CodeAnalyzer,代码行数:44,代码来源:Analyzer.cs
示例8: analyze
//read the list of files, one by one and calls BuildCodeAnalyzer and parser functions
public void analyze(string serverName)
{
Console.Write("\n CODE ANALYZER");
Console.Write("\n ======================\n");
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
foreach (object file in files)
{
Console.Write("\n\n Processing file {0}\n", file as string);
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
Console.Write("\n Type and Function Analysis");
Console.Write("\n ----------------------------\n");
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
CodeAnalysis.Parser parser = builder.build();
Repository repo = Repository.getInstance();
Elem elem = getDefaultElemData(file.ToString(), serverName);
repo.analyzedata.Add(elem);
try
{
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
semi.close();
}
}
开发者ID:prmk,项目名称:DependencyAnalyzer,代码行数:41,代码来源:Analyzer.cs
示例9: test
public override bool test(CSsemi.CSemiExp semi, string filename)
{
int index = semi.Contains("delegate");
if (index != -1)
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
// create local semiExp with tokens for type and name
local.displayNewLines = false;
local.Add(semi[index]).Add(semi[index + 2]);
doActions(local, filename);
return true;
}
return false;
}
开发者ID:sunilkumarlakkad,项目名称:Dependency-Analyzer,代码行数:14,代码来源:RulesAndActions.cs
示例10: test
public override bool test(CSsemi.CSemiExp semi)
{
Display.displayRules(actionDelegate, "rule DetectFunction");
if (semi[semi.count - 1] != "{")
return false;
int index = semi.FindFirst("(");
if (index > 0 && !isSpecialToken(semi[index - 1]))
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
local.Add("function").Add(semi[index - 1]);
doActions(local);
return true;
}
return false;
}
开发者ID:bizarreWizard,项目名称:dependency_analyzer,代码行数:16,代码来源:RulesAndActions.cs
示例11: findDefinedTypes
public void findDefinedTypes(string file)
{
CodeAnalysis.Parser p = new CodeAnalysis.Parser();
enterScopeRule esr = new enterScopeRule();
displayEnterScope des = new displayEnterScope();
esr.add(des);
p.add(esr);
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
if (!semi.open(file))
{
Console.Write("\n\n can't open file {0} for analysis\n", file);
}
while (semi.getSemi())
p.parse(semi);
}
开发者ID:Logeshkumar,项目名称:Projects,代码行数:16,代码来源:TypeController.cs
示例12: aggregationTest
private void aggregationTest(CSsemi.CSemiExp semi, int index, string filename, string filenameto, string namespacename)
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
if ((semi[index + 2].Equals(".")))
{
local.Add("Aggregation").Add(semi[index + 3]).Add(semi[index - 2]).Add(filenameto).Add(namespacename);
doActions(local, filename);
}
else
{
local.Add("Aggregation").Add(semi[index + 1]).Add(semi[index - 2]).Add(filenameto).Add(namespacename);
doActions(local, filename);
}
}
开发者ID:sunilkumarlakkad,项目名称:Dependency-Analyzer,代码行数:14,代码来源:RulesAndActions.cs
示例13: test
public override bool test(CSsemi.CSemiExp semi)
{
int indexEN = semi.Contains("enum");
if (indexEN != -1)
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
local.displayNewLines = false;
local.Add(semi[indexEN]).Add(semi[indexEN + 1]);
doActions(local);
return true;
}
return false;
}
开发者ID:bizarreWizard,项目名称:code_analyzer_engine,代码行数:13,代码来源:RulesAndActions.cs
示例14: test
public override bool test(CSsemi.CSemiExp semi, string filename)
{
string[] SpecialToken = { "try", "for", "foreach", "while", "switch", "if", "else", "catch", "using", "unsafe", "finally", "break" };
int index = -1;
foreach (string stoken in SpecialToken)
{
index = semi.Contains(stoken);
if (index != -1)
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
// create local semiExp with tokens for type and name
local.displayNewLines = false;
local.Add("complexity");
doActions(local, filename);
return false;
}
}
return false;
}
开发者ID:sunilkumarlakkad,项目名称:Code-Analyzer,代码行数:19,代码来源:RulesAndActions.cs
示例15: test
public override bool test(CSsemi.CSemiExp semi)
{
if (semi[semi.count - 1] != "{")
return false;
// strip off leading #if(TEST_XYZ) if it's in this semi
if (semi.FindFirst("#") != -1)
{
int loc = semi.FindFirst(")");
for (int i = 0; i <= loc; ++i)
semi.remove(0);
}
// now find function
int index = semi.FindFirst("(");
if (index > 0 && !isSpecialToken(semi[index - 1]))
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
local.Add("function").Add(semi[index - 1]);
doActions(local);
return true;
}
return false;
}
开发者ID:mukund24,项目名称:Source-Code-Publisher,代码行数:25,代码来源:RulesAndActions.cs
示例16: relationshipanalysis
public void relationshipanalysis(Elem e, object file, List<Elem> fileSetInfo)
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.open(file as string);
do
{
semi.getSemi();
} while (semi.lineCount < (e.begin-1)); // ignore semi before type define
while (semi.lineCount <= e.end)
{ // detect four kinds of relationship
inheritance(semi, e);
aggregation(semi, e, fileSetInfo);
composition(semi, e, fileSetInfo);
usingRelationship(semi, e, fileSetInfo);
semi.getSemi();
}
return;
}
开发者ID:bizarreWizard,项目名称:code_analyzer_engine,代码行数:18,代码来源:RulesAndActions.cs
示例17: doAnalysis
static void doAnalysis(string[] files, bool relation_flag, bool xml_flag)
{
List<Elem> TABLE = new List<Elem>();
foreach (object file in files)
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
try
{
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
Repository rep = Repository.getInstance();
TABLE.AddRange(rep.locations); // Build a TABLE to store all the elements, provided to be searched for relationshipAnalysis class
semi.close();
}
Console.Write("\n Demonstrating Parser");
Console.Write("\n ======================\n");
// parse all files and store the elements into table for each file
foreach (object file in files)
{
Console.Write("\n Processing file {0}\n", file as string);
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
try
{
while (semi.getSemi())
parser.parse(semi);
Console.Write("\n\n locations table contains:");
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
Repository rep = Repository.getInstance();
List<Elem> table = rep.locations;
// display basic information for elements including size and complexity
Console.Write("\n type name begin end size complexity");
foreach (Elem e in table)
{
if (e.type == "function")
{
ComplexityAnalysis ca = new ComplexityAnalysis();
e.complexity = ca.ComplexityAnalyze(e, file);
}
Console.Write("\n {0,9}, {1,20}, {2,8}, {3,8}, {4,8}, {5,8}", e.type, e.name, e.begin, e.end, e.end - e.begin + 1, e.complexity);
}
//display the relationships between classes
if (relation_flag == true)
{
foreach (Elem e in table)
{
e.AggregationFlag = false;
e.CompositionFlag = false;
e.UsingFlag = false;
if (e.type == "class" || e.type == "struct" || e.type == "interface")
{
Console.Write("\n\n {0} {1}", e.type, e.name);
Console.Write("------------------------------------------------------\n");
RelationshipAnalysis ra = new RelationshipAnalysis();
ra.RelationshipAnalyzer(e, file, TABLE);
foreach (Elem ele in TABLE)
{
ele.AggregationFlag = false;
ele.CompositionFlag = false;
ele.UsingFlag = false;
}
}
}
}
Console.WriteLine();
//display xml files for each file
if (xml_flag == true)
{
//.........这里部分代码省略.........
开发者ID:DiyaChen,项目名称:DependencyAnalyzer,代码行数:101,代码来源:Analyzer.cs
示例18: inhertanceTest
private void inhertanceTest(CSsemi.CSemiExp semi, int index, string filename)
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
CSsemi.CSemiExp local1 = new CSsemi.CSemiExp();
local.displayNewLines = false;
local1.displayNewLines = false;
if ((semi[index + 2].Equals(":")))
{
foreach (Elem check in table)
{
if (check.name.Equals(semi[index + 3]))
{
local.Add(semi[index]).Add("Inheritance").Add(semi[index + 1]).Add(semi[index + 3]).Add(check.filename).Add(check.namespacename);
doActions(local, filename);
break;
}
}
}
if ((semi[index + 2].Equals(":")) && (semi[index + 4].Equals(",")))
{
foreach (Elem check in table)
{
if (check.name.Equals(semi[index + 5]))
{
local1.Add(semi[index]).Add("Inheritance").Add(semi[index + 1]).Add(semi[index + 5]).Add(check.filename).Add(check.namespacename);
doActions(local1, filename);
break;
}
}
}
}
开发者ID:sunilkumarlakkad,项目名称:Dependency-Analyzer,代码行数:32,代码来源:RulesAndActions.cs
示例19: Main
//----< Test Stub >--------------------------------------------------
#if(TEST_PARSER)
static void Main(string[] args)
{
Console.Write("\n Demonstrating Parser");
Console.Write("\n ======================\n");
ShowCommandLine(args);
List<string> files = TestParser.ProcessCommandline(args);
foreach (string file in files)
{
Console.Write("\n Processing file {0}\n", System.IO.Path.GetFileName(file));
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", args[0]);
return;
}
Console.Write("\n Type and Function Analysis");
Console.Write("\n ----------------------------");
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
try
{
while (semi.getSemi())
parser.parse(semi);
Console.Write("\n locations table contains:");
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
Repository rep = Repository.getInstance();
List<Elem> table = rep.locations;
Console.Write(
"\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}",
"category", "name", "bLine", "eLine", "bScop", "eScop", "size", "cmplx"
);
Console.Write(
"\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}",
"--------", "----", "-----", "-----", "-----", "-----", "----", "-----"
);
foreach (Elem e in table)
{
if (e.type == "class" || e.type == "struct")
Console.Write("\n");
Console.Write(
"\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}",
e.type, e.name, e.beginLine, e.endLine, e.beginScopeCount, e.endScopeCount+1,
e.endLine-e.beginLine+1, e.endScopeCount-e.beginScopeCount+1
);
}
Console.Write("\n");
semi.close();
}
Console.Write("\n\n");
}
开发者ID:bizarreWizard,项目名称:dependency_analyzer,代码行数:66,代码来源:Parser.cs
示例20: complexityAnalysis
public int complexityAnalysis(Elem e, object file, List<Elem> fileSetInfo)
{
int count = 0;
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.open(file as string);
do
{
semi.getSemi();
} while (semi.lineCount < e.begin); // ignore all the semi before function begin
while (semi.lineCount <= e.end)
{
if (semi.Contains("if") != -1)
count++;
if (semi.Contains("else") != -1)
count++;
if (semi.Contains("for") != -1)
count++;
if (semi.Contains("foreach") != -1)
count++;
if (semi.Contains("while") != -1 && semi[semi.count - 1] != ";")
count++;
if (semi.Contains("do") != -1)
count++;
if (semi.Contains("case") != -1)
count++;
if (semi.Contains("try") != -1)
count++;
if (semi.Contains("catch") != -1)
count++;
if (specialCB(semi)) // special curly brace
count++;
semi.getSemi();
}
return count;
}
开发者ID:bizarreWizard,项目名称:code_analyzer_engine,代码行数:35,代码来源:RulesAndActions.cs
注:本文中的CSsemi.CSemiExp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论