meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
code_injection_in_javacc_21 [2020/02/09 19:51] – [Code Injection] revuskycode_injection_in_javacc_21 [2020/09/29 10:24] (current) – [1. An INJECT block that specifies the class name] revusky
Line 10: Line 10:
 This form a class (or interface) name and looks something like this: This form a class (or interface) name and looks something like this:
  
-   INJECT(Foobar +   INJECT Foobar :  
-    +      import foo.bar.IFoobar
-      import foo.bar.Foobar+
       implements IFoobar;       implements IFoobar;
-    
        
        private Foo value;        private Foo value;
Line 23: Line 21:
 The above snippet should be self-explanatory. The INJECT statement specifies the class in which to inject the code. In this example, it is ''Foobar''. The first block after the colon is a prologue in which you can specify imports as well as en extends and/or an implements clause. The second block contains the actual code to be injected in the type declaration itself. The above snippet should be self-explanatory. The INJECT statement specifies the class in which to inject the code. In this example, it is ''Foobar''. The first block after the colon is a prologue in which you can specify imports as well as en extends and/or an implements clause. The second block contains the actual code to be injected in the type declaration itself.
  
-Since an INJECT block can be placed anywhere in your grammar file where you could put a production, you would naturally tend to place the above snippet next to the relevant BNF production, which would, of course, be the ''Foobar()'' production. +Since an INJECT block can be placed anywhere in your grammar file where you could put a production, you would naturally tend to place the above snippet next to the relevant BNF production, which would, of course, be the ''Foobar'' production. 
  
 ===== 2. The INJECT block with no type specified ===== ===== 2. The INJECT block with no type specified =====