Separating Recognizer's folder and Namespace #567
Replies: 4 comments 1 reply
-
hi. Interesting. I noticed some complexity when I looked at the gen directory thing in the code and couldn't quite figure out exactly what I was doing. The tool does have an option to say where all of the output goes,
When I search in the code it looks like the only place that is used is in building the plugin itself. haha. I wonder if we shouldn't convert everything to use that exact outfit dirt thing to make it easier to understand we're output goes? |
Beta Was this translation helpful? Give feedback.
-
Thanks. next hack session on the plugin, i'll take a look at this. we should simplify. @bjansen any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Are there any updates on this matter? My workaround for this, is choosing a completely different path for my generated files and then add them as link. For a solution with tree like the following:
I use a completely different folder Output directory where all output is generated : After that, i add the following to my <Project>
<!--- [...] --->
<ItemGroup>
<Compile Include="..\..\ANTLR4\MyFancyProject\Language\Antlr\Generated\*.cs">
<Link>Antlr\Generated\%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
</Project> |
Beta Was this translation helpful? Give feedback.
-
Sorry but I've been unable to get back to this project |
Beta Was this translation helpful? Give feedback.
-
Hello!
I'm using
Rider 2022.2 EAP 4
to create a C# lexer/parser for my project, using theANTLR4
plugin. Everything seems to work fine by tweaking the antlr4 settings of each.g4
file, but i notice a minor problem that i cannot overcome:let's say the project's name is
MyProject
, located inside\path\to\Solution\MyProject
. I placed the.g4
files of lexer and parser at\path\to\Solution\MyProject\Antlr
. The namespace of the generated classes isMyProject.Parsing
, with corresponding location\path\to\Solution\MyProject\Parsing
.In order to correctly place the generated classes, my config for
.g4
files should be as follows:Output directory where all output is generated :
\path\to\Solution
Location of imported grammars :
\path\to\Solution\MyProject\Antlr
Grammar file encoding :
utf8
Package/namespace for the generated code :
MyProject.Parsing
Language :
CSharp
The above configuration works okay, but if the project's folder (
MyProject
) were different from project's base namespace (let's say project's base namespace isMyProject.Language
with desired output namespaceMyProject.Language.Parsing
), the generator will not place the generated code to the correct location (the code will be placed at\path\to\Solution\MyProject\Language\Parsing
.Things are getting even worse if the project's folder has a different name whatsoever (code is not being placed to the project's tree at all).
Is there any way to "decouple" namespace and output directory, or some other workaround?
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions