31 changed files with 3713 additions and 6989 deletions
File diff suppressed because it is too large
Load Diff
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
/*---------------------------------------------------------------------- |
||||
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 |
||||
|
||||
|
||||
$$$ |
@ -1,298 +0,0 @@
@@ -1,298 +0,0 @@
|
||||
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 |
||||
. |
||||
|
||||
DelegateTypeDeclaration = "Delegate" { ANY } StatementTerminator . |
||||
|
||||
EnumTypeDeclaration = |
||||
"Enum" { ANY } StatementTerminator |
||||
(. Indent(la); .) |
||||
{ ANY } StatementTerminator |
||||
(. Unindent(la); .) |
||||
"End" "Enum" StatementTerminator |
||||
. |
||||
|
||||
END VBIndentationStrategy. |
@ -1,76 +0,0 @@
@@ -1,76 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.NRefactory.Parser; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace ICSharpCode.VBNetBinding |
||||
{ |
||||
/// <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); |
||||
} |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue