本文整理汇总了C#中ICSharpCode.SharpDevelop.Dom.ParseInformation类的典型用法代码示例。如果您正苦于以下问题:C# ParseInformation类的具体用法?C# ParseInformation怎么用?C# ParseInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParseInformation类属于ICSharpCode.SharpDevelop.Dom命名空间,在下文中一共展示了ParseInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateFoldings
public void UpdateFoldings(ParseInformation parseInfo)
{
IEnumerable<NewFolding> newFoldings = GetNewFoldings(parseInfo);
foldingManager.UpdateFoldings(newFoldings, -1);
isFirstUpdate = false;
}
示例2: SetUpFixture
public void SetUpFixture()
{
string python = "class Test:\r\n" +
"\tdef foo(self):\r\n" +
"\t\tpass";
DefaultProjectContent projectContent = new DefaultProjectContent();
PythonParser parser = new PythonParser();
compilationUnit = parser.Parse(projectContent, @"C:\test.py", python);
if (compilationUnit.Classes.Count > 0) {
c = compilationUnit.Classes[0];
if (c.Methods.Count > 0) {
method = c.Methods[0];
}
TextArea textArea = new TextArea();
document = new TextDocument();
textArea.Document = document;
textArea.Document.Text = python;
ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea);
ParseInformation parseInfo = new ParseInformation(compilationUnit);
foldingStrategy.UpdateFoldings(parseInfo);
List<FoldingSection> folds = new List<FoldingSection>(foldingStrategy.FoldingManager.AllFoldings);
if (folds.Count > 0) {
classFold = folds[0];
}
if (folds.Count > 1) {
methodFold = folds[1];
}
}
}
示例3: SetUpFixture
public void SetUpFixture()
{
string ruby = "class Test\r\n" +
"\tdef initialize\r\n" +
"\t\tputs 'test'\r\n" +
"\tend\r\n" +
"end";
DefaultProjectContent projectContent = new DefaultProjectContent();
RubyParser parser = new RubyParser();
compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby);
if (compilationUnit.Classes.Count > 0) {
c = compilationUnit.Classes[0];
if (c.Methods.Count > 0) {
method = c.Methods[0];
}
TextArea textArea = new TextArea();
document = new TextDocument();
textArea.Document = document;
textArea.Document.Text = ruby;
// Get folds.
ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea);
ParseInformation parseInfo = new ParseInformation(compilationUnit);
foldingStrategy.UpdateFoldings(parseInfo);
List<FoldingSection> folds = new List<FoldingSection>(foldingStrategy.FoldingManager.AllFoldings);
if (folds.Count > 1) {
classFold = folds[0];
methodFold = folds[1];
}
}
}
示例4: FindFormClassParts
public static IList<IClass> FindFormClassParts(ParseInformation parseInfo, out IClass formClass, out bool isFirstClassInFile)
{
#if DEBUG
if ((Control.ModifierKeys & (Keys.Alt | Keys.Control)) == (Keys.Alt | Keys.Control)) {
System.Diagnostics.Debugger.Break();
}
#endif
formClass = null;
isFirstClassInFile = true;
foreach (IClass c in parseInfo.CompilationUnit.Classes) {
if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) {
formClass = c;
break;
}
isFirstClassInFile = false;
}
if (formClass == null)
throw new FormsDesignerLoadException("No class derived from Form or UserControl was found.");
// Initialize designer for formClass
formClass = formClass.GetCompoundClass();
if (formClass is CompoundClass) {
return (formClass as CompoundClass).Parts;
} else {
return new IClass[] { formClass };
}
}
示例5: GetCompilationUnit
ICompilationUnit GetCompilationUnit(ParseInformation parseInfo)
{
if (parseInfo != null) {
return parseInfo.CompilationUnit;
}
return null;
}
示例6: SetUpFixture
public void SetUpFixture()
{
RubyMSBuildEngineHelper.InitMSBuildEngine();
List<ProjectBindingDescriptor> bindings = new List<ProjectBindingDescriptor>();
using (TextReader reader = RubyBindingAddInFile.ReadAddInFile()) {
AddIn addin = AddIn.Load(reader, String.Empty);
bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Ruby")));
}
ProjectBindingService.SetBindings(bindings);
convertProjectCommand = new DerivedConvertProjectToRubyProjectCommand();
parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent()));
convertProjectCommand.ParseInfo = parseInfo;
convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode;
sourceProject = new MockProject();
sourceProject.Directory = @"d:\projects\test";
source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs");
targetProject = (RubyProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject);
target = new FileProjectItem(targetProject, source.ItemType, source.Include);
source.CopyMetadataTo(target);
textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt");
textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include);
textFileSource.CopyMetadataTo(textFileTarget);
convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode);
convertProjectCommand.CallConvertFile(source, target);
convertProjectCommand.CallConvertFile(textFileSource, textFileTarget);
}
示例7: Initialize
bool Initialize(ParseInformation parseInfo, int caretLine, int caretColumn)
{
if (parseInfo == null) {
return false;
}
this.cu = parseInfo.CompilationUnit;
if (cu == null) {
return false;
}
this.pc = cu.ProjectContent;
this.caretLine = caretLine;
this.caretColumn = caretColumn;
this.callingClass = GetCallingClass(pc);
callingMember = ResolveCurrentMember(callingClass);
if (callingMember == null) {
if (cu != parseInfo.CompilationUnit) {
IClass olderClass = GetCallingClass(parseInfo.CompilationUnit.ProjectContent);
if (olderClass != null && callingClass == null) {
this.callingClass = olderClass;
}
callingMember = ResolveCurrentMember(olderClass);
}
}
if (callingMember != null) {
if (caretLine > callingMember.BodyRegion.EndLine) {
this.caretLine = callingMember.BodyRegion.EndLine;
this.caretColumn = callingMember.BodyRegion.EndColumn - 1;
} else if (caretLine == callingMember.BodyRegion.EndLine && caretColumn >= callingMember.BodyRegion.EndColumn) {
this.caretColumn = callingMember.BodyRegion.EndColumn - 1;
}
}
return true;
}
示例8: CreateParseInformationWithWebViewPageClass
ParseInformation CreateParseInformationWithWebViewPageClass(ParseInformation parseInfo)
{
RazorCompilationUnit compilationUnit = RazorCompilationUnit.CreateFromParseInfo(parseInfo);
AddDefaultUsings(compilationUnit);
AddWebViewPageClass(compilationUnit);
return new ParseInformation(compilationUnit);
}
示例9: Resolve
public ResolveResult Resolve(ExpressionResult expressionResult, ParseInformation parseInfo, string fileContent)
{
if (parseInfo == null || (string.IsNullOrEmpty(fileContent) && !(expressionResult.Context is XamlContext)))
return null;
this.resolveExpression = expressionResult.Expression;
this.caretLine = expressionResult.Region.BeginLine;
this.caretColumn = expressionResult.Region.BeginColumn;
this.callingClass = parseInfo.CompilationUnit.GetInnermostClass(caretLine, caretColumn);
this.context = expressionResult.Context as XamlContext ?? CompletionDataHelper.ResolveContext(fileContent, parseInfo.CompilationUnit.FileName, Utils.GetOffsetFromFilePos(fileContent, caretLine, caretColumn));
switch (this.context.Description) {
case XamlContextDescription.AtTag:
case XamlContextDescription.None:
return ResolveElementName(resolveExpression);
case XamlContextDescription.InTag:
return ResolveAttribute(resolveExpression) ?? ResolveElementName(resolveExpression);
case XamlContextDescription.InAttributeValue:
MemberResolveResult mrr = ResolveAttribute(context.Attribute.Name);
if (mrr != null) {
var rr = ResolveAttributeValue(mrr.ResolvedMember, resolveExpression) ?? mrr;
return rr;
}
break;
case XamlContextDescription.InMarkupExtension:
return ResolveMarkupExtension(resolveExpression);
}
return null;
}
示例10: ClassFinder
public ClassFinder(ParseInformation parseInfo, int caretLineNumber, int caretColumn)
{
this.caretLine = caretLineNumber;
this.caretColumn = caretColumn;
Init(parseInfo);
}
示例11: ParserUpdateStepEventArgs
public ParserUpdateStepEventArgs(string fileName, string content, bool updated, ParseInformation parseInformation)
{
this.fileName = fileName;
this.content = content;
this.updated = updated;
this.parseInformation = parseInformation;
}
示例12: Register
public static void Register(MainForm mainForm)
{
// Must be implemented. Gets the parse information for the specified file.
HostCallback.GetParseInformation = delegate(string fileName) {
if (fileName != MainForm.DummyFileName)
throw new Exception("Unknown file");
if (mainForm.lastCompilationUnit == null)
return null;
ParseInformation pi = new ParseInformation();
pi.ValidCompilationUnit = mainForm.lastCompilationUnit;
return pi;
};
// Must be implemented. Gets the project content of the active project.
HostCallback.GetCurrentProjectContent = delegate {
return mainForm.myProjectContent;
};
// The default implementation just logs to Log4Net. We want to display a MessageBox.
// Note that we use += here - in this case, we want to keep the default Log4Net implementation.
HostCallback.ShowError += delegate(string message, Exception ex) {
MessageBox.Show(message + Environment.NewLine + ex.ToString());
};
HostCallback.ShowMessage += delegate(string message) {
MessageBox.Show(message);
};
HostCallback.ShowAssemblyLoadError += delegate(string fileName, string include, string message) {
MessageBox.Show("Error loading code-completion information for "
+ include + " from " + fileName
+ ":\r\n" + message + "\r\n");
};
}
示例13: Init
public void Init()
{
projectContent = new MockProjectContent();
ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(projectContent));
completion = new PythonImportCompletion(projectContent);
completionItems = completion.GetCompletionItemsFromModule("sys");
}
示例14: Init
public void Init()
{
projectContent = new MockProjectContent();
ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(projectContent));
PythonImportCompletion completion = new PythonImportCompletion(projectContent);
completionItems = completion.GetCompletionItems(String.Empty);
}
示例15: PythonResolverContext
public PythonResolverContext(ParseInformation parseInfo, ExpressionResult expressionResult, string fileContent)
{
this.fileContent = fileContent;
this.expressionResult = expressionResult;
GetCompilationUnit(parseInfo);
GetProjectContent();
GetCallingMember();
}