[antlr-interest] ANTLR build step problem (using MS Visual Studio 2008, C#)

Ed Key ek2138761 at googlemail.com
Sun Jan 18 07:57:51 PST 2009


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+Environments,
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/7937fb4a/attachment.html 


More information about the antlr-interest mailing list