Browse Source
- converted TextEditorOptions to WPF - added filter for snippets to VB .NET binding git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6342 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
11 changed files with 4287 additions and 72 deletions
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="CreatedObject0" /> |
||||
<DockPadding value="" /> |
||||
<ClientSize value="{Width=416, Height=248}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject2" /> |
||||
<TabIndex value="0" /> |
||||
<Location value="{X=8,Y=8}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<ClientSize value="{Width=400, Height=96}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.VB.FormattingGroupBox}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="enableEndConstructsCheckBox" /> |
||||
<Location value="{X=8,Y=24}" /> |
||||
<ClientSize value="{Width=384, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.VB.EnableEndConstructsCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="enableCasingCheckBox" /> |
||||
<Location value="{X=8,Y=56}" /> |
||||
<ClientSize value="{Width=384, Height=24}" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.TextEditor.VB.EnableCasingCheckBox}" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="1" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------- |
||||
Compiler Generator Coco/R, |
||||
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz |
||||
extended by M. Loeberbauer & A. Woess, Univ. of Linz |
||||
with improvements by Pat Terry, Rhodes University |
||||
|
||||
This program is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License as published by the |
||||
Free Software Foundation; either version 2, or (at your option) any |
||||
later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, but |
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
||||
for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License along |
||||
with this program; if not, write to the Free Software Foundation, Inc., |
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
||||
As an exception, it is allowed to write an extension of Coco/R that is |
||||
used as a plugin in non-free software. |
||||
|
||||
If not otherwise stated, any source code generated by Coco/R (other than |
||||
Coco/R itself) does not fall under the GNU General Public License. |
||||
----------------------------------------------------------------------*/ |
||||
-->begin |
||||
-->namespace |
||||
|
||||
partial class VBIndentationStrategy { |
||||
-->constants |
||||
const bool T = true; |
||||
const bool x = false; |
||||
|
||||
-->declarations |
||||
readonly Stack<int> stateStack = new Stack<int>(); |
||||
List<Token> errors = new List<Token>(); |
||||
|
||||
VBIndentationStrategy() |
||||
{ |
||||
stateStack.Push(-1); // required so that we don't crash when leaving the root production |
||||
} |
||||
|
||||
void Expect(int expectedKind, Token la) |
||||
{ |
||||
if (la.Kind != expectedKind) { |
||||
Error(la); |
||||
Console.WriteLine("expected: " + expectedKind); |
||||
} |
||||
} |
||||
|
||||
void Error(Token la) |
||||
{ |
||||
Console.WriteLine("not expected: " + la); |
||||
errors.Add(la); |
||||
} |
||||
|
||||
Token t; |
||||
|
||||
public void InformToken(Token la) |
||||
{ |
||||
-->informToken |
||||
if (la != null) |
||||
t = la; |
||||
} |
||||
|
||||
public void Advance() |
||||
{ |
||||
//Console.WriteLine("Advance"); |
||||
InformToken(null); |
||||
} |
||||
|
||||
static readonly BitArray[] set = { |
||||
-->initialization |
||||
}; |
||||
|
||||
} // end Parser |
||||
|
||||
|
||||
$$$ |
||||
@ -0,0 +1,962 @@
@@ -0,0 +1,962 @@
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.NRefactory.Parser; |
||||
|
||||
PUSHCOMPILER VBIndentationStrategy |
||||
|
||||
$tokenKindFieldName=Kind |
||||
|
||||
/* START AUTOGENERATED TOKENS SECTION */ |
||||
TOKENS |
||||
/* ----- terminal classes ----- */ |
||||
/* EOF is 0 */ |
||||
EOL |
||||
ident |
||||
LiteralString |
||||
LiteralCharacter |
||||
LiteralInteger |
||||
LiteralDouble |
||||
LiteralSingle |
||||
LiteralDecimal |
||||
LiteralDate |
||||
XmlOpenTag |
||||
XmlCloseTag |
||||
XmlStartInlineVB |
||||
XmlEndInlineVB |
||||
XmlCloseTagEmptyElement |
||||
XmlOpenEndTag |
||||
XmlContent |
||||
XmlComment |
||||
XmlCData |
||||
XmlProcessingInstruction |
||||
|
||||
/* ----- special character ----- */ |
||||
"=" |
||||
":" |
||||
"," |
||||
"&" |
||||
"/" |
||||
"\\" |
||||
"." |
||||
"..." |
||||
".@" |
||||
"!" |
||||
"-" |
||||
"+" |
||||
"^" |
||||
"?" |
||||
"*" |
||||
"{" |
||||
"}" |
||||
"(" |
||||
")" |
||||
">" |
||||
"<" |
||||
"<>" |
||||
">=" |
||||
"<=" |
||||
"<<" |
||||
">>" |
||||
"+=" |
||||
"^=" |
||||
"-=" |
||||
"*=" |
||||
"/=" |
||||
"\\=" |
||||
"<<=" |
||||
">>=" |
||||
"&=" |
||||
":=" |
||||
|
||||
/* ----- keywords ----- */ |
||||
"AddHandler" |
||||
"AddressOf" |
||||
"Aggregate" |
||||
"Alias" |
||||
"And" |
||||
"AndAlso" |
||||
"Ansi" |
||||
"As" |
||||
"Ascending" |
||||
"Assembly" |
||||
"Auto" |
||||
"Binary" |
||||
"Boolean" |
||||
"ByRef" |
||||
"By" |
||||
"Byte" |
||||
"ByVal" |
||||
"Call" |
||||
"Case" |
||||
"Catch" |
||||
"CBool" |
||||
"CByte" |
||||
"CChar" |
||||
"CDate" |
||||
"CDbl" |
||||
"CDec" |
||||
"Char" |
||||
"CInt" |
||||
"Class" |
||||
"CLng" |
||||
"CObj" |
||||
"Compare" |
||||
"Const" |
||||
"Continue" |
||||
"CSByte" |
||||
"CShort" |
||||
"CSng" |
||||
"CStr" |
||||
"CType" |
||||
"CUInt" |
||||
"CULng" |
||||
"CUShort" |
||||
"Custom" |
||||
"Date" |
||||
"Decimal" |
||||
"Declare" |
||||
"Default" |
||||
"Delegate" |
||||
"Descending" |
||||
"Dim" |
||||
"DirectCast" |
||||
"Distinct" |
||||
"Do" |
||||
"Double" |
||||
"Each" |
||||
"Else" |
||||
"ElseIf" |
||||
"End" |
||||
"EndIf" |
||||
"Enum" |
||||
"Equals" |
||||
"Erase" |
||||
"Error" |
||||
"Event" |
||||
"Exit" |
||||
"Explicit" |
||||
"False" |
||||
"Finally" |
||||
"For" |
||||
"Friend" |
||||
"From" |
||||
"Function" |
||||
"Get" |
||||
"GetType" |
||||
"Global" |
||||
"GoSub" |
||||
"GoTo" |
||||
"Group" |
||||
"Handles" |
||||
"If" |
||||
"Implements" |
||||
"Imports" |
||||
"In" |
||||
"Infer" |
||||
"Inherits" |
||||
"Integer" |
||||
"Interface" |
||||
"Into" |
||||
"Is" |
||||
"IsNot" |
||||
"Join" |
||||
"Key" |
||||
"Let" |
||||
"Lib" |
||||
"Like" |
||||
"Long" |
||||
"Loop" |
||||
"Me" |
||||
"Mod" |
||||
"Module" |
||||
"MustInherit" |
||||
"MustOverride" |
||||
"MyBase" |
||||
"MyClass" |
||||
"Namespace" |
||||
"Narrowing" |
||||
"New" |
||||
"Next" |
||||
"Not" |
||||
"Nothing" |
||||
"NotInheritable" |
||||
"NotOverridable" |
||||
"Object" |
||||
"Of" |
||||
"Off" |
||||
"On" |
||||
"Operator" |
||||
"Option" |
||||
"Optional" |
||||
"Or" |
||||
"Order" |
||||
"OrElse" |
||||
"Out" |
||||
"Overloads" |
||||
"Overridable" |
||||
"Overrides" |
||||
"ParamArray" |
||||
"Partial" |
||||
"Preserve" |
||||
"Private" |
||||
"Property" |
||||
"Protected" |
||||
"Public" |
||||
"RaiseEvent" |
||||
"ReadOnly" |
||||
"ReDim" |
||||
"Rem" |
||||
"RemoveHandler" |
||||
"Resume" |
||||
"Return" |
||||
"SByte" |
||||
"Select" |
||||
"Set" |
||||
"Shadows" |
||||
"Shared" |
||||
"Short" |
||||
"Single" |
||||
"Skip" |
||||
"Static" |
||||
"Step" |
||||
"Stop" |
||||
"Strict" |
||||
"String" |
||||
"Structure" |
||||
"Sub" |
||||
"SyncLock" |
||||
"Take" |
||||
"Text" |
||||
"Then" |
||||
"Throw" |
||||
"To" |
||||
"True" |
||||
"Try" |
||||
"TryCast" |
||||
"TypeOf" |
||||
"UInteger" |
||||
"ULong" |
||||
"Unicode" |
||||
"Until" |
||||
"UShort" |
||||
"Using" |
||||
"Variant" |
||||
"Wend" |
||||
"When" |
||||
"Where" |
||||
"While" |
||||
"Widening" |
||||
"With" |
||||
"WithEvents" |
||||
"WriteOnly" |
||||
"Xor" |
||||
"GetXmlNamespace" |
||||
/* END AUTOGENERATED TOKENS SECTION */ |
||||
|
||||
PRODUCTIONS |
||||
/*------------------------------------------------------------------------*/ |
||||
VBIndentationStrategy = |
||||
{ ANY } |
||||
{ NamespaceMemberDeclaration { ANY } } |
||||
. |
||||
|
||||
StatementTerminator = |
||||
EOL | ":" |
||||
. |
||||
|
||||
NamespaceMemberDeclaration = |
||||
NamespaceDeclaration |
||||
| TypeDeclaration |
||||
. |
||||
|
||||
NamespaceDeclaration = |
||||
"Namespace" { ANY } StatementTerminator |
||||
(. Indent(la); .) |
||||
{ NamespaceMemberDeclaration { ANY } } |
||||
(. Unindent(la); .) |
||||
"End" "Namespace" StatementTerminator |
||||
. |
||||
|
||||
TypeDeclaration = |
||||
ClassOrModuleOrStructureTypeDeclaration | |
||||
DelegateTypeDeclaration | |
||||
EnumTypeDeclaration | |
||||
InterfaceDeclaration |
||||
. |
||||
|
||||
ClassOrModuleOrStructureTypeDeclaration = |
||||
( "Module" | "Class" | "Structure" ) ANY |
||||
[ "(" "Of" GenericTypeParameterDeclaration ")" ] StatementTerminator |
||||
(. Indent(la); .) |
||||
{ |
||||
( ClassOrModuleOrStructureTypeDeclaration | DelegateTypeDeclaration | EnumTypeDeclaration |
||||
| InterfaceDeclaration | MemberDeclaration ) |
||||
} |
||||
(. Unindent(la); .) |
||||
"End" ( "Module" | "Class" | "Structure" ) StatementTerminator |
||||
. |
||||
|
||||
EnumTypeDeclaration = |
||||
"Enum" { ANY } StatementTerminator |
||||
(. Indent(la); .) |
||||
{ ANY [ "=" Expression ] StatementTerminator } |
||||
(. Unindent(la); .) |
||||
"End" "Enum" StatementTerminator |
||||
. |
||||
|
||||
InterfaceDeclaration = |
||||
"Interface" ANY [ "(" "Of" GenericTypeParameterDeclaration ")" ] StatementTerminator |
||||
(. Indent(la); .) |
||||
[ "Inherits" TypeName { "," TypeName } StatementTerminator ] |
||||
{ |
||||
( ClassOrModuleOrStructureTypeDeclaration | DelegateTypeDeclaration | EnumTypeDeclaration |
||||
| InterfaceDeclaration | InterfaceMemberDeclaration ) { ANY } |
||||
} |
||||
(. Unindent(la); .) |
||||
"End" "Interface" StatementTerminator |
||||
. |
||||
|
||||
InterfaceMemberDeclaration = |
||||
InterfaceEvent | InterfaceProperty | InterfaceSubOrFunction |
||||
. |
||||
|
||||
InterfaceEvent = |
||||
"Event" { ANY } StatementTerminator |
||||
. |
||||
|
||||
InterfaceProperty = |
||||
"Property" { ANY } StatementTerminator |
||||
. |
||||
|
||||
InterfaceSubOrFunction = |
||||
("Sub" | "Function") { ANY } |
||||
{ "(" [ ( "Of" GenericTypeParameterDeclaration | ParameterList ) ] ")" } |
||||
[ "As" TypeName ] |
||||
StatementTerminator |
||||
. |
||||
|
||||
GenericConstraint = |
||||
TypeName | "New" | "Class" | "Structure" |
||||
. |
||||
|
||||
GenericConstraintList = |
||||
GenericConstraint | "{" GenericConstraint { "," GenericConstraint } "}" |
||||
. |
||||
|
||||
GenericTypeParameterDeclaration = |
||||
[ "Out" | "In" ] ANY [ "As" GenericConstraintList ] |
||||
{ "," [ "Out" | "In" ] ANY [ "As" GenericConstraintList ] } |
||||
. |
||||
|
||||
DelegateTypeDeclaration = |
||||
"Delegate" ("Sub" | "Function") ANY |
||||
[ "(" [ ParameterList ] ")" ] [ "As" TypeName ] StatementTerminator |
||||
. |
||||
|
||||
MemberDeclaration = |
||||
( |
||||
MemberVariableOrConstantDeclaration | |
||||
SubOrFunctionDeclaration | |
||||
ExternalMemberDeclaration | |
||||
EventMemberDeclaration | |
||||
CustomEventMemberDeclaration | |
||||
PropertyDeclaration | |
||||
OperatorDeclaration |
||||
) |
||||
. |
||||
|
||||
SubOrFunctionDeclaration = |
||||
("Sub" | "Function") |
||||
ANY |
||||
{ "(" [ ( "Of" GenericTypeParameterDeclaration | ParameterList ) ] ")" } |
||||
[ "As" TypeName ] |
||||
StatementTerminatorAndBlock |
||||
"End" ("Sub" | "Function") StatementTerminator |
||||
. |
||||
|
||||
ExternalMemberDeclaration = |
||||
"Declare" [ "Ansi" | "Unicode" | "Auto" ] ( "Sub" | "Function" ) ANY |
||||
"Lib" LiteralString [ "Alias" LiteralString ] [ "(" [ ParameterList ] ")" ] [ "As" TypeName ] StatementTerminator |
||||
. |
||||
|
||||
EventMemberDeclaration = |
||||
"Event" ANY ( "As" TypeName | [ "(" [ ParameterList ] ")" ] ) |
||||
[ "Implements" TypeName /*"." IdentifierOrKeyword*/ { "," TypeName /*"." IdentifierOrKeyword*/ } ] |
||||
/* the TypeName production already allows the "." IdentifierOrKeyword syntax, so to avoid an ambiguous grammer we just leave that out */ |
||||
StatementTerminator |
||||
. |
||||
|
||||
CustomEventMemberDeclaration = |
||||
"Custom" EventMemberDeclaration |
||||
{ |
||||
( "AddHandler" | "RemoveHandler" | "RaiseEvent" ) "(" ParameterList ")" |
||||
StatementTerminatorAndBlock |
||||
"End" ( "AddHandler" | "RemoveHandler" | "RaiseEvent" ) StatementTerminator |
||||
} |
||||
"End" "Event" StatementTerminator |
||||
. |
||||
|
||||
PropertyDeclaration = |
||||
"Property" { ANY } [ "=" Expression ] StatementTerminator |
||||
{ ANY } |
||||
[ (. Indent(la); .) |
||||
( "Get" | "Set" ) [ "(" [ ParameterList ] ")" ] |
||||
StatementTerminatorAndBlock |
||||
"End" ( "Get" | "Set" ) StatementTerminator |
||||
[ ( "Get" | "Set" ) [ "(" [ ParameterList ] ")" ] |
||||
StatementTerminatorAndBlock |
||||
"End" ( "Get" | "Set" ) StatementTerminator ] |
||||
(. Unindent(la); .) |
||||
"End" "Property" StatementTerminator ] |
||||
. |
||||
|
||||
OperatorDeclaration = |
||||
"Operator" { ANY } |
||||
StatementTerminatorAndBlock |
||||
"End" "Operator" StatementTerminator |
||||
. |
||||
MemberVariableOrConstantDeclaration = |
||||
MemberVariableOrConstantDeclarator { "," MemberVariableOrConstantDeclarator } StatementTerminator |
||||
. |
||||
|
||||
MemberVariableOrConstantDeclarator = |
||||
[ "Const" ] |
||||
ANY |
||||
[ "As" ( NewExpression | TypeName ) ] |
||||
[ "=" Expression ] |
||||
. |
||||
|
||||
ParameterList = |
||||
Parameter { "," Parameter } |
||||
. |
||||
|
||||
Parameter = |
||||
ANY |
||||
{ ANY } |
||||
[ "As" TypeName ] |
||||
[ "=" Expression ] |
||||
. |
||||
|
||||
StatementTerminatorAndBlock = |
||||
(. Indent(la); .) |
||||
StatementTerminator |
||||
{ EXPECTEDCONFLICT("End") |
||||
( |
||||
[ Statement] StatementTerminator |
||||
| "End" |
||||
( StatementTerminator /* End+StatementTerminator is end statement */ |
||||
| /* End+anything else is the end of this block. */ |
||||
(. |
||||
currentState = endOfStatementTerminatorAndBlock; /* leave this block */ |
||||
InformToken(t); /* process End again*/ |
||||
/* for processing current token (la): go to the position after processing End */ |
||||
goto switchlbl; |
||||
.) |
||||
ANY /* never reached due to goto above: */ |
||||
/* this ANY is just so that Coco knows this branch isn't empty */ |
||||
) |
||||
) |
||||
} |
||||
(.NamedState:endOfStatementTerminatorAndBlock.) |
||||
(. Unindent(la); .) |
||||
. |
||||
|
||||
Expression |
||||
(.NamedState:startOfExpression.) |
||||
= SimpleExpressionWithSuffix { BinaryOperator SimpleExpressionWithSuffix } . |
||||
|
||||
BinaryOperator = |
||||
"+" | "-" | "*" | "\\" | "/" | "^" | "Mod" |
||||
| "=" | "<>" | "<" | ">" | "<=" | ">=" |
||||
| "Like" | "&" | "And" | "AndAlso" | "Or" | "OrElse" |
||||
| "Xor" | "<<" | ">>" | "Is" | "IsNot" |
||||
| "^=" | "*=" | "/=" | "\\=" | "+=" | "-=" | "&=" | "<<=" | ">>=" | "To" | ":=" |
||||
. |
||||
|
||||
UnaryOperator = |
||||
"+" | "-" | "Not" | "AddressOf" |
||||
. |
||||
|
||||
SimpleExpressionWithSuffix = |
||||
{ UnaryOperator } |
||||
( |
||||
SimpleExpression { ExpressionSuffix } |
||||
| "TypeOf" SimpleExpressionWithSuffix "Is" TypeName |
||||
| NewExpression |
||||
| CollectionInitializer |
||||
) |
||||
. |
||||
|
||||
SimpleExpression = |
||||
( ANY |
||||
| XmlLiteral |
||||
| LambdaExpression |
||||
| ConditionalExpression |
||||
) |
||||
. |
||||
|
||||
NewExpression = |
||||
"New" ( |
||||
TypeName |
||||
|
||||
[ |
||||
EXPECTEDCONFLICT("From") |
||||
( |
||||
"From" |
||||
( |
||||
CollectionInitializer /* From + CollectionInitializer is a NewExpression */ |
||||
| |
||||
(. |
||||
currentState = endOfStatementTerminatorAndBlock; /* leave this block */ |
||||
InformToken(t); /* process From again*/ |
||||
/* for processing current token (la): go to the position after processing End */ |
||||
goto switchlbl; |
||||
.) |
||||
ANY /* never reached due to goto above: */ |
||||
/* this ANY is just so that Coco knows this branch isn't empty */ |
||||
) |
||||
| |
||||
"With" ObjectInitializer |
||||
) |
||||
] |
||||
| |
||||
"With" ObjectInitializer |
||||
) |
||||
. |
||||
|
||||
ObjectInitializer = |
||||
"{" [ "Key" ] "." ANY "=" Expression { "," [ "Key" ] "." ANY "=" Expression } "}" |
||||
. |
||||
|
||||
CollectionInitializer = |
||||
"{" Expression { "," Expression } "}" |
||||
. |
||||
|
||||
ExpressionSuffix = |
||||
"(" ( "Of" TypeName { "," TypeName } ")" | [ ArgumentList ] ")" ) |
||||
| ( "." | "!" | ".@" | "..." ) [ XmlOpenTag ] ANY [ XmlCloseTag ] |
||||
. |
||||
|
||||
ConditionalExpression = |
||||
"If" "(" Expression "," Expression [ "," Expression ] ")" |
||||
. |
||||
|
||||
LambdaExpression = |
||||
SubLambdaExpression | |
||||
FunctionLambdaExpression |
||||
. |
||||
|
||||
SubLambdaExpression = |
||||
"Sub" "(" [ ParameterList ] ")" |
||||
( GREEDY Statement | StatementTerminatorAndBlock "End" "Sub" ) |
||||
. |
||||
|
||||
FunctionLambdaExpression = |
||||
"Function" "(" [ ParameterList ] ")" |
||||
( GREEDY Expression | [ "As" TypeName ] StatementTerminatorAndBlock "End" "Function" ) |
||||
. |
||||
|
||||
/* semantic action will be inserted on all paths that possibly lead to XmlLiteral */ |
||||
XmlLiteral = |
||||
( |
||||
( XmlComment | XmlProcessingInstruction | XmlCData ) [ XmlContent ] { ( XmlComment | XmlProcessingInstruction ) [ XmlContent ] } [ XmlElement { XmlComment [ XmlContent ] } ] |
||||
| |
||||
XmlElement { XmlComment [ XmlContent ] } |
||||
) |
||||
. |
||||
|
||||
XmlElement = |
||||
XmlOpenTag { ANY | XmlEmbeddedExpression } ( XmlCloseTagEmptyElement | XmlCloseTag { ANY | XmlEmbeddedExpression | XmlElement } XmlOpenEndTag { ANY | XmlEmbeddedExpression } XmlCloseTag ) |
||||
. |
||||
|
||||
XmlEmbeddedExpression = |
||||
XmlStartInlineVB Expression XmlEndInlineVB |
||||
. |
||||
|
||||
PrimitiveTypeName = |
||||
"Byte" | |
||||
"SByte" | |
||||
"UShort" | |
||||
"Short" | |
||||
"UInteger" | |
||||
"Integer" | |
||||
"ULong" | |
||||
"Long" | |
||||
"Single" | |
||||
"Double" | |
||||
"Decimal" | |
||||
"Boolean" | |
||||
"Date" | |
||||
"Char" | |
||||
"String" | |
||||
"Object" |
||||
. |
||||
|
||||
TypeName = ( "Global" | ident | PrimitiveTypeName | "?" /* used for ? = completion */ ) { TypeSuffix } { "." IdentifierOrKeyword { TypeSuffix } } . |
||||
|
||||
TypeSuffix = "(" ( "Of" [ TypeName ] { "," [ TypeName ] } | [ ArgumentList ] ) ")" . |
||||
|
||||
IdentifierOrKeyword = ident |
||||
| "AddHandler" |
||||
| "AddressOf" |
||||
| "Aggregate" |
||||
| "Alias" |
||||
| "And" |
||||
| "AndAlso" |
||||
| "Ansi" |
||||
| "As" |
||||
| "Ascending" |
||||
| "Assembly" |
||||
| "Auto" |
||||
| "Binary" |
||||
| "Boolean" |
||||
| "ByRef" |
||||
| "By" |
||||
| "Byte" |
||||
| "ByVal" |
||||
| "Call" |
||||
| "Case" |
||||
| "Catch" |
||||
| "CBool" |
||||
| "CByte" |
||||
| "CChar" |
||||
| "CDate" |
||||
| "CDbl" |
||||
| "CDec" |
||||
| "Char" |
||||
| "CInt" |
||||
| "Class" |
||||
| "CLng" |
||||
| "CObj" |
||||
| "Compare" |
||||
| "Const" |
||||
| "Continue" |
||||
| "CSByte" |
||||
| "CShort" |
||||
| "CSng" |
||||
| "CStr" |
||||
| "CType" |
||||
| "CUInt" |
||||
| "CULng" |
||||
| "CUShort" |
||||
| "Custom" |
||||
| "Date" |
||||
| "Decimal" |
||||
| "Declare" |
||||
| "Default" |
||||
| "Delegate" |
||||
| "Descending" |
||||
| "Dim" |
||||
| "DirectCast" |
||||
| "Distinct" |
||||
| "Do" |
||||
| "Double" |
||||
| "Each" |
||||
| "Else" |
||||
| "ElseIf" |
||||
| "End" |
||||
| "EndIf" |
||||
| "Enum" |
||||
| "Equals" |
||||
| "Erase" |
||||
| "Error" |
||||
| "Event" |
||||
| "Exit" |
||||
| "Explicit" |
||||
| "False" |
||||
| "Finally" |
||||
| "For" |
||||
| "Friend" |
||||
| "From" |
||||
| "Function" |
||||
| "Get" |
||||
| "GetType" |
||||
| "Global" |
||||
| "GoSub" |
||||
| "GoTo" |
||||
| "Group" |
||||
| "Handles" |
||||
| "If" |
||||
| "Implements" |
||||
| "Imports" |
||||
| "In" |
||||
| "Infer" |
||||
| "Inherits" |
||||
| "Integer" |
||||
| "Interface" |
||||
| "Into" |
||||
| "Is" |
||||
| "IsNot" |
||||
| "Join" |
||||
| "Key" |
||||
| "Let" |
||||
| "Lib" |
||||
| "Like" |
||||
| "Long" |
||||
| "Loop" |
||||
| "Me" |
||||
| "Mod" |
||||
| "Module" |
||||
| "MustInherit" |
||||
| "MustOverride" |
||||
| "MyBase" |
||||
| "MyClass" |
||||
| "Namespace" |
||||
| "Narrowing" |
||||
| "New" |
||||
| "Next" |
||||
| "Not" |
||||
| "Nothing" |
||||
| "NotInheritable" |
||||
| "NotOverridable" |
||||
| "Object" |
||||
| "Of" |
||||
| "Off" |
||||
| "On" |
||||
| "Operator" |
||||
| "Option" |
||||
| "Optional" |
||||
| "Or" |
||||
| "Order" |
||||
| "OrElse" |
||||
| "Out" |
||||
| "Overloads" |
||||
| "Overridable" |
||||
| "Overrides" |
||||
| "ParamArray" |
||||
| "Partial" |
||||
| "Preserve" |
||||
| "Private" |
||||
| "Property" |
||||
| "Protected" |
||||
| "Public" |
||||
| "RaiseEvent" |
||||
| "ReadOnly" |
||||
| "ReDim" |
||||
| "Rem" |
||||
| "RemoveHandler" |
||||
| "Resume" |
||||
| "Return" |
||||
| "SByte" |
||||
| "Select" |
||||
| "Set" |
||||
| "Shadows" |
||||
| "Shared" |
||||
| "Short" |
||||
| "Single" |
||||
| "Skip" |
||||
| "Static" |
||||
| "Step" |
||||
| "Stop" |
||||
| "Strict" |
||||
| "String" |
||||
| "Structure" |
||||
| "Sub" |
||||
| "SyncLock" |
||||
| "Take" |
||||
| "Text" |
||||
| "Then" |
||||
| "Throw" |
||||
| "To" |
||||
| "True" |
||||
| "Try" |
||||
| "TryCast" |
||||
| "TypeOf" |
||||
| "UInteger" |
||||
| "ULong" |
||||
| "Unicode" |
||||
| "Until" |
||||
| "UShort" |
||||
| "Using" |
||||
| "Variant" |
||||
| "Wend" |
||||
| "When" |
||||
| "Where" |
||||
| "While" |
||||
| "Widening" |
||||
| "With" |
||||
| "WithEvents" |
||||
| "WriteOnly" |
||||
| "Xor" |
||||
| "GetXmlNamespace" |
||||
. |
||||
|
||||
Statement = |
||||
VariableDeclarationStatement |
||||
| WithOrLockStatement |
||||
| AddOrRemoveHandlerStatement |
||||
| RaiseEventStatement |
||||
| EXPECTEDCONFLICT("If") IfStatement /* prefer if-statement to if-expression */ |
||||
| SelectStatement |
||||
| WhileStatement |
||||
| DoLoopStatement |
||||
| ForStatement |
||||
| ErrorHandlingStatement |
||||
| ThrowStatement |
||||
| TryStatement |
||||
| BranchStatement |
||||
| ReDimStatement |
||||
| EraseStatement |
||||
| UsingStatement |
||||
| InvocationStatement |
||||
. |
||||
|
||||
VariableDeclarationStatement = |
||||
( "Dim" | "Static" | "Const" ) ANY [ "?" ] [ ( "(" { "," } ")" ) ] |
||||
{ "," ANY [ "?" ] [ ( "(" { "," } ")" ) ] } |
||||
[ "As" ( NewExpression | TypeName ) ] |
||||
[ "=" Expression ] |
||||
. |
||||
|
||||
WithOrLockStatement = |
||||
( "With" | "SyncLock" ) Expression StatementTerminatorAndBlock "End" ( "With" | "SyncLock" ) |
||||
. |
||||
|
||||
AddOrRemoveHandlerStatement = |
||||
( "AddHandler" | "RemoveHandler" ) Expression "," Expression |
||||
. |
||||
|
||||
RaiseEventStatement = |
||||
"RaiseEvent" IdentifierOrKeyword [ "(" [ ArgumentList ] ")" ] |
||||
. |
||||
|
||||
IfStatement = |
||||
"If" Expression |
||||
( "Then" |
||||
( Statement { EXPECTEDCONFLICT(":") ":" [Statement] } [ EXPECTEDCONFLICT("Else") "Else" [Statement] { EXPECTEDCONFLICT(":") ":" [Statement] } ] |
||||
| MultilineIfRemainder |
||||
) |
||||
| MultilineIfRemainder |
||||
) |
||||
. |
||||
|
||||
MultilineIfRemainder = |
||||
StatementTerminatorAndBlock |
||||
{ |
||||
("Else" [ "If" Expression [ "Then" ] ] |
||||
| "ElseIf" Expression [ "Then" ] |
||||
) |
||||
StatementTerminatorAndBlock |
||||
} |
||||
"End" "If" |
||||
. |
||||
|
||||
SelectStatement = |
||||
"Select" [ "Case" ] Expression StatementTerminator |
||||
{ |
||||
"Case" ( |
||||
"Else" | |
||||
( [ "Is" ] ComparisonOperator SimpleExpressionWithSuffix | Expression ) |
||||
{ "," ( [ "Is" ] ComparisonOperator SimpleExpressionWithSuffix | Expression ) } |
||||
) |
||||
StatementTerminatorAndBlock |
||||
} |
||||
"End" "Select" |
||||
. |
||||
|
||||
ComparisonOperator = |
||||
"=" | "<>" | "<" | ">" | ">=" | "<=" |
||||
. |
||||
|
||||
WhileStatement = |
||||
"While" Expression StatementTerminatorAndBlock "End" "While" |
||||
. |
||||
|
||||
DoLoopStatement = |
||||
"Do" ( DoTopLoopStatement | DoBottomLoopStatement ) |
||||
. |
||||
|
||||
DoTopLoopStatement = |
||||
( "While" | "Until" ) Expression |
||||
StatementTerminatorAndBlock |
||||
"Loop" |
||||
. |
||||
|
||||
DoBottomLoopStatement = |
||||
StatementTerminatorAndBlock |
||||
"Loop" [ ( "While" | "Until" ) Expression ] |
||||
. |
||||
|
||||
ForStatement = |
||||
"For" ( ForLoopStatement | ForEachLoopStatement ) |
||||
. |
||||
|
||||
ForLoopStatement = |
||||
ForLoopVariable "=" Expression /* "To" is binary operator */ [ "Step" Expression ] |
||||
StatementTerminatorAndBlock |
||||
"Next" [ Expression { "," Expression } ] |
||||
. |
||||
|
||||
ForEachLoopStatement = |
||||
"Each" ForLoopVariable "In" Expression |
||||
StatementTerminatorAndBlock |
||||
"Next" [ Expression { "," Expression } ] |
||||
. |
||||
|
||||
ForLoopVariable = |
||||
SimpleExpression |
||||
[ "?" ] { ExpressionSuffix } |
||||
[ "As" TypeName ] |
||||
. |
||||
|
||||
ErrorHandlingStatement = |
||||
[ "On" ] "Error" ( Expression | "GoTo" ( LiteralInteger | ident ) | "Resume" "Next" ) |
||||
| "Resume" ( "Next" | LiteralInteger | ident ) |
||||
. |
||||
|
||||
ThrowStatement = |
||||
"Throw" [ Expression ] |
||||
. |
||||
|
||||
TryStatement = |
||||
"Try" |
||||
StatementTerminatorAndBlock |
||||
{ |
||||
"Catch" |
||||
[ ANY [ "As" TypeName ] ] |
||||
[ "When" Expression ] |
||||
StatementTerminatorAndBlock |
||||
} |
||||
[ |
||||
"Finally" |
||||
StatementTerminatorAndBlock |
||||
] |
||||
"End" "Try" |
||||
. |
||||
|
||||
BranchStatement = |
||||
"GoTo" ( ident | LiteralInteger ) |
||||
| "Exit" ( "Do" | "For" | "While" | "Select" | "Sub" | "Function" | "Property" | "Try" ) |
||||
| "Continue" ( "Do" | "For" | "While" ) |
||||
| "Stop" |
||||
/*| "End" HACK End-Statements has special handling in Block */ |
||||
| "Return" [ Expression ] |
||||
. |
||||
|
||||
ReDimStatement = |
||||
"ReDim" |
||||
[ EXPECTEDCONFLICT("Preserve") "Preserve" ] /* Preserve is context-dependend keyword */ |
||||
Expression |
||||
. |
||||
|
||||
EraseStatement = |
||||
"Erase" Expression { "," Expression } |
||||
. |
||||
|
||||
UsingStatement = |
||||
"Using" Expression |
||||
StatementTerminatorAndBlock |
||||
"End" "Using" |
||||
. |
||||
|
||||
InvocationStatement = |
||||
[ "Call" ] Expression |
||||
. |
||||
|
||||
ArgumentList = |
||||
Expression { "," [ Expression ] } |
||||
| "," [ Expression ] { "," [ Expression ] } |
||||
. |
||||
|
||||
END VBIndentationStrategy. |
||||
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="siegfriedpammer@gmail.com" />
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.NRefactory.Parser; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace ICSharpCode.VBNetBinding.FormattingStrategy |
||||
{ |
||||
/// <summary>
|
||||
/// Description of VBIndentationStrategy.
|
||||
/// </summary>
|
||||
public partial class VBIndentationStrategy |
||||
{ |
||||
Stack<Block> indentationStack = new Stack<Block>(); |
||||
ITextEditor editor; |
||||
IDocumentLine startLine, endLine; |
||||
|
||||
public string CurrentIndent { |
||||
get { return (indentationStack.PeekOrDefault() ?? Block.Empty).Indentation; } |
||||
} |
||||
|
||||
class Block { |
||||
public static readonly Block Empty = new Block { |
||||
Indentation = "", |
||||
StartLine = 1 |
||||
}; |
||||
|
||||
public string Indentation; |
||||
public int StartLine; |
||||
} |
||||
|
||||
public VBIndentationStrategy(ITextEditor editor, int start, int end) |
||||
: this() |
||||
{ |
||||
this.editor = editor; |
||||
|
||||
startLine = editor.Document.GetLine(start); |
||||
endLine = editor.Document.GetLine(end); |
||||
} |
||||
|
||||
void Indent(Token la) |
||||
{ |
||||
ApplyIndent(la); |
||||
Block parent = indentationStack.PeekOrDefault() ?? Block.Empty; |
||||
indentationStack.Push(new Block() { Indentation = parent.Indentation + editor.Options.IndentationString, StartLine = t.Location.Line + 1 } ); |
||||
} |
||||
|
||||
void Unindent(Token la) |
||||
{ |
||||
ApplyIndent(la); |
||||
indentationStack.PopOrDefault(); |
||||
} |
||||
|
||||
void ApplyIndent(Token la) |
||||
{ |
||||
Block current = indentationStack.PeekOrDefault() ?? Block.Empty; |
||||
|
||||
if (t.Location.Line < startLine.LineNumber) |
||||
return; |
||||
|
||||
IDocumentLine firstLine = startLine.LineNumber > current.StartLine ? startLine : editor.Document.GetLine(current.StartLine); |
||||
IDocumentLine currentLine = firstLine; |
||||
|
||||
while (currentLine.LineNumber < la.Location.Line) { |
||||
editor.Document.SmartReplaceLine(currentLine, current.Indentation + currentLine.Text.Trim()); |
||||
|
||||
if (currentLine.LineNumber == endLine.LineNumber) |
||||
break; |
||||
|
||||
currentLine = editor.Document.GetLine(currentLine.LineNumber + 1); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using System; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.VBNetBinding.OptionPanels |
||||
{ |
||||
public class VBNetTextEditorPanel : XmlFormsOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.VBNetTextEditorOptions.xfrm")); |
||||
Get<CheckBox>("enableEndConstructs").Checked = PropertyService.Get<bool>("VBBinding.TextEditor.EnableEndConstructs", true); |
||||
Get<CheckBox>("enableCasing").Checked = PropertyService.Get<bool>("VBBinding.TextEditor.EnableCasing", true); |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
PropertyService.Set<bool>("VBBinding.TextEditor.EnableEndConstructs", Get<CheckBox>("enableEndConstructs").Checked); |
||||
PropertyService.Set<bool>("VBBinding.TextEditor.EnableCasing", Get<CheckBox>("enableCasing").Checked); |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<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"> |
||||
<StackPanel> |
||||
<GroupBox |
||||
Header="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.FormattingGroupBox}" |
||||
HorizontalAlignment="Left"> |
||||
<StackPanel> |
||||
<CheckBox |
||||
Content="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.EnableEndConstructsCheckBox}" |
||||
IsChecked="{sd:OptionBinding addin:TextEditorOptions.EnableEndConstructs}" |
||||
/> |
||||
<CheckBox |
||||
Content="{sd:Localize Dialog.Options.IDEOptions.TextEditor.VB.EnableCasingCheckBox}" |
||||
IsChecked="{sd:OptionBinding addin:TextEditorOptions.EnableCasing}" |
||||
/> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
||||
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="siegfriedpammer@gmail.com" />
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.VBNetBinding.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for TextEditorOptions.xaml
|
||||
/// </summary>
|
||||
public partial class TextEditorOptions |
||||
{ |
||||
public TextEditorOptions() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public static bool EnableEndConstructs { |
||||
get { return PropertyService.Get("VBBinding.TextEditor.EnableEndConstructs", true); } |
||||
set { PropertyService.Set("VBBinding.TextEditor.EnableEndConstructs", value); } |
||||
} |
||||
|
||||
public static bool EnableCasing { |
||||
get { return PropertyService.Get("VBBinding.TextEditor.EnableCasing", true); } |
||||
set { PropertyService.Set("VBBinding.TextEditor.EnableCasing", value); } |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue