Giter VIP home page Giter VIP logo

beakerboy / grammars-v4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xenios91/grammars-v4

0.0 0.0 0.0 48.2 MB

Grammars written for ANTLR v4; expectation that the grammars are free of actions.

License: MIT License

Shell 1.49% JavaScript 0.53% C++ 0.90% Python 5.81% C 0.07% PHP 0.09% Objective-C 0.12% Java 14.68% Lua 0.01% Smalltalk 0.07% Fortran 1.71% Go 0.40% C# 2.31% PowerShell 0.93% Dart 0.24% TypeScript 0.34% ANTLR 70.00% Swift 0.10% Makefile 0.02% CMake 0.18%

grammars-v4's People

Contributors

amagistroni avatar ani-sha avatar beakerboy avatar bkiers avatar dependabot[bot] avatar github-actions[bot] avatar harveyyue avatar hellozrh avatar inkoit avatar jiangtao69039 avatar jpechane avatar kaby76 avatar kayman-mk avatar kvanttt avatar lee-m avatar madams51703 avatar mario-s avatar marti2203 avatar mlorek avatar msagca avatar naros avatar oleksiikovalov avatar parrt avatar pguyot avatar rainerschuster avatar robein avatar rosspatterson avatar sergeyrusskih avatar teverett avatar vonloxley avatar

grammars-v4's Issues

[BUG] On Error GoTo -1

Parser should interpret On Error GoTo -1 as valid VBA. I shortcut fixed the problem by simply allowing a negative sign in front of INTEGERLITERAL. Unsure if this has breaking ripple effects and you may wish to update the rule to allow -1 or lineNumberLabel. My use case prefers a more tolerant parser though.

INTEGERLITERAL
    : [-]? (DIGIT DIGIT*
    | '&H' [0-9A-F]+
    | '&' [O]? [0-7]+) [%&^]?
    ;

Example ripple effect, the literalExpression would normally be split into a MINUS and INTEGERLITERAL. The result is essentially the same in this case.

image

[BUG]? Class description attribute

Not sure if this one is actually a bug because internet information says that it's supposed to add a class description to the object browser, however I've not been able to get that working.

I "fixed" by adding ATTRIBUTE WS? VB_DESCRIPTION WS? EQ WS? STRINGLITERAL to the classAttr rule.

Given that any other attribute isn't "invalid" per se, they are simply ignored, you may wish to add an ignored type of attribute. Mine currently looks like this. Note that I've also peeled off VB_NAME to make it easier to find in code. Not strictly something a parser may be concerned with.

classModuleHeader: (endOfLine+ (classAttr | nameAttr | ignoredAttr))* WS?;

// VBA Library Projects are allowed to have GoobalNamespace and creatable as true.
classAttr
    : ATTRIBUTE WS? VB_DESCRIPTION WS? EQ WS? STRINGLITERAL
    | ATTRIBUTE WS? VB_GLOBALNAMESPACE WS? EQ WS? booleanLiteralIdentifier
    | ATTRIBUTE WS? VB_CREATABLE WS? EQ WS? booleanLiteralIdentifier
    | ATTRIBUTE WS? VB_PREDECLAREDID WS? EQ WS? booleanLiteralIdentifier
    | ATTRIBUTE WS? VB_EXPOSED WS? EQ WS? booleanLiteralIdentifier
    | ATTRIBUTE WS? VB_CUSTOMIZABLE WS? EQ WS? booleanLiteralIdentifier
    ;

ignoredAttr
    : ATTRIBUTE WS? ambiguousIdentifier WS? EQ WS? expression
    ;

nameAttr
    : ATTRIBUTE WS? VB_NAME WS? EQ WS? STRINGLITERAL
    ;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.