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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,21 +1,20 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt"/> // <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/> // <license see="prj:///doc/license.txt"/>
// <owner name="none" email=""/> // <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Collections; using System.Collections.Generic;
namespace ICSharpCode.NRefactory.Parser.AST namespace ICSharpCode.NRefactory.Parser.AST
{ {
public class ReDimStatement : Statement public class ReDimStatement : Statement
{ {
// List<Expression> reDimClauses = new List<Expression>(1); List<InvocationExpression> reDimClauses = new List<InvocationExpression>(1);
ArrayList reDimClauses = new ArrayList(1); bool isPreserve = false;
bool isPreserve = false;
public bool IsPreserve { public bool IsPreserve {
get { get {
@ -25,7 +24,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
isPreserve = value; isPreserve = value;
} }
} }
public ArrayList ReDimClauses { public List<InvocationExpression> ReDimClauses {
get { get {
return reDimClauses; 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>
| /* 10.10.2.1 */ | /* 10.10.2.1 */
"Error" Expr<out expr> (. statement = new ErrorStatement(expr); .) "Error" Expr<out expr> (. statement = new ErrorStatement(expr); .)
| /* 10.12.1 */ | /* 10.12.1 */
"ReDim" (. Expression redimclause = null; bool isPreserve = false; .) [ "Preserve" (. isPreserve = true; .) ] "ReDim" (. bool isPreserve = false; .) [ "Preserve" (. isPreserve = true; .) ]
Expr<out redimclause> Expr<out expr>
(. (.
ReDimStatement reDimStatement = new ReDimStatement(isPreserve); ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
statement = reDimStatement; 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 */ | /* 10.12.2 */
"Erase" "Erase"
Expr<out expr> Expr<out expr>

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

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

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

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

1
src/Tools/BuildAddinDocumentation/MainClass.cs

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

Loading…
Cancel
Save