Skip to content

Building the Parser

Mathieu Guindon edited this page Jan 11, 2017 · 5 revisions

When changes are made to the VBAParser.g4 grammar, the following steps should be taken:

  • Save changes
  • (turn off ReSharper solution-wide analysis)
  • Delete the following generated files under Rubberduck.Parsing.Grammar:
    • VBAParser.cs
    • VBAParserBaseListener.cs
    • VBAParserBaseVisitor.cs
    • VBAParserListener.cs
    • VBAParserVisitor.cs
  • (toggle 'Show all files' on in VS Solution Explorer)
  • Delete the following generated files under Rubberduck.Parsing\obj if they exist:
    • VBAParser.cs
    • VBAParserBaseListener.cs
    • VBAParserBaseVisitor.cs
    • VBAParserListener.cs
    • VBAParserVisitor.cs
  • Set 'Build Action' of VBAParser.g4 grammar file to "Antlr4": this will generate all files that need to be generated
  • Set 'Build Action' of VBAParser.g4 grammar file back to "None"
  • Copy the following generated files from Rubberduck.Parsing\obj to Rubberduck.Parsing.Grammar:
    • VBAParser.cs
    • VBAParserBaseListener.cs
    • VBAParserBaseVisitor.cs
    • VBAParserListener.cs
    • VBAParserVisitor.cs
  • (turn ReSharper solution-wide analysis back on)
  • Run all tests

A lot of tests require a working parser to be conclusive. If something broke, the VS Test Explorer will have these tests as "Skipped Tests". Any broken parser unit tests will be under "Failed Tests". A successful modification will not break any tests.

Clone this wiki locally