本文整理汇总了C#中CSsemi.CSemiExp.close方法的典型用法代码示例。如果您正苦于以下问题:C# CSsemi.CSemiExp.close方法的具体用法?C# CSsemi.CSemiExp.close怎么用?C# CSsemi.CSemiExp.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSsemi.CSemiExp
的用法示例。
在下文中一共展示了CSsemi.CSemiExp.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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_;
}
}
示例2: 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);
}
示例3: 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();
}
}
示例4: 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();
}
}
示例5: 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");
}
示例6: 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)
{
//.........这里部分代码省略.........
示例7: 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;
}
}
示例8: analyze
//read the list of files, one by one and calls BuildCodeAnalyzer and parser functions
public void analyze()
{
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();
try
{
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
semi.close();
if (relationshipflag)
{
semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzerRelationships builderreln = new BuildCodeAnalyzerRelationships(semi);
parser = builderreln.build();
try
{
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
}
semi.close();
}
}
示例9: Main
//----< Test Stub >--------------------------------------------------
#if(TEST_PARSER)
static void Main(string[] args)
{
Console.Write("\n Demonstrating Parser");
Console.Write("\n ======================\n");
List<string> files = TestParser.ProcessCommandline(args);
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", args[0]);
return;
}
Console.Write("\n Type and Function Analysis");
Console.Write("\n ----------------------------\n");
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
while (semi.getSemi())
parser.parse(semi);
//Console.Write("\n\n locations table contains:");
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}", e.type, e.name, e.begin, e.end);
}
//Console.WriteLine();
// Console.Write("\n\n That's all folks!\n\n");
semi.close();
}
}
示例10: Main
static void Main(string[] args)
{
Console.Write("\n Demonstrating Parser");
Console.Write("\n ======================\n");
ArrayList files = TestParser.ProcessCommandline(args);
if (files.Count == 0)
{
Console.Write("\n couldn't retrieve any files to process\n\n");
return;
}
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", args[0]);
return;
}
Console.Write("\n First - Type Analysis");
Console.Write("\n -----------------------\n");
BuildTypeAnal TAbuilder = new BuildTypeAnal();
Parser parser = TAbuilder.build();
while (semi.getSemi())
parser.parse(semi);
Console.Write("\n\n That's all the types folks!\n\n");
semi.close();
Console.Write("\n Now - Scope Analysis");
Console.Write("\n ----------------------");
BuildScopeAnal SAbuilder = new BuildScopeAnal();
parser = SAbuilder.build();
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file as string);
return;
}
while (semi.getSemi())
parser.parse(semi);
Console.Write("\n\n That's all the scopes folks!\n\n");
}
}
示例11: 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);
}
示例12: doAnalysis_Again
static public void doAnalysis_Again(List<Elem> fileSetInfo, string[] files)
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
Parser parser = builder.build();
Repository rep = Repository.getInstance();
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)
{
continue;
}
List<string> filename = new List<string>();
filename.Add("");
fileDependencyTable.Add(file, filename);
foreach (Elem e in table) // analysis each element's dependency if it is a class or struct or interface
{
if (e.type == "class" || e.type == "struct" || e.type == "interface")
dependencyAnalyzer.dependencyAnalysis(e, file, fileSetInfo);
foreach (Elem ee in fileSetInfo)
{
if (e.dependency.Contains(ee.name) && !fileDependencyTable[file].Contains(ee.filename) && ee.filename != file)
{
fileDependencyTable[file].Add(ee.filename);
}
}
}
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>();
}
displayAnalysis(rep);
analysisSummary(rep);
}
示例13: 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();
}
}
示例14: analyzePartII
/// <summary>
/// Starts the part 2 of analysis to find out the package and relationship dependency
/// </summary>
public void analyzePartII()
{
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.displayNewLines = false;
foreach (object file in files)
{
if (!semi.open(file as string))
{
Console.Write("\n Can't open {0}\n\n", file);
return;
}
BuildCodeAnalyzerRelationships builderreln = new BuildCodeAnalyzerRelationships(semi);
CodeAnalysis.Parser parser = builderreln.build();
try
{
while (semi.getSemi())
parser.parse(semi);
}
catch (Exception ex)
{
Console.Write("\n\n {0}\n", ex.Message);
}
semi.close();
}
}
示例15: secondAnalysis
// function that parse each file, detect class relationship, function size and complexity
static void secondAnalysis(string[] files, List<Elem> fileSetInfo, List<Elem> summaryTAB, bool relation, bool xml)
{
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();
List<Elem> table = rep.locations;
ComplexityAnalyzer comxAna = new ComplexityAnalyzer();
foreach (Elem e in table) // analysis each element's complexity if it is a function
{
if (e.type == "function")
e.complexity = comxAna.complexityAnalysis(e, file, fileSetInfo);
}
summaryTAB.AddRange(table);
RelationshipAnalyzer relshAna = new RelationshipAnalyzer();
foreach (Elem e in table) // analysis each element's relationship if it is a class or struct or interface
{
if (e.type == "class" || e.type == "struct" || e.type == "interface")
relshAna.relationshipanalysis(e, file, fileSetInfo);
}
display(table, file, relation, xml);
semi.close();
}// all the files in file set had been parsed
summary(summaryTAB, relation);
}