meta data for this page
  •  

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
new_syntax_summary [2020/07/19 13:15] – external edit 127.0.0.1new_syntax_summary [2020/09/26 23:43] – [New "up to here" syntax] revusky
Line 1: Line 1:
-====== Summary of the Newer Streamline Syntax ======+====== Overview of the Newer Streamlined Syntax ======
  
 The following is a summary of the newer streamlined syntax that was recently [[https://javacc.com/2020/07/07/announce-new-syntax/|announced here.]] The following is a summary of the newer streamlined syntax that was recently [[https://javacc.com/2020/07/07/announce-new-syntax/|announced here.]]
  
-I anticipate that there will be a utility available that automatically converts the legacy syntax to the streamlined syntax. In any case, there is no need to manually convert all of your code to the more streamlined syntax, since all the legacy syntax continues to work. Moreover, the two syntaxes can co-exist perfectly well in the same file.+I anticipate that there will soon be a utility available that automatically converts the legacy syntax to the streamlined syntax. In any case, there is no need to manually convert all of your code to the more streamlined syntax, since all the legacy syntax continues to work. Moreover, the two syntaxes can co-exist perfectly well in the same file.
  
-This page does not describe the new ''%%SCAN%%'' construct which is meant to supersede ''%%LOOKAHEAD%%''. That will be outlined separately. 
  
 ===== Nonterminals ===== ===== Nonterminals =====
Line 75: Line 74:
  
 </code> </code>
-This is considered preferable, not because it saves much space (it doesn't!) but because one aspect of the newer syntax is that the ''%%{...}%%'' are reserved for elements that really are embedded Java actions. As you can see, in the newer syntax for BNF productions, the only use of ''%%{...}%%'' is for+This is considered preferable, not because it saves much space (it doesn't!) but because one aspect of the newer syntax is that the ''%%{...}%%'' are reserved for elements that really are embedded Java actions. As you can see, in the newer syntax for BNF productions, the only use of ''%%{...}%%'' is for actual Java code. 
  
 ===== The Options at the top of a file do not need to be in any sort of block. ===== ===== The Options at the top of a file do not need to be in any sort of block. =====
Line 125: Line 124:
 <code> <code>
  INJECT MyNode :  INJECT MyNode :
-     import java.util.*;+     import java.util.List;
      extends AbstractBaseNode      extends AbstractBaseNode
      implements Nullable      implements Nullable
Line 133: Line 132:
     public List<Foo> getFoos() {return foos;}     public List<Foo> getFoos() {return foos;}
          
-    public void setFoos() {this.foos = foos;}+    public void setFoos(List<Foo> foos) {this.foos = foos;}
 } }
  
Line 141: Line 140:
 ===== New SCAN construct which replaces LOOKAHEAD ===== ===== New SCAN construct which replaces LOOKAHEAD =====
  
-This will be detailed in a separate page.+The new ''SCAN'' instruction is designed to supersede the legacy ''LOOKAHEAD''. See [[scan statement|here]] for more information. 
 + 
 +===== New "up to here" syntax ===== 
 + 
 +The [[up to here]] syntax provides a way to specify [[choice points|lookahead]] in a much more clean, intuitive way. See [[up to here|here]] for more information.