[antlr-interest] ANTLR build step problem (using MS Visual Studio2008, C#)
Sam Harwell
sharwell at pixelminegames.com
Sun Jan 18 10:41:12 PST 2009
Add the following in your .csproj:
<PropertyGroup>
<UseHostCompilerIfAvailable>False</UseHostCompilerIfAvailable>
</PropertyGroup>
Sam
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Ed Key
Sent: Sunday, January 18, 2009 9:58 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] ANTLR build step problem (using MS Visual
Studio2008, C#)
Hi All,
I've just finished integrating an ANTLR step into my C# project and
everything is very nice and neat except for one thing: When I build, the
lexer/parser generation seems to be one step behind the build, even
though it is being done before the C# code is compiled.
For example, starting with a working .G file, I introduce a deliberate
error, in the @members section, e.g. just putting the word "typo"
I then hit F6 and build - everything succeeds.
I then hit build again - I now get the expected error: "Member modifier
'public' must precede the member type and name"
Below are the (hopefully) relevent bits of the vcproj file:
The generated C# lexer/parser files:
<Compile Include="UI\WuweiUILexer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>WuweiUI.g</DependentUpon>
</Compile>
<Compile Include="UI\WuweiUIParser.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>WuweiUI.g</DependentUpon>
</Compile>
The grammar file:
<ItemGroup>
<Antlr3 Include="UI\WuweiUI.g">
<OutputFiles>WuweiUILexer.cs;WuweiUIParser.cs</OutputFiles>
</Antlr3>
</ItemGroup>
The pre-build step:
<PropertyGroup>
<PreBuildEvent>java -classpath
"$(ProjectDir)..\..\antlr\antlrworks-1.2.2.jar" org.antlr.Tool
-message-format vs2005 "$(ProjectDir)@(Antlr3)"</PreBuildEvent>
</PropertyGroup>
I've tried various tweaks to the vcproj file but with no success. The
pre-build step was previously set up as in
http://www.antlr.org/wiki/display/ANTLR3/Integration+with+Development+En
vironments, but this did not work with spaces in $(ProjectDir). (There
may be a solution to this sub-problem but it's outside of my limited XML
knowledge....)
Thanks in advance for any help or information!
Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090118/62bff195/attachment.html
More information about the antlr-interest
mailing list