Browse Source

Fixed parser crash on incomplete ReDimStatement.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@938 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
66a4289544
  1. 1
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 3
      src/AddIns/Misc/AddInManager/Project/AddInManager.addin
  3. 2
      src/AddIns/Misc/AddInManager/Project/Src/AddInInstallBinding.cs
  4. 20
      src/AddIns/Misc/AddInManager/Project/Src/Commands.cs
  5. 17
      src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs
  6. 6
      src/AddIns/Misc/AddinScout/Project/AddInScout.addin
  7. 4
      src/AddIns/Misc/PInvokeAddIn/Project/PInvoke.addin
  8. 3
      src/AddIns/Misc/RegExpTk/Project/RegExpTk.addin
  9. 11
      src/Libraries/NRefactory/Project/Src/Parser/AST/VBNet/Statements/ReDimStatement.cs
  10. 422
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  11. 12
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  12. 2
      src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs
  13. 1
      src/Main/Core/Project/Src/AddInTree/CoreStartup.cs
  14. 1
      src/Tools/BuildAddinDocumentation/MainClass.cs

1
AddIns/ICSharpCode.SharpDevelop.addin

@ -1310,6 +1310,7 @@ @@ -1310,6 +1310,7 @@
<MenuItem id = "Tools" label = "${res:XML.MainMenu.ToolMenu}" type="Menu">
<MenuItem id = "ToolBuilder" type="Builder" class = "ICSharpCode.SharpDevelop.Commands.ToolMenuBuilder" />
<MenuItem id = "Separator1" type = "Separator" />
<Include id = "ToolList" path = "/Workspace/Tools" />
<MenuItem id = "Separator2" type = "Separator" />
<ComplexCondition action = "Disable">

3
src/AddIns/Misc/AddInManager/Project/AddInManager.addin

@ -13,9 +13,8 @@ @@ -13,9 +13,8 @@
</Import>
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<Path name = "/Workspace/Tools">
<MenuItem id = "ShowAddInManager"
insertafter = "Separator1" insertbefore = "Separator2"
label = "${res:AddInManager.Title}"
class = "ICSharpCode.AddInManager.ShowCommand"/>
</Path>

2
src/AddIns/Misc/AddInManager/Project/Src/AddInInstallBinding.cs

@ -10,6 +10,7 @@ using ICSharpCode.Core; @@ -10,6 +10,7 @@ using ICSharpCode.Core;
namespace ICSharpCode.AddInManager
{
#if !STANDALONE
public class AddInInstallBinding : IDisplayBinding
{
public bool CanCreateContentForFile(string fileName)
@ -34,4 +35,5 @@ namespace ICSharpCode.AddInManager @@ -34,4 +35,5 @@ namespace ICSharpCode.AddInManager
throw new NotImplementedException();
}
}
#endif
}

20
src/AddIns/Misc/AddInManager/Project/Src/Commands.cs

@ -15,8 +15,18 @@ namespace ICSharpCode.AddInManager @@ -15,8 +15,18 @@ namespace ICSharpCode.AddInManager
{
public class ShowCommand : AbstractMenuCommand
{
#if STANDALONE
static bool resourcesRegistered;
#endif
public override void Run()
{
#if STANDALONE
if (!resourcesRegistered) {
resourcesRegistered = true;
ResourceService.RegisterStrings("ICSharpCode.AddInManager.StringResources", typeof(ShowCommand).Assembly);
}
#endif
ManagerForm.ShowForm();
}
}
@ -85,7 +95,13 @@ namespace ICSharpCode.AddInManager @@ -85,7 +95,13 @@ namespace ICSharpCode.AddInManager
public override void Run()
{
#if STANDALONE
try {
System.Diagnostics.Process.Start(((AddInControl)Owner).AddIn.Properties["url"]);
} catch {}
#else
FileService.OpenFile(((AddInControl)Owner).AddIn.Properties["url"]);
#endif
ManagerForm.Instance.Close();
}
}
@ -104,6 +120,7 @@ namespace ICSharpCode.AddInManager @@ -104,6 +120,7 @@ namespace ICSharpCode.AddInManager
{
public override bool IsEnabled {
get {
#if !STANDALONE
AddIn addIn = ((AddInControl)Owner).AddIn;
if (addIn.Enabled) {
foreach (KeyValuePair<string, ExtensionPath> pair in addIn.Paths) {
@ -112,12 +129,14 @@ namespace ICSharpCode.AddInManager @@ -112,12 +129,14 @@ namespace ICSharpCode.AddInManager
}
}
}
#endif
return false;
}
}
public override void Run()
{
#if !STANDALONE
AddIn addIn = ((AddInControl)Owner).AddIn;
AddInTreeNode dummyNode = new AddInTreeNode();
foreach (KeyValuePair<string, ExtensionPath> pair in addIn.Paths) {
@ -127,6 +146,7 @@ namespace ICSharpCode.AddInManager @@ -127,6 +146,7 @@ namespace ICSharpCode.AddInManager
}
ICSharpCode.SharpDevelop.Commands.OptionsCommand.ShowTabbedOptions(addIn.Name + " " + ResourceService.GetString("AddInManager.Options"),
dummyNode);
#endif
}
}
}

