Skip to content

Commit af22ddf

Browse files
committed
Merge pull request #71 from rubberduck-vba/next
sync with main repo
2 parents d7da07d + e2f75e8 commit af22ddf

30 files changed

+1346
-1259
lines changed

RetailCoder.VBE/Inspections/ImplicitByRefParameterInspection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
2424
var interfaceMembers = UserDeclarations.FindInterfaceImplementationMembers();
2525

2626
var issues = (from item in UserDeclarations
27-
where !item.IsInspectionDisabled(AnnotationName)
27+
where
28+
!item.IsInspectionDisabled(AnnotationName)
2829
&& item.DeclarationType == DeclarationType.Parameter
30+
// ParamArray parameters do not allow an explicit "ByRef" parameter mechanism.
31+
&& !((ParameterDeclaration)item).IsParamArray
2932
&& !interfaceMembers.Select(m => m.Scope).Contains(item.ParentScope)
3033
let arg = item.Context as VBAParser.ArgContext
3134
where arg != null && arg.BYREF() == null && arg.BYVAL() == null

RetailCoder.VBE/Inspections/InspectionsUI.de.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
<value>Deklariere explizit als 'Variant'</value>
424424
</data>
425425
<data name="ImplicitByRefParameterQuickFix" xml:space="preserve">
426-
<value>Über gebe den Parameter explizit als Referenz</value>
426+
<value>Parameter explizit als Referenz angeben</value>
427427
</data>
428428
<data name="Inspections_DeclarationOf" xml:space="preserve">
429429
<value>Deklaration von</value>

RetailCoder.VBE/Inspections/OptionBaseInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
2929
return new List<InspectionResultBase>();
3030
}
3131

32-
var issues = options.Where(option => ((VBAParser.OptionBaseStmtContext)option.Context).SHORTLITERAL().GetText() == "1")
32+
var issues = options.Where(option => ((VBAParser.OptionBaseStmtContext)option.Context).numberLiteral().GetText() == "1")
3333
.Select(issue => new OptionBaseInspectionResult(this, issue.QualifiedName.QualifiedModuleName));
3434

3535
return issues;

RetailCoder.VBE/UI/Command/Refactorings/RefactorExtractInterfaceCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override bool CanExecute(object parameter)
4444
item.QualifiedName.QualifiedModuleName.Equals(selection.QualifiedName)
4545
&& item.IdentifierName == selection.QualifiedName.ComponentName
4646
&& (item.DeclarationType == DeclarationType.Class || item.DeclarationType == DeclarationType.Document || item.DeclarationType == DeclarationType.UserForm));
47-
var hasMembers = _state.AllUserDeclarations.Any(item => item.DeclarationType.HasFlag(DeclarationType.Member) && item.ParentDeclaration.Equals(target));
47+
var hasMembers = _state.AllUserDeclarations.Any(item => item.DeclarationType.HasFlag(DeclarationType.Member) && item.ParentDeclaration != null && item.ParentDeclaration.Equals(target));
4848

4949
// true if active code pane is for a class/document/form module
5050
var canExecute = ModuleTypes.Contains(Vbe.ActiveCodePane.CodeModule.Parent.Type) && target != null && hasMembers;

Rubberduck.Parsing/Grammar/VBALexer.cs

Lines changed: 997 additions & 979 deletions
Large diffs are not rendered by default.

