Author Topic: BNF Grammar for anonymous types and module level declarations  (Read 1702 times)

suityou01

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
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?