Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: suityou01 on March 30, 2022, 08:12:03 pm

Title: BNF Grammar for anonymous types and module level declarations
Post by: suityou01 on March 30, 2022, 08:12:03 pm
Hi all,

I'm trying to carve out a basic bnf grammar for importing js (ecmascript) files. I have had a lot of success so far and can parse classes, functions, imports, expors etc etc.
My one question is basically how can I get the name of the file currently being examined by the importer that is applying the specific grammar?

Take for example the following js code, in a ecma module

file.js
Code: [Select]
let x = 1;

export default x;

Now in terms of rendering a UML model node from this code, we have the implicit module "file.js" to which our variable is bound. How would I get this filename in a cfg using EA?

Is there some kind of macro or preProcessor command I can call to get this?