Rubberduck.Parsing/Grammar/VBALexer.g4

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@ ASSIGN : ':=';
204204
DIV : '/';
205205
INTDIV : '\\';
206206
EQ : '=';
207-
GEQ : '>=';
207+
GEQ : '>=' | '=>';
208208
GT : '>';
209-
LEQ : '<=';
209+
LEQ : '<=' | '=<';
210210
LPAREN : '(';
211211
LT : '<';
212212
MINUS : '-';
213213
MULT : '*';
214-
NEQ : '<>';
214+
NEQ : '<>' | '><';
215215
PLUS : '+';
216216
POW : '^';
217217
RPAREN : ')';
@@ -225,9 +225,20 @@ R_SQUARE_BRACKET : ']';
225225
STRINGLITERAL : '"' (~["\r\n] | '""')* '"';
226226
OCTLITERAL : '&O' [0-8]+ '&'?;
227227
HEXLITERAL : '&H' [0-9A-F]+ '&'?;
228-
SHORTLITERAL : (PLUS|MINUS)? DIGIT+ ('#' | '&' | '@')?;
229-
INTEGERLITERAL : SHORTLITERAL (E SHORTLITERAL)?;
230-
DOUBLELITERAL : (PLUS|MINUS)? DIGIT* '.' DIGIT+ (E SHORTLITERAL)?;
228+
FLOATLITERAL :
229+
FLOATINGPOINTLITERAL FLOATINGPOINTTYPESUFFIX?
230+
| DECIMALLITERAL FLOATINGPOINTTYPESUFFIX;
231+
fragment FLOATINGPOINTLITERAL :
232+
DECIMALLITERAL EXPONENT
233+
| DECIMALLITERAL '.' DECIMALLITERAL? EXPONENT?
234+
| '.' DECIMALLITERAL EXPONENT?;
235+
INTEGERLITERAL : DECIMALLITERAL INTEGERTYPESUFFIX?;
236+
fragment INTEGERTYPESUFFIX : [%&^];
237+
fragment FLOATINGPOINTTYPESUFFIX : [!#@];
238+
fragment EXPONENT : EXPONENTLETTER EXPONENTSIGN? DIGIT+;
239+
fragment EXPONENTLETTER : [DEde];
240+
fragment EXPONENTSIGN : [+-];
241+
fragment DECIMALLITERAL : DIGIT+;
231242
DATELITERAL : '#' DATEORTIME '#';
232243
fragment DATEORTIME : DATEVALUE WS? TIMEVALUE | DATEVALUE | TIMEVALUE;
233244
fragment DATEVALUE : DATEVALUEPART DATESEPARATOR DATEVALUEPART (DATESEPARATOR DATEVALUEPART)?;

Rubberduck.Parsing/Grammar/VBAParser.cs

Lines changed: 86 additions & 87 deletions
Large diffs are not rendered by default.

Rubberduck.Parsing/Grammar/VBAParser.g4

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module :
3434
whiteSpace?
3535
;
3636

37-
moduleHeader : VERSION whiteSpace DOUBLELITERAL whiteSpace? CLASS? endOfStatement;
37+
moduleHeader : VERSION whiteSpace numberLiteral whiteSpace? CLASS? endOfStatement;
3838

3939
moduleConfig :
4040
BEGIN (whiteSpace GUIDLITERAL whiteSpace ambiguousIdentifier whiteSpace?)? endOfStatement
@@ -43,18 +43,18 @@ moduleConfig :
4343
;
4444

4545
moduleConfigElement :
46-
ambiguousIdentifier whiteSpace* EQ whiteSpace* literal (COLON SHORTLITERAL)? endOfStatement
46+
ambiguousIdentifier whiteSpace* EQ whiteSpace* literal (COLON numberLiteral)? endOfStatement
4747
;
4848

4949
moduleAttributes : (attributeStmt endOfStatement)+;
5050

5151
moduleDeclarations : moduleDeclarationsElement (endOfStatement moduleDeclarationsElement)* endOfStatement;
5252

5353
moduleOption :
54-
OPTION_BASE whiteSpace SHORTLITERAL # optionBaseStmt
54+
OPTION_BASE whiteSpace numberLiteral # optionBaseStmt
5555
| OPTION_COMPARE whiteSpace (BINARY | TEXT | DATABASE) # optionCompareStmt
56-
| OPTION_EXPLICIT # optionExplicitStmt
57-
| OPTION_PRIVATE_MODULE # optionPrivateModuleStmt
56+
| OPTION_EXPLICIT # optionExplicitStmt
57+
| OPTION_PRIVATE_MODULE # optionPrivateModuleStmt
5858
;
5959

6060
moduleDeclarationsElement :
@@ -365,7 +365,7 @@ selectCaseStmt :
365365
sC_Selection :
366366
IS whiteSpace? comparisonOperator whiteSpace? valueStmt # caseCondIs
367367
| valueStmt whiteSpace TO whiteSpace valueStmt # caseCondTo
368-
| valueStmt # caseCondValue
368+
| valueStmt # caseCondValue
369369
;
370370

371371
sC_Case :
@@ -374,8 +374,8 @@ sC_Case :
374374
;
375375

376376
sC_Cond :
377-
ELSE # caseCondElse
378-
| sC_Selection (whiteSpace? COMMA whiteSpace? sC_Selection)* # caseCondSelection
377+
ELSE # caseCondElse
378+
| sC_Selection (whiteSpace? COMMA whiteSpace? sC_Selection)* # caseCondSelection
379379
;
380380

381381
sendkeysStmt : SENDKEYS whiteSpace valueStmt (whiteSpace? COMMA whiteSpace? valueStmt)?;
@@ -533,7 +533,7 @@ lineLabel : (ambiguousIdentifier | numberLiteral) COLON;
533533

534534
literal : numberLiteral | DATELITERAL | STRINGLITERAL | TRUE | FALSE | NOTHING | NULL | EMPTY;
535535

536-
numberLiteral : HEXLITERAL | OCTLITERAL | DOUBLELITERAL | INTEGERLITERAL | SHORTLITERAL;
536+
numberLiteral : HEXLITERAL | OCTLITERAL | FLOATLITERAL | INTEGERLITERAL;
537537

538538
type : (baseType | complexType) (whiteSpace? LPAREN whiteSpace? RPAREN)?;
539539

Rubberduck.Parsing/Grammar/VBAParserBaseListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\TestProj\TestProj\Grammar\VBAParser.g4 by ANTLR 4.3
11+
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\RubberduckParserTest\RubberduckParserTest\VBAParser.g4 by ANTLR 4.3
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

Rubberduck.Parsing/Grammar/VBAParserBaseVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\TestProj\TestProj\Grammar\VBAParser.g4 by ANTLR 4.3
11+
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\RubberduckParserTest\RubberduckParserTest\VBAParser.g4 by ANTLR 4.3
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162

0 commit comments

Comments
 (0)