Browse Source

- fixed missing instructions in EF Parser

- fixed handling of Enum - End Enum

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6352 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 16 years ago
parent
commit
4309c65a17
  1. 2
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/CompletionDataHelper.cs
  2. 3
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs
  3. 9
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/TextEditorOptions.xaml
  4. 2
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs
  5. 4
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj
  6. 45
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/ExpressionFinder.atg
  7. 6082
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Parser.cs

2
src/AddIns/BackendBindings/VBNetBinding/Project/Src/CompletionDataHelper.cs

@ -81,7 +81,7 @@ namespace ICSharpCode.VBNetBinding
CodeCompletionItemProvider.ConvertCompletionData(result, data, expressionResult.Context); CodeCompletionItemProvider.ConvertCompletionData(result, data, expressionResult.Context);
if (addedKeywords) if (addedKeywords && result.Items.Any())
AddTemplates(editor, result); AddTemplates(editor, result);
string word = editor.GetWordBeforeCaret().Trim(); string word = editor.GetWordBeforeCaret().Trim();

3
src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs

@ -44,7 +44,7 @@ namespace ICSharpCode.VBNetBinding
static List<int> blockTokens = new List<int>( static List<int> blockTokens = new List<int>(
new int[] { new int[] {
Tokens.Class, Tokens.Module, Tokens.Namespace, Tokens.Interface, Tokens.Structure, Tokens.Class, Tokens.Module, Tokens.Namespace, Tokens.Interface, Tokens.Structure,
Tokens.Sub, Tokens.Function, Tokens.Operator, Tokens.Sub, Tokens.Function, Tokens.Operator, Tokens.Enum,
Tokens.If, Tokens.For, Tokens.Do, Tokens.While, Tokens.With, Tokens.Select, Tokens.Try, Tokens.If, Tokens.For, Tokens.Do, Tokens.While, Tokens.With, Tokens.Select, Tokens.Try,
Tokens.Property, Tokens.Get, Tokens.Set Tokens.Property, Tokens.Get, Tokens.Set
}); });
@ -421,6 +421,7 @@ namespace ICSharpCode.VBNetBinding
return (type == Tokens.Class) || return (type == Tokens.Class) ||
(type == Tokens.Module) || (type == Tokens.Module) ||
(type == Tokens.Structure) || (type == Tokens.Structure) ||
(type == Tokens.Enum) ||
(type == Tokens.Interface); (type == Tokens.Interface);
} }

9
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/TextEditorOptions.xaml

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <gui:OptionPanel xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
<gui:OptionPanel xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" x:Class="ICSharpCode.VBNetBinding.OptionPanels.TextEditorOptions" xmlns:addin="clr-namespace:ICSharpCode.VBNetBinding.OptionPanels" xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
x:Class="ICSharpCode.VBNetBinding.OptionPanels.TextEditorOptions" xmlns:addin="clr-namespace:ICSharpCode.VBNetBinding.OptionPanels" xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel> <StackPanel>
<GroupBox <GroupBox
Header="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.FormattingGroupBox}" Header="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.FormattingGroupBox}"
HorizontalAlignment="Left"> HorizontalAlignment="Left">
<StackPanel> <widgets:StackPanelWithSpacing SpaceBetweenItems="5">
<CheckBox <CheckBox
Content="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.EnableEndConstructsCheckBox}" Content="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.EnableEndConstructsCheckBox}"
IsChecked="{sd:OptionBinding addin:TextEditorOptions.EnableEndConstructs}" IsChecked="{sd:OptionBinding addin:TextEditorOptions.EnableEndConstructs}"
@ -14,7 +13,7 @@
Content="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.EnableCasingCheckBox}" Content="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.EnableCasingCheckBox}"
IsChecked="{sd:OptionBinding addin:TextEditorOptions.EnableCasing}" IsChecked="{sd:OptionBinding addin:TextEditorOptions.EnableCasing}"
/> />
</StackPanel> </widgets:StackPanelWithSpacing>
</GroupBox> </GroupBox>
</StackPanel> </StackPanel>
</gui:OptionPanel> </gui:OptionPanel>

2
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs

@ -80,8 +80,8 @@ namespace ICSharpCode.VBNetBinding
insightHandler.HighlightParameter(insightWindow, GetArgumentIndex(editor) + 1); insightHandler.HighlightParameter(insightWindow, GetArgumentIndex(editor) + 1);
insightWindow.CaretPositionChanged += delegate { Run(insightWindow, editor); };; insightWindow.CaretPositionChanged += delegate { Run(insightWindow, editor); };;
} }
return CodeCompletionKeyPressResult.EatKey;
} }
return CodeCompletionKeyPressResult.EatKey;
} }
break; break;
case '\n': case '\n':

