[antlr-interest] Problem with integrating ANTLR with XAML

Sam Harwell sam at tunnelvisionlabs.com
Wed Jul 18 09:22:41 PDT 2012


I was able to reproduce and solve this problem based on additional
information Glenn sent me.

The build problem with XAML documents will be fixed in the next release of
the C# port of ANTLR 3. In the meantime, you can replace the Antlr3.targets
file from the 3.4.1.9004 release with the attached version which should be
properly working.

Thanks,
--
Sam Harwell
Owner, Lead Developer
http://tunnelvisionlabs.com

-----Original Message-----
From: Sam Harwell [mailto:sam at tunnelvisionlabs.com] 
Sent: Tuesday, July 17, 2012 4:16 PM
To: 'Glenn Rowe (Orders)'; 'antlr-interest at antlr.org'
Subject: RE: [antlr-interest] Problem with integrating ANTLR with XAML

The IntelliSense issue is corrected in the latest release of the editor
extensions. You should be able to update the extension automatically within
the Visual Studio 2010 Extension Manager.

I'm not sure what the issue with the project is. Can you send me an example
project which I can use to reproduce this problem (directly to me, not to
the mailing list)?

Thanks,
--
Sam Harwell
Owner, Lead Developer
http://tunnelvisionlabs.com

-----Original Message-----
From: Glenn Rowe (Orders) [mailto:orders at glennrowe.net] 
Sent: Tuesday, July 17, 2012 2:01 PM
To: 'Sam Harwell'; antlr-interest at antlr.org
Subject: RE: [antlr-interest] Problem with integrating ANTLR with XAML

I've checked the points you mention and can confirm that I've implemented
sections 1.4 and 2.1 as stated in the docs. (I had placed the Reference
folder in a central location so I could refer to it from multiple projects
without having to copy it to each new project directory, but I've tried it
with a local copy and it made no difference - I still get the build errors.)
The default properties (Build Action and Custom Tool) of .g files in Visual
Studio are set to the correct ones, so I didn't need to change them.

[Aside: Actually, on the subject of Intellisense, there does appear to be a
bug in the Visual Studio installer, since a file is not installed correctly,
and the Intellisense wouldn't work. To fix it, I opened the vsix file
manually (in WinRar) and copied the file
Tvl.VisualStudio.Shell.OutputWindow.Interfaces.dll to C:\Program Files
(x86)\Microsoft Visual Studio
10.0\Common7\IDE\CommonExtensions\Microsoft\Editor]

Anyway, back to the main points...
Yes, I'm using 3.4.1.9004 version, and no, I didn't make any changes to the
.targets file.

Thanks again,
Glenn.

> -----Original Message-----
> From: Sam Harwell [mailto:sam at tunnelvisionlabs.com]
> Sent: 17 July 2012 18:49
> To: 'Glenn Rowe (Orders)'; antlr-interest at antlr.org
> Subject: RE: [antlr-interest] Problem with integrating ANTLR with XAML
> 
> A few more questions:
> 
> Did you follow the instructions in the Documentation section here? In 
> particular, can you verify that sections 1.4 and 2.1 were incorporated 
> correctly?
> http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases
> 
> Are you using the 3.4.1.9004 release of the C# port of ANTLR 3?
> 
> Did you make any changes to the .targets file from the one included in 
> the Releases listed on that page?
> 
> Thanks,
> --
> Sam Harwell
> Owner, Lead Developer
> http://tunnelvisionlabs.com
> 
> 
> -----Original Message-----
> From: Glenn Rowe (Orders) [mailto:orders at glennrowe.net]
> Sent: Tuesday, July 17, 2012 11:48 AM
> To: 'Sam Harwell'; antlr-interest at antlr.org
> Subject: RE: [antlr-interest] Problem with integrating ANTLR with XAML
> 
> Hi Sam:
> 
> I don't try to reference FormulaLexer or FormulaParser in the XAML 
> file,
but I
> need some of the other classes in the FormulaPlotter namespace in the 
> XAML. I've tried putting the ANTLR stuff in a different namespace from 
> the MainWindow stuff, but it doesn't help.
> I've also tried putting the C# code that references the ANTLR stuff in 
> a separate namespace from MainWindow but that didn't help either.
> 
> Basically, the program has a DataGrid which is data-bound to a 
> DataTable,
in
> which I store the strings representing the formulas to be plotted and 
> the colour of the plot line and so on. The user enters the formula and 
> colour
in
> the DataGrid in the GUI and these are connected to the DataTable via 
> data binding.
> So I'd like to be able to refer to the DataTable in the XAML in order 
> to
bind
> some of the display properties to entries in the DataTable.
> 
> The errors cause the build to fail. I know that sometimes ANTLR will 
> show errors in the errors window which go away when you do a build, 
> but these errors are 'real'
> errors
> that cause a build fail.
> 
> > -----Original Message-----
> > From: Sam Harwell [mailto:sam at tunnelvisionlabs.com]
> > Sent: 17 July 2012 17:38
> > To: 'Glenn Rowe (Orders)'; antlr-interest at antlr.org
> > Subject: RE: [antlr-interest] Problem with integrating ANTLR with 
> > XAML
> >
> > Hi Glenn,
> >
> > I have a couple questions to get started:
> >
> > 1. Are you trying to reference FormulaLexer within the XAML file, or 
> > does
> it
> > just happen to be located in the namespace FormulaPlotter?
> > 2. Are the errors causing the build to fail, or simply showing in 
> > the
> errors
> > window while editing your project?
> >
> > Thanks,
> > --
> > Sam Harwell
> > Owner, Lead Developer
> > http://tunnelvisionlabs.com
> >
> > -----Original Message-----
> > From: Glenn Rowe (Orders) [mailto:orders at glennrowe.net]
> > Sent: Tuesday, July 17, 2012 9:56 AM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] Problem with integrating ANTLR with XAML
> >
> > I'm relatively new to ANTLR and as a test I wrote a sample program 
> > that
> uses
> > ANTLR to define a grammar that allows
> >
> > mathematical expressions such as x^2 + 4*x*cos(x) to be entered and 
> > then have a graph of the function drawn.
> >
> > The program is written in C# using WPF and XAML to define the 
> > layout, and uses the ANTLR3 plugin for Visual Studio 2010.
> >
> >
> >
> > Everything works fine unless I try to define an xmlns namespace 
> > alias for
> the
> > local namespace in which the program's code is written
> >
> > in MainWindow.xaml. That is, I add the line
> >
> >
> >
> > xmlns:local="clr-namespace:FormulaPlotter"
> >
> >
> >
> > to the Window tag at the start of the XAML file, where 
> > FormulaPlotter is
> the
> > namespace of my code. Doing this generates 8
> >
> > errors of the sort
> >
> >
> >
> > FormulaLexer does not have a constructor with 1 argument (although 
> > it
> > does)
> >
> > start() method not found
> >
> >
> >
> > and other errors complaining about constructors or methods in the 
> > lexer or parser not being found.
> >
> >
> >
> > The only workaround I have found for this is to write the relevant 
> > bits of
> the
> > program in the C# code-behind file,
> >
> > which is quite awkward for some of the stuff I want to do.
> >
> >
> >
> > Does anyone know of a fix for this problem?
> >
> > Thanks.
> >
> > Glenn.
> >
> >
> >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> > http://www.antlr.org/mailman/options/antlr-interest/your-email-addre
> > ss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Antlr3.targets.zip
Type: application/octet-stream
Size: 2209 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20120718/6d465103/attachment.obj 


More information about the antlr-interest mailing list