Sorin Miklós Zsejki | 29 May 06:28

Source files organized "Java-style"

I've noticed that if I organize source files for components/APIs in
folders based on their names, i.e. the component Com.Example.Something
in ./Com/Example/Something.fss instead of ./Com.Example.Something.fss,
the file is found but I get a "Component/API names must match their
enclosing file names" message.

I can easily circumvent this error by a quick&dirty trick in
Compilation.rats like in the attached patch. I now this is far from
perfect (mainly because I can't tell how much of the path comes from
the component name), but it allows me to organize files in folders,
which would be a big deal. If this won't be implemented properly in
the near future, could you consider doing something similar?
Please...?
Index: com/sun/fortress/parser/Compilation.rats
===================================================================
--- com/sun/fortress/parser/Compilation.rats	(revision 1745)
+++ com/sun/fortress/parser/Compilation.rats	(working copy)
@@ -38,9 +38,14 @@
      { Span span = createSpan(yyStart,yyCount);
        String file = span.begin.getFileName();
        APIName filename = NodeFactory.makeAPIName(span, file, "\\.");
-       if (!filename.equals(yyValue.getName()))
-           yyValue = syntaxError(createSpan(yyStart,yyCount),
+       if (!filename.equals(yyValue.getName())) {
+           List<Id> fileIds = filename.getIds();
+           List<Id> nameIds = yyValue.getName().getIds();
+           if (fileIds.size() != 1 || nameIds.size() == 0
+                   || !fileIds.get(0).equals(nameIds.get(nameIds.size() - 1)))
+               yyValue = syntaxError(createSpan(yyStart,yyCount),
                                  "Component/API names must match their enclosing file names.");
+       }
      }
    / w Exports w semicolon? w Imports w semicolon?
      (w Decls w semicolon?)? w EndOfFile    // Error production

Gmane