4
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj

@ -129,6 +129,10 @@
<Name>ICSharpCode.SharpDevelop.Dom</Name> <Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="Src\OptionPanels\TextEditorOptions.xaml" /> <Page Include="Src\OptionPanels\TextEditorOptions.xaml" />

45
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/ExpressionFinder.atg

@ -278,7 +278,7 @@ ImportsStatement =
"Imports" (. PushContext(Context.Importable, la, t); .) "Imports" (. PushContext(Context.Importable, la, t); .)
(. nextTokenIsStartOfImportsOrAccessExpression = true; .) (. nextTokenIsStartOfImportsOrAccessExpression = true; .)
( (
( "Global" | Identifier | PrimitiveTypeName ) { TypeSuffix } [ ( "." | "=" ) TypeName ] ( "Global" | Identifier | PrimitiveTypeName ) { TypeSuffix } [ ( "." | "=" ) (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ]
| XmlOpenTag Identifier "=" LiteralString XmlCloseTag | XmlOpenTag Identifier "=" LiteralString XmlCloseTag
) )
(. PopContext(); .) (. PopContext(); .)
@ -328,14 +328,24 @@ ClassOrModuleOrStructureTypeDeclaration =
. .
EnumTypeDeclaration = EnumTypeDeclaration =
"Enum" Identifier [ "As" TypeName ] StatementTerminator (. PushContext(Context.TypeDeclaration, la, t); .)
{ { AttributeBlock } Identifier [ "=" Expression ] StatementTerminator } "Enum" (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ] StatementTerminator
{
{ AttributeBlock }
(. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "=" Expression ]
StatementTerminator
}
"End" "Enum" StatementTerminator "End" "Enum" StatementTerminator
(. PopContext(); .)
. .
InterfaceDeclaration = InterfaceDeclaration =
"Interface" Identifier [ "(" "Of" GenericTypeParameterDeclaration ")" ] StatementTerminator (. PushContext(Context.TypeDeclaration, la, t); .)
[ (. PushContext(Context.Type, la, t); .) "Inherits" TypeName (. PopContext(); .) { "," (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) } StatementTerminator ] "Interface" (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "(" "Of" GenericTypeParameterDeclaration ")" ] StatementTerminator
[ "Inherits" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) { "," (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) } StatementTerminator ]
{ {
{ AttributeBlock } (.OnEachPossiblePath: isMissingModifier = true; .) { AttributeBlock } (.OnEachPossiblePath: isMissingModifier = true; .)
{ TypeOrMemberModifier (. isMissingModifier = false; .) } (. isMissingModifier = false; .) { TypeOrMemberModifier (. isMissingModifier = false; .) } (. isMissingModifier = false; .)
@ -343,7 +353,8 @@ InterfaceDeclaration =
| InterfaceDeclaration | InterfaceMemberDeclaration ) | InterfaceDeclaration | InterfaceMemberDeclaration )
} }
(. isMissingModifier = false; .) (. isMissingModifier = false; .)
"End" "Interface" StatementTerminator "End" "Interface" StatementTerminator
(. PopContext(); .)
. .
InterfaceMemberDeclaration = InterfaceMemberDeclaration =
@ -355,11 +366,15 @@ TypeOrMemberModifier =
. .
InterfaceEvent = InterfaceEvent =
"Event" Identifier [ "As" TypeName | "(" [ ParameterList ] ")" ] StatementTerminator "Event" (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) | "(" [ ParameterList ] ")" ]
StatementTerminator
. .
InterfaceProperty = InterfaceProperty =
"Property" Identifier [ "(" [ ParameterList ] ")" ] [ "As" { AttributeBlock } TypeName ] StatementTerminator "Property" (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "(" [ ParameterList ] ")" ] [ "As" (. PushContext(Context.Type, la, t); .) { AttributeBlock } TypeName (. PopContext(); .) ]
StatementTerminator
. .
InterfaceSubOrFunction = InterfaceSubOrFunction =
@ -386,7 +401,7 @@ GenericTypeParameterDeclaration =
DelegateTypeDeclaration = DelegateTypeDeclaration =
"Delegate" ("Sub" | "Function") "Delegate" ("Sub" | "Function")
(. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) ANY (. PopContext(); .) (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) ANY (. PopContext(); .)
[ "(" [ ParameterList ] ")" ] [ "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ] StatementTerminator { "(" [ "Of" GenericTypeParameterDeclaration | ParameterList ] ")" } [ "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ] StatementTerminator
. .
MemberDeclaration = MemberDeclaration =
@ -419,7 +434,7 @@ ExternalMemberDeclaration =
EventMemberDeclaration = EventMemberDeclaration =
"Event" (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .) ( "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) | [ "(" [ ParameterList ] ")" ] ) "Event" (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .) ( "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) | [ "(" [ ParameterList ] ")" ] )
[ "Implements" TypeName /*"." IdentifierOrKeyword*/ { "," TypeName /*"." IdentifierOrKeyword*/ } ] [ "Implements" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) /*"." IdentifierOrKeyword*/ { "," (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) /*"." IdentifierOrKeyword*/ } ]
/* the TypeName production already allows the "." IdentifierOrKeyword syntax, so to avoid an ambiguous grammer we just leave that out */ /* the TypeName production already allows the "." IdentifierOrKeyword syntax, so to avoid an ambiguous grammer we just leave that out */
StatementTerminator StatementTerminator
. .
@ -439,7 +454,7 @@ PropertyDeclaration =
(. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .) (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "(" [ ParameterList ] ")" ] [ "(" [ ParameterList ] ")" ]
[ "As" { AttributeBlock } ( NewExpression | (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ) ] [ "As" { AttributeBlock } ( NewExpression | (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ) ]
[ "Implements" TypeName /*"." IdentifierOrKeyword*/ { "," TypeName /*"." IdentifierOrKeyword*/ } ] [ "Implements" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) /*"." IdentifierOrKeyword*/ { "," (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) /*"." IdentifierOrKeyword*/ } ]
[ "=" Expression ] StatementTerminator [ "=" Expression ] StatementTerminator
(. PopContext(); .) { EXPECTEDCONFLICT("<") AttributeBlock } (. PopContext(); .) { EXPECTEDCONFLICT("<") AttributeBlock }
{ EXPECTEDCONFLICT("Public", "Protected", "Private", "Friend") AccessModifier { EXPECTEDCONFLICT("Public", "Protected", "Private", "Friend") AccessModifier
@ -470,7 +485,7 @@ MemberVariableOrConstantDeclaration =
MemberVariableOrConstantDeclarator = MemberVariableOrConstantDeclarator =
[ "Const" ] [ "Const" ]
(. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) IdentifierForFieldDeclaration (. PopContext(); .) (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) IdentifierForFieldDeclaration (. PopContext(); .)
[ "As" (. PushContext(Context.Type, la, t); .) ( NewExpression | TypeName ) (. PopContext(); .) ] [ "As" (. PushContext(Context.Type, la, t); .) ( NewExpression | (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ) (. PopContext(); .) ]
[ "=" Expression ] [ "=" Expression ]
. .
@ -800,7 +815,7 @@ PrimitiveTypeName =
TypeName = ( "Global" | Identifier | PrimitiveTypeName | "?" /* used for ? = completion */ ) { TypeSuffix } { "." IdentifierOrKeyword { TypeSuffix } } . TypeName = ( "Global" | Identifier | PrimitiveTypeName | "?" /* used for ? = completion */ ) { TypeSuffix } { "." IdentifierOrKeyword { TypeSuffix } } .
TypeSuffix = "(" ( "Of" [ TypeName ] { "," [ TypeName ] } | [ ArgumentList ] ) ")" . TypeSuffix = "(" ( "Of" [ (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ] { "," [ (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ] } | [ ArgumentList ] ) ")" .
IdentifierOrKeyword = ident IdentifierOrKeyword = ident
| "AddHandler" | "AddHandler"
@ -1141,7 +1156,9 @@ TryStatement =
StatementTerminatorAndBlock StatementTerminatorAndBlock
{ {
"Catch" "Catch"
[ (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .) [ "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ] ] [ (. PushContext(Context.Identifier, la, t); .) (.OnEachPossiblePath: SetIdentifierExpected(la); .) Identifier (. PopContext(); .)
[ "As" (. PushContext(Context.Type, la, t); .) TypeName (. PopContext(); .) ]
]
[ "When" Expression ] [ "When" Expression ]
StatementTerminatorAndBlock StatementTerminatorAndBlock
} }

6082
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save