Problem creating new primitive

Topics: Gesture Definition
May 25, 2011 at 11:47 PM

Hi Shahed,

I've followed the instructions in  (http://gesturetoolkit.codeplex.com/wikipage?title=How%20to%20create%20a%20new%20primitive%20condition&referringTitle=Documentation)

to create a new primitive but after editing the PrimitiveConditions.pd and PrimitiveConditionSyntax.pd files i got the following error when I try to compile

Compile complete -- 0 errors, 1 warnings  ..\  bin\Debug\  DemoApp  Loading language grammar...  Building parser from language...  Failed to compile GDL ....  DemoApp -> C:\Users\ASE\Documents\Visual Studio 2010\Projects\DemoApp\DemoApp\bin\Debug\DemoApp.exe

 

Those are the contents of my files:

PrimitiveConditions.pd 

 

/* Define one primitive condition per line. 
 *    
 * For example:
 *  | r: ClosedLoop => r
 *  | r: MyPrimitiveCon02 => r

   */
 | r : "angleBetween" => r


 

 

(If I don't define the syntax for shape here, I got an error saying:  Exception while parsing to xaml: (10,9): error 5007: Token ValidName with text "angleBetween" unexpected.)

PrimitiveConditionSyntax.pd

 

/*
 *  Add the parsing logic for new PreConditions here separated by new lines. 
 *
 *  For example:
 *       syntax PerpendicularTo
 *           = g1:ValidName "perpendicularTo" g2:ValidName
 *           => PerpendicularTo {Gesture1=>g1, Gesture2=>g2};
 *           
 *       syntax TouchShape
 *           = "Touch shape" ":" s:Shape
 *           =>TouchShape{Values=>s};
*/

 syntax angleBetween
	=  g1:ValidName "angleBetween" g2:ValidName	
	=> angleBetween {Gesture1=>g1, Gesture2=>g2};
	

 syntax TouchShape
            = "Touch shape" ":" s:Shape
            =>TouchShape{Values=>s};

 

my Gesture Definition

name: check1

validate as line1
    Touch state: TouchUp and
	Touch shape: Line and
validate as line2
	  Touch state: TouchUp and
	  Touch shape: Line and
 validate
  line1 angleBetween line2     

return
    	Touch paths

 

 

 

 

Any idea about what the problem might be? 

 

 

Thanks

Coordinator
May 26, 2011 at 1:44 AM
Edited May 26, 2011 at 1:45 AM

Hi Tulio,

You followed the right steps. However, Would you please double check if you have added "AngleBetween" and "AngleBetweenValidator" classes under the same namespace of your project. It should be under your project namespace (not under framework namespaces).

By the way, you can fork the source code anytime from http://gesturetoolkit.codeplex.com/SourceControl/network/create/fork and maintain a independent branch for your code.

May 27, 2011 at 11:33 PM

Hi Shahed!

Yes, the files are under the project namespace.

 

Coordinator
May 28, 2011 at 12:15 AM

hmm... thats interesting. It should automatically pick the right classes and add into the runtime. I will try to reproduce you scenario in the weekend and let you know.