Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,427 changes: 1,209 additions & 1,218 deletions Rubberduck.Parsing/Grammar/VBALexer.cs

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions Rubberduck.Parsing/Grammar/VBALexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ LENB : L E N B;
LONGLONG : L O N G L O N G;
LONGPTR : L O N G P T R;
MIDB : M I D B;
// MIDBTYPESUFFIX : M I D B '$';
// MIDTYPESUFFIX : M I D '$';
OPTION : O P T I O N;
PSET : P S E T;
SCALE : S C A L E;
Expand Down
4,095 changes: 2,042 additions & 2,053 deletions Rubberduck.Parsing/Grammar/VBAParser.cs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Rubberduck.Parsing/Grammar/VBAParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ propertyLetStmt :
// 5.4.2.20 RaiseEvent Statement
raiseEventStmt : RAISEEVENT whiteSpace identifier (whiteSpace? LPAREN whiteSpace? eventArgumentList? whiteSpace? RPAREN)?;
eventArgumentList : eventArgument (whiteSpace? COMMA whiteSpace? eventArgument)*;
eventArgument : expression;
eventArgument : (BYVAL whiteSpace)? expression;

// 5.4.3.3 ReDim Statement
// To make the grammar non-ambiguous we treat redim statements as index expressions.
Expand Down Expand Up @@ -705,15 +705,12 @@ keyword :
| LENB
| LIB
| LIKE
| LOAD
| LONG
| LONGLONG
| LONGPTR
| ME
| MID
| MIDB
// | MIDBTYPESUFFIX
// | MIDTYPESUFFIX
| MOD
| NEW
| NOT
Expand Down Expand Up @@ -745,7 +742,6 @@ keyword :
| XOR
| STEP
| ON_ERROR
| RESUME_NEXT
| ERROR
| APPEND
| BINARY
Expand Down
404 changes: 203 additions & 201 deletions Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParser.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
// Generated from C:\Dev\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3

// Unreachable code detected

using Antlr4.Runtime.Misc;

#pragma warning disable 0162
// The variable '...' is assigned but its value is never used
#pragma warning disable 0219
// Missing XML comment for publicly visible type or member '...'
#pragma warning disable 1591

namespace Rubberduck.Parsing.Preprocessing {
using IErrorNode = Antlr4.Runtime.Tree.IErrorNode;
namespace Rubberduck.Parsing {

using Antlr4.Runtime.Misc;
using IErrorNode = Antlr4.Runtime.Tree.IErrorNode;
using ITerminalNode = Antlr4.Runtime.Tree.ITerminalNode;
using ParserRuleContext = Antlr4.Runtime.ParserRuleContext;
using IToken = Antlr4.Runtime.IToken;
using ParserRuleContext = Antlr4.Runtime.ParserRuleContext;

/// <summary>
/// This class provides an empty implementation of <see cref="IVBAConditionalCompilationParserListener"/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
// Generated from C:\Dev\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3

// Unreachable code detected

using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;

#pragma warning disable 0162
// The variable '...' is assigned but its value is never used
#pragma warning disable 0219
// Missing XML comment for publicly visible type or member '...'
#pragma warning disable 1591

namespace Rubberduck.Parsing.Preprocessing {
/// <summary>
namespace Rubberduck.Parsing {
using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;
using IToken = Antlr4.Runtime.IToken;
using ParserRuleContext = Antlr4.Runtime.ParserRuleContext;

/// <summary>
/// This class provides an empty implementation of <see cref="IVBAConditionalCompilationParserVisitor{Result}"/>,
/// which can be extended to create a visitor which only needs to handle a subset
/// of the available methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
// Generated from C:\Dev\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3

// Unreachable code detected

using Antlr4.Runtime.Misc;

#pragma warning disable 0162
// The variable '...' is assigned but its value is never used
#pragma warning disable 0219
// Missing XML comment for publicly visible type or member '...'
#pragma warning disable 1591

namespace Rubberduck.Parsing.Preprocessing {
using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener;
namespace Rubberduck.Parsing {
using Antlr4.Runtime.Misc;
using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener;
using IToken = Antlr4.Runtime.IToken;

/// <summary>
/// <summary>
/// This interface defines a complete listener for a parse tree produced by
/// <see cref="VBAConditionalCompilationParser"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
// Generated from C:\Dev\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3

// Unreachable code detected

using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;

#pragma warning disable 0162
// The variable '...' is assigned but its value is never used
#pragma warning disable 0219
// Missing XML comment for publicly visible type or member '...'
#pragma warning disable 1591

namespace Rubberduck.Parsing.Preprocessing {
/// <summary>
namespace Rubberduck.Parsing {
using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;
using IToken = Antlr4.Runtime.IToken;

/// <summary>
/// This interface defines a complete generic visitor for a parse tree produced
/// by <see cref="VBAConditionalCompilationParser"/>.
/// </summary>
Expand Down
33 changes: 33 additions & 0 deletions RubberduckTests/Grammar/VBAParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,39 @@ End Sub
AssertTree(parseResult.Item1, parseResult.Item2, "//rangeClause", matches => matches.Count == 1);
}

[TestCategory("Parser")]
[TestMethod]
public void TestRaiseEventByValParameter()
{
const string code = @"
Public Event Foo(ByRef Bar As Boolean, ByVal Baz As String)

Public Sub Test()
Dim arg As String
arg = ""Foo""
RaiseEvent Foo(True, ByVal 42)
End Sub
";
var parseResult = Parse(code);
AssertTree(parseResult.Item1, parseResult.Item2, "//raiseEventStmt", matches => matches.Count == 1);
}

[TestCategory("Parser")]
[TestMethod]
public void TestRaiseEvent()
{
const string code = @"
Public Event Foo(ByRef Bar As Boolean, ByVal Baz As String)

Public Sub Test()
Dim arg As Boolean
RaiseEvent Foo(arg, ""Foo"")
End Sub
";
var parseResult = Parse(code);
AssertTree(parseResult.Item1, parseResult.Item2, "//raiseEventStmt", matches => matches.Count == 1);
}

private Tuple<VBAParser, ParserRuleContext> Parse(string code)
{
var stream = new AntlrInputStream(code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Diagnostics;
using System.Globalization;
using Rubberduck.Parsing;

namespace RubberduckTests.Preprocessing
{
Expand Down