add more & need C/C++ code recognition
[cdsspec-compiler.git] / grammer / spec-compiler.jj
index f7a4248d377c41f64cb7ef3c7b69009e29432d18..110dcb9c4979d84b5c8f4322ffef46e91a171a6f 100644 (file)
@@ -151,15 +151,25 @@ TOKEN :
 |
        <#LETTER: ["a"-"z", "A"-"Z"]>
 |
-       <IDENTIFIER: <LETTER> (<LETTER> | <DIGIT> | "_")>       
+       <IDENTIFIER: <LETTER> (<LETTER> | <DIGIT> | "_")*>
+|
+       <EQUALS: "=">
+|
+       <LEFT_PARAN: "{">
+|
+       <RIGHT_PARAN: "}">
+|
+       <HB_SYMBOL: "->">
+|
+       <COMMA: ",">
 }
 
 void Start() :
 {}
 {
        //Global_construct() <EOF>
-       <EOF>
-       //<IDENTIFIER> <EOF>
+       <IDENTIFIER> <EOF>
+       //<IDENTIFIER> C_CPP_CODE() <EOF>
 }
 
 void Global_construct() :
@@ -167,33 +177,36 @@ void Global_construct() :
 {
        <HEAD>
                <BEGIN> 
-                       //Global_define() (Interface_cluster())? (Happens_before())?
+                       Global_define() (Interface_cluster())? (Happens_before())?
                <END>
        <TAIL>
 }
 
+/*
 void C_CPP_CODE() :
-{String code;}
+{}
 {
        <(~["@"])+>
 }
-
+*/
 void Global_define() :
 {}
 {
-       <GLOBAL_DEFINE> C_CPP_CODE()
+       <GLOBAL_DEFINE> //C_CPP_CODE()
 }
 
 void Conditional_interface() :
 {}
 {
-       <IDENTIFIER> (<"(" <IDENTIFIER> ")"> | "")
+       <IDENTIFIER> (<"(" <IDENTIFIER> ")">)*
 }
 
 void Interface_cluster() :
 {}
 {
-       <IDENTIFIER> "=" "{" Conditional_interface() (",," Conditional_interface())* "}"
+       <IDENTIFIER> <EQUALS> <LEFT_PARAN>
+               Conditional_interface() (<COMMA> Conditional_interface())*
+       <RIGHT_PARAN>
 }
 
 void Interface_clusters() :
@@ -205,7 +218,7 @@ void Interface_clusters() :
 void Happens_before() :
 {}
 {
-       <HAPPENS_BEFORE> (Conditional_interface()  "->" Conditional_interface())+
+       <HAPPENS_BEFORE> (Conditional_interface() <HB_SYMBOL> Conditional_interface())+
 }
 
 void Interface() :