1 /* spec-compiler.jj Grammer definition for the specification */
6 Each construct should be embraced by /DOUBLE_STAR ... STAR/ annotation.
7 Within there, any line beginning with a "#" is a comment of the annotation.
8 Each constrcut should begin with @Begin and end with @End. Otherwise, the
9 annotation would be considered as normal comments of the source.
14 # If LANG is not define, it's C++ by default. C does not support class
15 # and template, so if it's defined as C, we should also have a explicit
31 b) Interface construct
35 IDENTIFIER | IDENTIFIER ...
36 @Condition: ... (Optional)
38 IDENTIFIER :: <C_CPP_Condition>
40 @ID: ... (Optional, use default ID)
45 @Post_action: (Optional)
46 @Post_check: (Optional)
49 c) Potential commit construct
51 @Potential_commit_point_define: ...
58 @Potential_additional_ordering_point_define: ...
62 d) Commit point define construct
64 @Commit_point_define_check: ...
70 # Addition ordering point is used to order operations when there are "equal"
71 # commit point operations on the same location and that we cannot decide
72 # which operation goes first, we will use additional ordering point to order
73 # them (it's just similar to commit points). In implementation, we can just
74 # treat them as commit points with a special flag.
77 @Additional_ordering_point_define: ...
78 @Potential_additional_ordering_point_label: ...
85 @Additional_ordering_point_define: ...
92 @Additional_ordering_point_define_check: ...
96 // Commit point clear (just as a normal commit point, but it is used to
97 // clear all commit points)
99 @Commit_point_clear: ...
103 e) Entry point construct
108 f) Interface define construct
110 @Interface_define: <Interface_Name>
113 g) Interface declare & define construct
115 @Interface_decl_define: <Interface_Name>
117 IDENTIFIER | IDENTIFIER ...
118 @Condition: ... (Optional)
120 IDENTIFIER :: <C_CPP_Condition>
122 @ID: ... (Optional, use default ID)
127 @Post_action: (Optional)
128 @Post_check: (Optional)
137 JAVA_UNICODE_ESCAPE = true;
140 PARSER_BEGIN(SpecParser)
141 package edu.uci.eecs.specCompiler.grammerParser;
143 import java.io.FileInputStream;
144 import java.io.FileNotFoundException;
145 import java.io.InputStream;
146 import java.io.ByteArrayInputStream;
148 import java.util.ArrayList;
149 import java.util.HashMap;
150 import java.util.HashSet;
151 import java.util.Arrays;
153 import edu.uci.eecs.specCompiler.specExtraction.Construct;
154 import edu.uci.eecs.specCompiler.specExtraction.GlobalConstruct;
155 import edu.uci.eecs.specCompiler.specExtraction.InterfaceConstruct;
156 import edu.uci.eecs.specCompiler.specExtraction.PotentialCPDefineConstruct;
157 import edu.uci.eecs.specCompiler.specExtraction.CPDefineConstruct;
158 import edu.uci.eecs.specCompiler.specExtraction.CPDefineCheckConstruct;
159 import edu.uci.eecs.specCompiler.specExtraction.CPClearConstruct;
160 import edu.uci.eecs.specCompiler.specExtraction.ConditionalInterface;
161 import edu.uci.eecs.specCompiler.specExtraction.SequentialDefineSubConstruct;
162 import edu.uci.eecs.specCompiler.specExtraction.InterfaceDefineConstruct;
163 import edu.uci.eecs.specCompiler.specExtraction.EntryPointConstruct;
164 import edu.uci.eecs.specCompiler.specExtraction.ClassBeginConstruct;
165 import edu.uci.eecs.specCompiler.specExtraction.ClassEndConstruct;
166 import edu.uci.eecs.specCompiler.specExtraction.FunctionHeader;
167 import edu.uci.eecs.specCompiler.specExtraction.QualifiedName;
168 import edu.uci.eecs.specCompiler.specExtraction.SourceFileInfo;
169 import edu.uci.eecs.specCompiler.specExtraction.VariableDeclaration;
171 public class SpecParser {
172 private static ArrayList<String> _content;
173 private static File _file;
174 private static ArrayList<Construct> _constructs;
177 public static void main(String[] argvs)
178 throws ParseException, TokenMgrError {
180 File f = new File("./grammer/spec1.txt");
181 FileInputStream fis = new FileInputStream(f);
182 SpecParser parser = new SpecParser(fis);
184 ArrayList<String> content = new ArrayList<String>();
185 ArrayList<Construct> constructs = new ArrayList<Construct>();
186 ArrayList<String> headers = new ArrayList<String>();
187 parser.Parse(f, content, constructs, headers);
188 for (int i = 0; i < content.size(); i++) {
189 System.out.println(content.get(i));
192 for (int i = 0; i < constructs.size(); i++) {
193 System.out.println(constructs.get(i));
198 System.out.println("Parsing finished!");
199 } catch (FileNotFoundException e) {
204 public static SourceFileInfo ParseFile(File f)
205 throws ParseException, TokenMgrError {
207 InputStream input = new FileInputStream(f);
208 SpecParser parser = new SpecParser(input);
209 ArrayList<String> content = new ArrayList<String>(),
210 headers = new ArrayList<String>();
211 ArrayList<Construct> constructs = new ArrayList<Construct>();
212 parser.Parse(f, content, constructs, headers);
213 return new SourceFileInfo(f, content, headers, constructs);
214 } catch (FileNotFoundException e) {
221 private static ArrayList<String> breakLines(String all) {
222 String lines[] = all.split("[\\r\\n]+");
223 return new ArrayList<String>(Arrays.asList(lines));
227 public static ArrayList<VariableDeclaration> getTemplateArg(String line)
228 throws ParseException {
229 InputStream input = new ByteArrayInputStream(line.getBytes());
230 SpecParser parser = new SpecParser(input);
231 return parser.TemplateParamList();
234 public static FunctionHeader parseFuncHeader(String line)
235 throws ParseException {
236 InputStream input = new ByteArrayInputStream(line.getBytes());
237 SpecParser parser = new SpecParser(input);
238 return parser.FuncDecl();
242 public static String stringArray2String(ArrayList<String> content) {
243 StringBuilder sb = new StringBuilder();
244 if (content.size() == 1)
245 return content.get(0);
246 for (int i = 0; i < content.size(); i++) {
247 sb.append(content.get(i) + "\n");
249 return sb.toString();
253 boolean spaceSeparator(Token t) {
302 PARSER_END(SpecParser)
306 <IN_POTENTIAL_SPEC, IN_SPEC> SKIP :
320 "/**" : IN_POTENTIAL_SPEC
323 <IN_POTENTIAL_SPEC> TOKEN : {
324 <BEGIN: "@Begin"> : IN_SPEC
340 // "//" comment for the specification
341 <"//" (~["\n", "\r"])* (["\n", "\r"])>
344 <IN_COMMENT, IN_POTENTIAL_SPEC> SKIP : {
348 <IN_COMMENT, IN_POTENTIAL_SPEC> SKIP : { < ~[] > }
352 // "#" comment for the specification
353 <"#" (~["\n", "\r"])* (["\n", "\r"])>
360 <OPTIONS: "@Options:">
362 <GLOBAL_DEFINE: "@Global_define:">
364 <DECLARE_STRUCT: "@DeclareStruct:">
366 <DECLARE_VAR: "@DeclareVar:">
368 <INIT_VAR: "@InitVar:">
370 <CLEANUP: "@Cleanup:">
372 <DEFINE_FUNC: "@DefineFunc:">
374 <INTERFACE_CLUSTER: "@Interface_cluster:">
376 <HAPPENS_BEFORE: "@Happens_before:">
378 <INTERFACE: "@Interface:">
380 <COMMIT_POINT_SET: "@Commit_point_set:">
382 <ENTRY_POINT: "@Entry_point">
384 <CLASS_BEGIN: "@Class_begin">
386 <CLASS_END: "@Class_end">
388 <INTERFACE_DEFINE: "@Interface_define:">
390 <CONDITION: "@Condition:">
392 <HB_CONDITION: "@HB_condition:">
402 <POST_ACTION: "@Post_action:">
404 <POST_CHECK: "@Post_check:">
406 <POTENTIAL_COMMIT_POINT_DEFINE: "@Potential_commit_point_define:">
408 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE: "@Potential_additional_ordering_point_define:">
412 <COMMIT_POINT_DEFINE_CHECK: "@Commit_point_define_check:">
414 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK: "@Additional_ordering_point_define_check:">
416 <COMMIT_POINT_DEFINE: "@Commit_point_define:">
418 <ADDITIONAL_ORDERING_POINT_DEFINE: "@Additional_ordering_point_define:">
420 <COMMIT_POINT_CLEAR: "@Commit_point_clear:">
422 <POTENTIAL_COMMIT_POINT_LABEL: "@Potential_commit_point_label:">
424 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL: "@Potential_additional_ordering_point_label:">
430 /* Specification & C/C++ shared tokens */
438 <UNSIGNED: "unsigned">
440 <TEMPLATE: "template">
450 <#LETTER: ["a"-"z", "A"-"Z"]>
452 <IDENTIFIER: (<LETTER> | "_") (<LETTER> | <DIGIT> | "_")*>
474 /* C/C++ only token*/
507 <GREATER_EQUALS: ">=">
511 <LOGICAL_EQUALS: "==">
527 <DOUBLELESSTHAN: "<<">
529 <DOUBLEGREATERTHAN: ">>">
531 <TRIPLEGREATERTHAN: ">>>">
539 <DIVIDE_EQUALS: "/=">
553 ((~["\"","\\","\n","\r"])
555 ( ["n","t","b","r","f","\\","'","\""]
556 | ["0"-"7"] ( ["0"-"7"] )?
557 | ["0"-"3"] ["0"-"7"]
566 ((~["'","\\","\n","\r"])
568 (["n","t","b","r","f","\\","'","\""]
569 | ["0"-"7"] ( ["0"-"7"] )?
570 | ["0"-"3"] ["0"-"7"]
578 <DECIMAL_LITERAL> (["l","L"])?
579 | <HEX_LITERAL> (["l","L"])?
580 | <OCTAL_LITERAL> (["l","L"])?>
582 < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
584 < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
586 < #OCTAL_LITERAL: "0" (["0"-"7"])* >
588 < FLOATING_POINT_LITERAL:
589 <DECIMAL_FLOATING_POINT_LITERAL>
590 | <HEXADECIMAL_FLOATING_POINT_LITERAL> >
592 < #DECIMAL_FLOATING_POINT_LITERAL:
593 (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
594 | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
595 | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])?
596 | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]>
598 < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
600 < #HEXADECIMAL_FLOATING_POINT_LITERAL:
601 "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
602 | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?>
604 < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ >
606 < #SPACE: (" " | "\t")+>
608 < #TO_END_OF_LINE: (~["\n"])+>
611 <INCLUDE: "#" (<SPACE>)? "include" <SPACE> (<STRING_LITERAL> | "<" (<LETTER> | <DOT>)+ ">")>
613 <DEFINE: "#" (<SPACE>)? <TO_END_OF_LINE>>
627 (((str = <STRUCT>.image | str = <CLASS>.image | str = <UNSIGNED>.image) { type = type + " " + str; })?
629 name = ParseQualifiedName() {
630 if (!type.equals(""))
631 type = type + " " + name.fullName;
633 type = name.fullName;
636 ((str = <CONST>.image {
637 if (!type.equals(""))
638 type = type + " " + str;
642 (str = <STAR>.image {
643 if (!type.equals(""))
644 type = type + " " + str;
649 if (!type.equals(""))
650 type = type + " " + str;
661 String ParameterizedName() :
667 (str = <IDENTIFIER>.image {res = str;})
668 (<OPEN_BRACKET> str = Type() { res = res + "<" + str; }
669 (<COMMA> str = Type() { res = res + ", " + str; })* <CLOSE_BRACKET>
677 FunctionHeader FuncDecl() :
680 QualifiedName funcName;
681 ArrayList<VariableDeclaration> args;
684 (<STATIC> | <INLINE>)*
686 funcName = ParseQualifiedName()
687 args = FormalParamList()
689 FunctionHeader res = new FunctionHeader(ret, funcName, args);
690 //System.out.println(res);
695 QualifiedName ParseQualifiedName() :
697 String qualifiedName, str;
700 { qualifiedName = ""; }
701 (str = ParameterizedName() { qualifiedName = qualifiedName + str; } )
702 ( <DOUBLECOLON> (str = ParameterizedName() { qualifiedName = qualifiedName +
705 QualifiedName res = new QualifiedName(qualifiedName);
706 //System.out.println(res);
711 ArrayList<VariableDeclaration> TemplateParamList() :
713 ArrayList<VariableDeclaration> params;
719 params = new ArrayList<VariableDeclaration>();
723 (type = <IDENTIFIER>.image
724 name = <IDENTIFIER>.image
726 params.add(new VariableDeclaration(type, name));
730 (<COMMA> type = <IDENTIFIER>.image
731 name = <IDENTIFIER>.image
733 params.add(new VariableDeclaration(type, name));
738 //System.out.println(params);
743 ArrayList<VariableDeclaration > FormalParamList() :
745 ArrayList<VariableDeclaration > typeParams;
746 VariableDeclaration varDecl;
750 typeParams = new ArrayList<VariableDeclaration >();
753 ((varDecl = TypeParam() {typeParams.add(varDecl);})
754 ((<COMMA> varDecl = TypeParam() {typeParams.add(varDecl);}))*)?
761 VariableDeclaration TypeParam() :
766 (type = Type()) (param = <IDENTIFIER>.image)
768 return new VariableDeclaration(type, param);
774 ArrayList<String> C_CPP_CODE(ArrayList<String> headers) :
778 boolean newLine = false;
779 boolean newSpace = true;
780 boolean inTemplate = false;
781 boolean inForLoop = false;
782 ArrayList<String> content;
789 content = new ArrayList<String>();
794 t = <CONST> | t = <STRUCT> | t = <CLASS> | t = <UNSIGNED> |
795 (t = <TEMPLATE> { inTemplate = true; })|
796 t = <STATIC> | t = <INLINE> |
797 (t = <FOR> { inForLoop = true; })|
802 if (headers != null) {
803 headers.add(header.substring(header.lastIndexOf(' ') + 1));
806 | t = <IDENTIFIER> | t = <POUND> |
807 (t = <OPEN_BRACE> { newLine = true; } ) |
808 (t = <CLOSE_BRACE> { newLine = true; inForLoop = false;} ) |
809 t = <EQUALS> | t = <OPEN_PAREN> | t = <CLOSE_PAREN> |
810 t = <OPEN_BRACKET> | t = <CLOSE_BRACKET>
811 | t = <HB_SYMBOL> | t = <COMMA> |
812 t = <DOT> | t = <STAR> | t = <DOLLAR> | t = <NEGATE> | t = <EXCLAMATION> | t = <AND> | t = <OR> | t = <MOD> | t = <PLUS> |
813 t = <PLUSPLUS> | t = <MINUS> | t = <MINUSMINUS> | t = <DIVIDE> | t = <BACKSLASH> |
815 (t = <GREATER_THAN> { if (inTemplate) newLine = true; }) |
816 t = <GREATER_EQUALS> | t = <LESS_EQUALS> |
817 t = <LOGICAL_EQUALS> | t = <NOT_EQUALS> | t = <LOGICAL_AND> | t = <LOGICAL_OR> | t = <XOR> |
818 t = <QUESTION_MARK> | t = <COLON> | t = <DOUBLECOLON> |
819 t = <DOUBLELESSTHAN> |
820 t = <DOUBLEGREATERTHAN> |
821 t = <TRIPLEGREATERTHAN> |
826 t = <DIVIDE_EQUALS> |
832 (t = <SEMI_COLON> { if (!inForLoop) newLine = true; } )
833 | t = <STRING_LITERAL> | t = <CHARACTER_LITERAL> |
834 t = <INTEGER_LITERAL> | t = <FLOATING_POINT_LITERAL> |
835 (t = <DEFINE> { newLine = true; } )
838 if (text.equals("")) {
842 text = text + " " + t.image;
844 if (newSpace && spaceSeparator(t)) {
845 text = text + " " + t.image;
847 text = text + t.image;
848 if (spaceSeparator(t))
862 if (content.size() == 0) {
870 void Parse(File f, ArrayList<String> content, ArrayList<Construct> constructs, ArrayList<String> headers) :
880 _constructs = constructs;
881 sb = new StringBuilder();
886 _constructs.add(inst);
889 //((code = C_CPP_CODE(headers)) { _content.addAll(code); })
891 flushSB = OriginalCode(sb)
894 sb = new StringBuilder();
899 // For the last piece of code
901 _content.add(sb.toString());
906 // If true, there's a new line and sb should be flushed
907 boolean OriginalCode(StringBuilder sb) :
914 if (!str.equals("\n")) {
918 _content.add(sb.toString());
924 Construct ParseSpec() :
930 LOOKAHEAD(2) res = Global_construct() |
931 LOOKAHEAD(2) res = Interface() |
932 LOOKAHEAD(2) res = Potential_commit_point_define() |
933 LOOKAHEAD(2) res = Commit_point_define() |
934 LOOKAHEAD(2) res = Commit_point_define_check() |
935 LOOKAHEAD(2) res = Potential_additional_ordering_point_define() |
936 LOOKAHEAD(2) res = Additional_ordering_point_define() |
937 LOOKAHEAD(2) res = Additional_ordering_point_define_check() |
938 LOOKAHEAD(2) res = Commit_point_clear() |
939 LOOKAHEAD(2) res = Entry_point() |
940 LOOKAHEAD(2) res = Class_begin() |
941 LOOKAHEAD(2) res = Class_end() |
942 LOOKAHEAD(2) res = Interface_define()
945 //System.out.println(res);
950 GlobalConstruct Global_construct() :
953 SequentialDefineSubConstruct code;
954 HashMap<String, String> options;
960 options = new HashMap<String, String>();
964 ((key = <IDENTIFIER>.image)
966 (value = <IDENTIFIER>.image)
968 if (options.containsKey(key)) {
969 throw new ParseException("Duplicate options!");
971 options.put(key, value);
976 (code = Global_define())
977 { res = new GlobalConstruct(_file, _content.size(), code, options); }
978 (Interface_clusters(res))?
979 (Happens_before(res))?
982 res.unfoldInterfaceCluster();
987 SequentialDefineSubConstruct Global_define() :
989 ArrayList<String> initVar, cleanup, defineFunc, code, declareStruct;
990 ArrayList<ArrayList<String>> defineFuncs;
991 ArrayList<VariableDeclaration> declareVars;
992 ArrayList<ArrayList<String>> declareStructs;
993 VariableDeclaration declareVar;
998 declareVars = new ArrayList<VariableDeclaration>();
999 initVar = new ArrayList<String>();
1000 cleanup = new ArrayList<String>();
1001 defineFuncs = new ArrayList<ArrayList<String>>();
1002 declareStructs = new ArrayList<ArrayList<String>>();
1005 (<DECLARE_STRUCT> (declareStruct = C_CPP_CODE(null) {
1006 declareStructs.add(declareStruct); }))*
1007 (<DECLARE_VAR> ((declareVar = TypeParam() <SEMI_COLON> {
1008 declareVars.add(declareVar); } )*))?
1009 (<INIT_VAR> (code = C_CPP_CODE(null) { initVar = code; } ))?
1010 (<CLEANUP> (code = C_CPP_CODE(null) { cleanup = code; } ))?
1011 (<DEFINE_FUNC> (defineFunc = C_CPP_CODE(null) { defineFuncs.add(defineFunc); }))*
1013 SequentialDefineSubConstruct res = new
1014 SequentialDefineSubConstruct(declareStructs, declareVars, initVar, cleanup, defineFuncs);
1015 //System.out.println(res);
1020 ConditionalInterface Conditional_interface() :
1022 String interfaceName, hbConditionLabel;
1026 hbConditionLabel = "";
1028 interfaceName = <IDENTIFIER>.image (<OPEN_PAREN> hbConditionLabel =
1029 <IDENTIFIER>.image <CLOSE_PAREN>)?
1031 return new ConditionalInterface(interfaceName, hbConditionLabel);
1035 void Interface_cluster(GlobalConstruct inst) :
1038 ConditionalInterface condInterface;
1041 (clusterName= <IDENTIFIER>.image)
1042 <EQUALS> <OPEN_BRACE>
1043 (condInterface = Conditional_interface()
1044 { inst.addInterface2Cluster(clusterName, condInterface); }
1046 (<COMMA> condInterface = Conditional_interface()
1047 { inst.addInterface2Cluster(clusterName, condInterface); }
1052 void Interface_clusters(GlobalConstruct inst) :
1055 <INTERFACE_CLUSTER> (Interface_cluster(inst))+
1058 void Happens_before(GlobalConstruct inst) :
1060 ConditionalInterface left, right;
1065 left = Conditional_interface() <HB_SYMBOL> right = Conditional_interface()
1066 { inst.addHBCondition(left, right); }
1070 InterfaceConstruct Interface() :
1072 InterfaceConstruct res;
1073 String interfaceName, condition, idCode, check,
1074 postCheck, commitPoint, hbLabel, hbCondition;
1075 ArrayList<String> commitPointSet;
1076 ArrayList<String> action, postAction;
1077 HashMap<String, String> hbConditions;
1078 ArrayList<String> content;
1083 action = new ArrayList<String>();
1088 commitPointSet = new ArrayList<String>();
1089 hbConditions = new HashMap<String, String>();
1090 postAction = new ArrayList<String>();
1093 <INTERFACE> (interfaceName = <IDENTIFIER>.image)
1095 (commitPoint = <IDENTIFIER>.image
1096 { commitPointSet.add(commitPoint); }
1099 (commitPoint = <IDENTIFIER>.image)
1101 if (commitPointSet.contains(commitPoint)) {
1102 throw new ParseException(interfaceName + " has" +
1103 "duplicate commit point labels");
1105 commitPointSet.add(commitPoint);
1109 (<CONDITION> (content = C_CPP_CODE(null) { condition = stringArray2String(content); }))?
1112 (hbLabel = <IDENTIFIER>.image) <DOUBLECOLON>
1113 (content = C_CPP_CODE(null) { hbCondition = stringArray2String(content); })
1115 if (hbConditions.containsKey(hbLabel)) {
1116 throw new ParseException(interfaceName + " has" +
1117 "duplicate happens-before condtion labels");
1119 hbConditions.put(hbLabel, hbCondition);
1122 (<ID> (content = C_CPP_CODE(null) { idCode = stringArray2String(content); }))?
1123 (<CHECK> (content = C_CPP_CODE(null) { check = stringArray2String(content); }))?
1124 (<ACTION> action = C_CPP_CODE(null))?
1125 (<POST_ACTION> (postAction = C_CPP_CODE(null) ))?
1126 (<POST_CHECK> (content = C_CPP_CODE(null) { postCheck = stringArray2String(content); }))?
1129 res = new InterfaceConstruct(_file, _content.size(), interfaceName, commitPointSet, condition,
1130 hbConditions, idCode, check, action, postAction, postCheck);
1136 PotentialCPDefineConstruct Potential_commit_point_define() :
1138 PotentialCPDefineConstruct res;
1139 String label, condition;
1140 ArrayList<String> content;
1146 <POTENTIAL_COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1147 <LABEL> (label = <IDENTIFIER>.image)
1150 res = new PotentialCPDefineConstruct(_file, _content.size(), label, condition);
1155 PotentialCPDefineConstruct Potential_additional_ordering_point_define() :
1157 PotentialCPDefineConstruct res;
1158 String label, condition;
1159 ArrayList<String> content;
1165 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1166 <LABEL> (label = <IDENTIFIER>.image)
1169 // Set the boolean flag isAdditionalOrderingPoint to be true
1170 res = new PotentialCPDefineConstruct(_file, _content.size(), true, label, condition);
1176 CPDefineConstruct Commit_point_define() :
1178 CPDefineConstruct res;
1179 String label, potentialCPLabel, condition;
1180 ArrayList<String> content;
1186 <COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1187 <POTENTIAL_COMMIT_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1188 <LABEL> (label = <IDENTIFIER>.image)
1191 res = new CPDefineConstruct(_file, _content.size(), false, label, potentialCPLabel, condition);
1196 CPDefineConstruct Additional_ordering_point_define() :
1198 CPDefineConstruct res;
1199 String label, potentialCPLabel, condition;
1200 ArrayList<String> content;
1206 <ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1207 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1208 <LABEL> (label = <IDENTIFIER>.image)
1211 // Set the boolean flag isAdditionalOrderingPoint to be true
1212 res = new CPDefineConstruct(_file, _content.size(), true, label, potentialCPLabel, condition);
1217 CPClearConstruct Commit_point_clear() :
1219 CPClearConstruct res;
1220 String label, condition;
1221 ArrayList<String> content;
1227 <COMMIT_POINT_CLEAR> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1228 <LABEL> (label = <IDENTIFIER>.image)
1231 res = new CPClearConstruct(_file, _content.size(), label, condition);
1237 CPDefineCheckConstruct Commit_point_define_check() :
1239 CPDefineCheckConstruct res;
1240 String label, condition;
1241 ArrayList<String> content;
1247 <COMMIT_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1248 <LABEL> (label = <IDENTIFIER>.image)
1251 res = new CPDefineCheckConstruct(_file, _content.size(), false, label, condition);
1256 CPDefineCheckConstruct Additional_ordering_point_define_check() :
1258 CPDefineCheckConstruct res;
1259 String label, condition;
1260 ArrayList<String> content;
1266 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1267 <LABEL> (label = <IDENTIFIER>.image)
1270 // Set the boolean flag isAdditionalOrderingPoint to be true
1271 res = new CPDefineCheckConstruct(_file, _content.size(), true, label, condition);
1276 EntryPointConstruct Entry_point() :
1284 return new EntryPointConstruct(_file, _content.size());
1288 ClassBeginConstruct Class_begin() :
1296 return new ClassBeginConstruct(_file, _content.size());
1300 ClassEndConstruct Class_end() :
1308 return new ClassEndConstruct(_file, _content.size());
1312 InterfaceDefineConstruct Interface_define() :
1318 <INTERFACE_DEFINE> (name = <IDENTIFIER>.image)
1321 return new InterfaceDefineConstruct(_file, _content.size(), name);