beakerboy / grammars-v4 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from xenios91/grammars-v4
Grammars written for ANTLR v4; expectation that the grammars are free of actions.
License: MIT License
This project forked from xenios91/grammars-v4
Grammars written for ANTLR v4; expectation that the grammars are free of actions.
License: MIT License
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.
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
;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.