17
src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs

@ -50,7 +50,12 @@ namespace ICSharpCode.AddInManager @@ -50,7 +50,12 @@ namespace ICSharpCode.AddInManager
ICSharpCode.SharpDevelop.Gui.FormLocationHelper.Apply(this, "AddInManager.WindowBounds", true);
#endif
#if STANDALONE
actionFlowLayoutPanel.BackgroundImage = new Bitmap(typeof(ManagerForm).Assembly.GetManifestResourceStream("ICSharpCode.AddInManager.WizardBackground.png"));
#else
actionFlowLayoutPanel.BackgroundImage = ResourceService.GetBitmap("GeneralWizardBackground");
#endif
installButton.Text = ResourceService.GetString("AddInManager.InstallButton");
uninstallButton.Text = ResourceService.GetString("AddInManager.ActionUninstall");
closeButton.Text = ResourceService.GetString("Global.CloseButtonText");
@ -82,7 +87,7 @@ namespace ICSharpCode.AddInManager @@ -82,7 +87,7 @@ namespace ICSharpCode.AddInManager
});
foreach (AddIn addIn in addInList) {
string identity = addIn.Manifest.PrimaryIdentity;
if (identity == null || identity == "SharpDevelop") // || identity == "ICSharpCode.AddInManager"
if (identity == null || addIn.Properties["addInManagerHidden"] == "true")
continue;
addInControl = new AddInControl(addIn);
addInControl.Dock = DockStyle.Top;
@ -95,6 +100,10 @@ namespace ICSharpCode.AddInManager @@ -95,6 +100,10 @@ namespace ICSharpCode.AddInManager
splitContainer.Panel1.Controls.Add(stack.Pop());
}
ShowPreinstalledAddInsCheckBoxCheckedChanged(null, null);
#if SHOWALLADDINS
showPreinstalledAddInsCheckBox.Visible = false;
showPreinstalledAddInsCheckBox.Checked = true;
#endif
splitContainer.Panel2Collapsed = true;
}
@ -623,6 +632,12 @@ namespace ICSharpCode.AddInManager @@ -623,6 +632,12 @@ namespace ICSharpCode.AddInManager
{
switch (selectedAction) {
case AddInAction.Disable:
for (int i = 0; i < selected.Count; i++) {
if (selected[i].Manifest.PrimaryIdentity == "ICSharpCode.AddInManager") {
MessageService.ShowMessage("You cannot disable the AddInManager because you need it to re-enable AddIns!");
selected.RemoveAt(i--);
}
}
ICSharpCode.Core.AddInManager.Disable(selected);
break;
case AddInAction.Enable:

6
src/AddIns/Misc/AddinScout/Project/AddInScout.addin

@ -12,13 +12,9 @@ @@ -12,13 +12,9 @@
<Import assembly="AddInScout.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<Path name = "/Workspace/Tools">
<MenuItem id = "ShowAddInScout"
insertafter = "Separator1" insertbefore = "Separator2"
label = "AddIn Scout"
class = "AddInScout.AddInScoutCommand"/>
</Path>
</AddIn>

4
src/AddIns/Misc/PInvokeAddIn/Project/PInvoke.addin

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
<Manifest>
<Identity name = "ICSharpCode.PInvokeAddIn"/>
<Dependency addin = "SharpDevelop"/>
</Manifest>
<Runtime>
@ -12,14 +13,13 @@ @@ -12,14 +13,13 @@
</Runtime>
<!-- Menu options -->
<Path name="/SharpDevelop/Workbench/MainMenu/Tools">
<Path name="/Workspace/Tools">
<ComplexCondition action = "Disable">
<Or>
<Condition name = "ActiveContentExtension" activeextension = ".vb"/>
<Condition name = "ActiveContentExtension" activeextension = ".cs"/>
</Or>
<MenuItem id = "InsertPInvoke"
insertafter = "Separator1" insertbefore = "Separator2"
label = "${res:ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesMenuLabel}"
description = "Insert PInvoke signatures."
class = "ICSharpCode.PInvokeAddIn.InsertPInvokeSignaturesCommand"

3
src/AddIns/Misc/RegExpTk/Project/RegExpTk.addin

@ -11,9 +11,8 @@ @@ -11,9 +11,8 @@
<Import assembly="RegExpTk.dll" />
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<Path name = "/Workspace/Tools">
<MenuItem id = "RegExpTk"
insertafter = "Separator1" insertbefore = "Separator2"
label = "${res:XML.MainMenu.ToolsMenu.RegularExpressionToolkit}"
class = "Plugins.RegExpTk.RegExpTkCommand"
/>

11
src/Libraries/NRefactory/Project/Src/Parser/AST/VBNet/Statements/ReDimStatement.cs

@ -1,21 +1,20 @@ @@ -1,21 +1,20 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="none" email=""/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.Parser.AST
{
public class ReDimStatement : Statement
{
// List<Expression> reDimClauses = new List<Expression>(1);
ArrayList reDimClauses = new ArrayList(1);
bool isPreserve = false;
List<InvocationExpression> reDimClauses = new List<InvocationExpression>(1);
bool isPreserve = false;
public bool IsPreserve {
get {
@ -25,7 +24,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -25,7 +24,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
isPreserve = value;
}
}
public ArrayList ReDimClauses {
public List<InvocationExpression> ReDimClauses {
get {
return reDimClauses;
}

422
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

12
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -2512,14 +2512,18 @@ EmbeddedStatement<out Statement statement> @@ -2512,14 +2512,18 @@ EmbeddedStatement<out Statement statement>
| /* 10.10.2.1 */
"Error" Expr<out expr> (. statement = new ErrorStatement(expr); .)
| /* 10.12.1 */
"ReDim" (. Expression redimclause = null; bool isPreserve = false; .) [ "Preserve" (. isPreserve = true; .) ]
Expr<out redimclause>
"ReDim" (. bool isPreserve = false; .) [ "Preserve" (. isPreserve = true; .) ]
Expr<out expr>
(.
ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
statement = reDimStatement;
reDimStatement.ReDimClauses.Add(redimclause as InvocationExpression);
InvocationExpression redimClause = expr as InvocationExpression;
if (redimClause != null) { reDimStatement.ReDimClauses.Add(redimClause); }
.)
{ "," Expr<out redimclause> (. reDimStatement.ReDimClauses.Add(redimclause as InvocationExpression); .) }
{ "," Expr<out expr>
(. redimClause = expr as InvocationExpression; .)
(. if (redimClause != null) { reDimStatement.ReDimClauses.Add(redimClause); } .)
}
| /* 10.12.2 */
"Erase"
Expr<out expr>

2
src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs

@ -275,7 +275,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -275,7 +275,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
File.Delete(userFile);
}
Conversion conversion = new Conversion();
if (Path.GetExtension(fileName).ToLower() == ".vbproj")
if (Path.GetExtension(fileName).ToLowerInvariant() == ".vbproj")
conversion.IsVisualBasic = true;
Solution.ReadSolutionInformation(Solution.SolutionBeingLoaded.FileName, conversion);
RunConverter(old, fileName, "vsnet2msbuild.xsl", conversion);

1
src/Main/Core/Project/Src/AddInTree/CoreStartup.cs

@ -119,6 +119,7 @@ namespace ICSharpCode.Core @@ -119,6 +119,7 @@ namespace ICSharpCode.Core
propertiesName);
PropertyService.Load();
ResourceService.InitializeService(FileUtility.Combine(PropertyService.DataDirectory, "resources"));
StringParser.Properties["AppName"] = applicationName;
}
}
}

1
src/Tools/BuildAddinDocumentation/MainClass.cs

@ -164,6 +164,7 @@ namespace BuildAddinDocumentation @@ -164,6 +164,7 @@ namespace BuildAddinDocumentation
foreach (string child in doozer["children"].GetAttribute("childTypes").Split(';')) {
CreateChild(choice, "element").SetAttribute("ref", child);
}
CreateChild(choice, "element").SetAttribute("ref", "Include");
}
foreach (XmlElement doozerChild in doozer) {
if (doozerChild.Name != "attribute")

Loading…
Cancel
Save