Skip to content

Feedback on the ANTLR grammer #6173

Closed
Closed
@Beakerboy

Description

@Beakerboy

I’m using ANTLR to parse VBA files and see Rubberduck cited on the most recent version of the grammer file.

When exporting a Form object from Excel VBA, the header looks like this:

VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Login 
   Caption         =   "Please Log In"
   ClientHeight    =   1920
   ClientLeft      =   120
   ClientTop       =   465
   ClientWidth     =   2295
   OleObjectBlob   =   "Login.frx":0000
   StartUpPosition =   1  'CenterOwner
End

This file fails to parse on three places:

  • The current grammer file mandates a CLASS after the version number
  • There cannot be anything after the BEGIN
  • Variables have to be assigned a literal, so literal COLON literal is not allowed

I have an updated grammer file that I was hoping to get some feedback on. Let me know if there is a reason the main file should not be updated with my changes.

I’ve:

  • made CLASS optional
  • Allowed for an optional GUID followed by an identifier
  • Allowed for an optional COLON followed by a literal

i Imagine the “real” changes will need to be more nuanced than I’ve made it. For example

  • should the grammer maybe be ’5.00’ | (DOUBLELITERAL WS CLASS)
  • Should STRINGLITERAL COLON DIGIT DIGIT DIGIT DIGIT be considered a separate literal type?

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportWhether you're using Rubberduck or you've forked it and have questions, never hesitate to ask!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions