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 <DEFINE_FUNC: "@DefineFunc:">
372 <INTERFACE_CLUSTER: "@Interface_cluster:">
374 <HAPPENS_BEFORE: "@Happens_before:">
376 <INTERFACE: "@Interface:">
378 <COMMIT_POINT_SET: "@Commit_point_set:">
380 <ENTRY_POINT: "@Entry_point">
382 <CLASS_BEGIN: "@Class_begin">
384 <CLASS_END: "@Class_end">
386 <INTERFACE_DEFINE: "@Interface_define:">
388 <CONDITION: "@Condition:">
390 <HB_CONDITION: "@HB_condition:">
400 <POST_ACTION: "@Post_action:">
402 <POST_CHECK: "@Post_check:">
404 <POTENTIAL_COMMIT_POINT_DEFINE: "@Potential_commit_point_define:">
406 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE: "@Potential_additional_ordering_point_define:">
410 <COMMIT_POINT_DEFINE_CHECK: "@Commit_point_define_check:">
412 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK: "@Additional_ordering_point_define_check:">
414 <COMMIT_POINT_DEFINE: "@Commit_point_define:">
416 <ADDITIONAL_ORDERING_POINT_DEFINE: "@Additional_ordering_point_define:">
418 <COMMIT_POINT_CLEAR: "@Commit_point_clear:">
420 <POTENTIAL_COMMIT_POINT_LABEL: "@Potential_commit_point_label:">
422 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL: "@Potential_additional_ordering_point_label:">
428 /* Specification & C/C++ shared tokens */
436 <UNSIGNED: "unsigned">
438 <TEMPLATE: "template">
448 <#LETTER: ["a"-"z", "A"-"Z"]>
450 <IDENTIFIER: (<LETTER> | "_") (<LETTER> | <DIGIT> | "_")*>
472 /* C/C++ only token*/
505 <GREATER_EQUALS: ">=">
509 <LOGICAL_EQUALS: "==">
525 <DOUBLELESSTHAN: "<<">
527 <DOUBLEGREATERTHAN: ">>">
529 <TRIPLEGREATERTHAN: ">>>">
537 <DIVIDE_EQUALS: "/=">
551 ((~["\"","\\","\n","\r"])
553 ( ["n","t","b","r","f","\\","'","\""]
554 | ["0"-"7"] ( ["0"-"7"] )?
555 | ["0"-"3"] ["0"-"7"]
564 ((~["'","\\","\n","\r"])
566 (["n","t","b","r","f","\\","'","\""]
567 | ["0"-"7"] ( ["0"-"7"] )?
568 | ["0"-"3"] ["0"-"7"]
576 <DECIMAL_LITERAL> (["l","L"])?
577 | <HEX_LITERAL> (["l","L"])?
578 | <OCTAL_LITERAL> (["l","L"])?>
580 < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
582 < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
584 < #OCTAL_LITERAL: "0" (["0"-"7"])* >
586 < FLOATING_POINT_LITERAL:
587 <DECIMAL_FLOATING_POINT_LITERAL>
588 | <HEXADECIMAL_FLOATING_POINT_LITERAL> >
590 < #DECIMAL_FLOATING_POINT_LITERAL:
591 (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
592 | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
593 | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])?
594 | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]>
596 < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
598 < #HEXADECIMAL_FLOATING_POINT_LITERAL:
599 "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
600 | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?>
602 < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ >
604 < #SPACE: (" " | "\t")+>
606 < #TO_END_OF_LINE: (~["\n"])+>
609 <INCLUDE: "#" (<SPACE>)? "include" <SPACE> (<STRING_LITERAL> | "<" (<LETTER> | <DOT>)+ ">")>
611 <DEFINE: "#" (<SPACE>)? <TO_END_OF_LINE>>
625 (((str = <STRUCT>.image | str = <CLASS>.image | str = <UNSIGNED>.image) { type = type + " " + str; })?
627 name = ParseQualifiedName() {
628 if (!type.equals(""))
629 type = type + " " + name.fullName;
631 type = name.fullName;
634 ((str = <CONST>.image {
635 if (!type.equals(""))
636 type = type + " " + str;
640 (str = <STAR>.image {
641 if (!type.equals(""))
642 type = type + " " + str;
647 if (!type.equals(""))
648 type = type + " " + str;
659 String ParameterizedName() :
665 (str = <IDENTIFIER>.image {res = str;})
666 (<OPEN_BRACKET> str = Type() { res = res + "<" + str; }
667 (<COMMA> str = Type() { res = res + ", " + str; })* <CLOSE_BRACKET>
675 FunctionHeader FuncDecl() :
678 QualifiedName funcName;
679 ArrayList<VariableDeclaration> args;
682 (<STATIC> | <INLINE>)*
684 funcName = ParseQualifiedName()
685 args = FormalParamList()
687 FunctionHeader res = new FunctionHeader(ret, funcName, args);
688 //System.out.println(res);
693 QualifiedName ParseQualifiedName() :
695 String qualifiedName, str;
698 { qualifiedName = ""; }
699 (str = ParameterizedName() { qualifiedName = qualifiedName + str; } )
700 ( <DOUBLECOLON> (str = ParameterizedName() { qualifiedName = qualifiedName +
703 QualifiedName res = new QualifiedName(qualifiedName);
704 //System.out.println(res);
709 ArrayList<VariableDeclaration> TemplateParamList() :
711 ArrayList<VariableDeclaration> params;
717 params = new ArrayList<VariableDeclaration>();
721 (type = <IDENTIFIER>.image
722 name = <IDENTIFIER>.image
724 params.add(new VariableDeclaration(type, name));
728 (<COMMA> type = <IDENTIFIER>.image
729 name = <IDENTIFIER>.image
731 params.add(new VariableDeclaration(type, name));
736 //System.out.println(params);
741 ArrayList<VariableDeclaration > FormalParamList() :
743 ArrayList<VariableDeclaration > typeParams;
744 VariableDeclaration varDecl;
748 typeParams = new ArrayList<VariableDeclaration >();
751 ((varDecl = TypeParam() {typeParams.add(varDecl);})
752 ((<COMMA> varDecl = TypeParam() {typeParams.add(varDecl);}))*)?
759 VariableDeclaration TypeParam() :
764 (type = Type()) (param = <IDENTIFIER>.image)
766 return new VariableDeclaration(type, param);
772 ArrayList<String> C_CPP_CODE(ArrayList<String> headers) :
776 boolean newLine = false;
777 boolean newSpace = true;
778 boolean inTemplate = false;
779 boolean inForLoop = false;
780 ArrayList<String> content;
787 content = new ArrayList<String>();
792 t = <CONST> | t = <STRUCT> | t = <CLASS> | t = <UNSIGNED> |
793 (t = <TEMPLATE> { inTemplate = true; })|
794 t = <STATIC> | t = <INLINE> |
795 (t = <FOR> { inForLoop = true; })|
800 if (headers != null) {
801 headers.add(header.substring(header.lastIndexOf(' ') + 1));
804 | t = <IDENTIFIER> | t = <POUND> |
805 (t = <OPEN_BRACE> { newLine = true; } ) |
806 (t = <CLOSE_BRACE> { newLine = true; inForLoop = false;} ) |
807 t = <EQUALS> | t = <OPEN_PAREN> | t = <CLOSE_PAREN> |
808 t = <OPEN_BRACKET> | t = <CLOSE_BRACKET>
809 | t = <HB_SYMBOL> | t = <COMMA> |
810 t = <DOT> | t = <STAR> | t = <DOLLAR> | t = <NEGATE> | t = <EXCLAMATION> | t = <AND> | t = <OR> | t = <MOD> | t = <PLUS> |
811 t = <PLUSPLUS> | t = <MINUS> | t = <MINUSMINUS> | t = <DIVIDE> | t = <BACKSLASH> |
813 (t = <GREATER_THAN> { if (inTemplate) newLine = true; }) |
814 t = <GREATER_EQUALS> | t = <LESS_EQUALS> |
815 t = <LOGICAL_EQUALS> | t = <NOT_EQUALS> | t = <LOGICAL_AND> | t = <LOGICAL_OR> | t = <XOR> |
816 t = <QUESTION_MARK> | t = <COLON> | t = <DOUBLECOLON> |
817 t = <DOUBLELESSTHAN> |
818 t = <DOUBLEGREATERTHAN> |
819 t = <TRIPLEGREATERTHAN> |
824 t = <DIVIDE_EQUALS> |
830 (t = <SEMI_COLON> { if (!inForLoop) newLine = true; } )
831 | t = <STRING_LITERAL> | t = <CHARACTER_LITERAL> |
832 t = <INTEGER_LITERAL> | t = <FLOATING_POINT_LITERAL> |
833 (t = <DEFINE> { newLine = true; } )
836 if (text.equals("")) {
840 text = text + " " + t.image;
842 if (newSpace && spaceSeparator(t)) {
843 text = text + " " + t.image;
845 text = text + t.image;
846 if (spaceSeparator(t))
860 if (content.size() == 0) {
868 void Parse(File f, ArrayList<String> content, ArrayList<Construct> constructs, ArrayList<String> headers) :
878 _constructs = constructs;
879 sb = new StringBuilder();
884 _constructs.add(inst);
887 //((code = C_CPP_CODE(headers)) { _content.addAll(code); })
889 flushSB = OriginalCode(sb)
892 sb = new StringBuilder();
897 // For the last piece of code
899 _content.add(sb.toString());
904 // If true, there's a new line and sb should be flushed
905 boolean OriginalCode(StringBuilder sb) :
912 if (!str.equals("\n")) {
916 _content.add(sb.toString());
922 Construct ParseSpec() :
928 LOOKAHEAD(2) res = Global_construct() |
929 LOOKAHEAD(2) res = Interface() |
930 LOOKAHEAD(2) res = Potential_commit_point_define() |
931 LOOKAHEAD(2) res = Commit_point_define() |
932 LOOKAHEAD(2) res = Commit_point_define_check() |
933 LOOKAHEAD(2) res = Potential_additional_ordering_point_define() |
934 LOOKAHEAD(2) res = Additional_ordering_point_define() |
935 LOOKAHEAD(2) res = Additional_ordering_point_define_check() |
936 LOOKAHEAD(2) res = Commit_point_clear() |
937 LOOKAHEAD(2) res = Entry_point() |
938 LOOKAHEAD(2) res = Class_begin() |
939 LOOKAHEAD(2) res = Class_end() |
940 LOOKAHEAD(2) res = Interface_define()
943 //System.out.println(res);
948 GlobalConstruct Global_construct() :
951 SequentialDefineSubConstruct code;
952 HashMap<String, String> options;
958 options = new HashMap<String, String>();
962 ((key = <IDENTIFIER>.image)
964 (value = <IDENTIFIER>.image)
966 if (options.containsKey(key)) {
967 throw new ParseException("Duplicate options!");
969 options.put(key, value);
974 (code = Global_define())
975 { res = new GlobalConstruct(_file, _content.size(), code, options); }
976 (Interface_clusters(res))?
977 (Happens_before(res))?
980 res.unfoldInterfaceCluster();
985 SequentialDefineSubConstruct Global_define() :
987 ArrayList<String> initVar, defineFunc, code, declareStruct;
988 ArrayList<ArrayList<String>> defineFuncs;
989 ArrayList<VariableDeclaration> declareVars;
990 ArrayList<ArrayList<String>> declareStructs;
991 VariableDeclaration declareVar;
996 declareVars = new ArrayList<VariableDeclaration>();
998 defineFuncs = new ArrayList<ArrayList<String>>();
999 declareStructs = new ArrayList<ArrayList<String>>();
1002 (<DECLARE_STRUCT> (declareStruct = C_CPP_CODE(null) {
1003 declareStructs.add(declareStruct); }))*
1004 (<DECLARE_VAR> ((declareVar = TypeParam() <SEMI_COLON> {
1005 declareVars.add(declareVar); } )*))?
1006 (<INIT_VAR> (code = C_CPP_CODE(null) { initVar = code; } ))?
1007 (<DEFINE_FUNC> (defineFunc = C_CPP_CODE(null) { defineFuncs.add(defineFunc); }))*
1009 SequentialDefineSubConstruct res = new
1010 SequentialDefineSubConstruct(declareStructs, declareVars, initVar, defineFuncs);
1011 //System.out.println(res);
1016 ConditionalInterface Conditional_interface() :
1018 String interfaceName, hbConditionLabel;
1022 hbConditionLabel = "";
1024 interfaceName = <IDENTIFIER>.image (<OPEN_PAREN> hbConditionLabel =
1025 <IDENTIFIER>.image <CLOSE_PAREN>)?
1027 return new ConditionalInterface(interfaceName, hbConditionLabel);
1031 void Interface_cluster(GlobalConstruct inst) :
1034 ConditionalInterface condInterface;
1037 (clusterName= <IDENTIFIER>.image)
1038 <EQUALS> <OPEN_BRACE>
1039 (condInterface = Conditional_interface()
1040 { inst.addInterface2Cluster(clusterName, condInterface); }
1042 (<COMMA> condInterface = Conditional_interface()
1043 { inst.addInterface2Cluster(clusterName, condInterface); }
1048 void Interface_clusters(GlobalConstruct inst) :
1051 <INTERFACE_CLUSTER> (Interface_cluster(inst))+
1054 void Happens_before(GlobalConstruct inst) :
1056 ConditionalInterface left, right;
1061 left = Conditional_interface() <HB_SYMBOL> right = Conditional_interface()
1062 { inst.addHBCondition(left, right); }
1066 InterfaceConstruct Interface() :
1068 InterfaceConstruct res;
1069 String interfaceName, condition, idCode, check,
1070 postCheck, commitPoint, hbLabel, hbCondition;
1071 ArrayList<String> commitPointSet;
1072 ArrayList<String> action, postAction;
1073 HashMap<String, String> hbConditions;
1074 ArrayList<String> content;
1079 action = new ArrayList<String>();
1084 commitPointSet = new ArrayList<String>();
1085 hbConditions = new HashMap<String, String>();
1086 postAction = new ArrayList<String>();
1089 <INTERFACE> (interfaceName = <IDENTIFIER>.image)
1091 (commitPoint = <IDENTIFIER>.image
1092 { commitPointSet.add(commitPoint); }
1095 (commitPoint = <IDENTIFIER>.image)
1097 if (commitPointSet.contains(commitPoint)) {
1098 throw new ParseException(interfaceName + " has" +
1099 "duplicate commit point labels");
1101 commitPointSet.add(commitPoint);
1105 (<CONDITION> (content = C_CPP_CODE(null) { condition = stringArray2String(content); }))?
1108 (hbLabel = <IDENTIFIER>.image) <DOUBLECOLON>
1109 (content = C_CPP_CODE(null) { hbCondition = stringArray2String(content); })
1111 if (hbConditions.containsKey(hbLabel)) {
1112 throw new ParseException(interfaceName + " has" +
1113 "duplicate happens-before condtion labels");
1115 hbConditions.put(hbLabel, hbCondition);
1118 (<ID> (content = C_CPP_CODE(null) { idCode = stringArray2String(content); }))?
1119 (<CHECK> (content = C_CPP_CODE(null) { check = stringArray2String(content); }))?
1120 (<ACTION> action = C_CPP_CODE(null))?
1121 (<POST_ACTION> (postAction = C_CPP_CODE(null) ))?
1122 (<POST_CHECK> (content = C_CPP_CODE(null) { postCheck = stringArray2String(content); }))?
1125 res = new InterfaceConstruct(_file, _content.size(), interfaceName, commitPointSet, condition,
1126 hbConditions, idCode, check, action, postAction, postCheck);
1132 PotentialCPDefineConstruct Potential_commit_point_define() :
1134 PotentialCPDefineConstruct res;
1135 String label, condition;
1136 ArrayList<String> content;
1142 <POTENTIAL_COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1143 <LABEL> (label = <IDENTIFIER>.image)
1146 res = new PotentialCPDefineConstruct(_file, _content.size(), label, condition);
1151 PotentialCPDefineConstruct Potential_additional_ordering_point_define() :
1153 PotentialCPDefineConstruct res;
1154 String label, condition;
1155 ArrayList<String> content;
1161 <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1162 <LABEL> (label = <IDENTIFIER>.image)
1165 // Set the boolean flag isAdditionalOrderingPoint to be true
1166 res = new PotentialCPDefineConstruct(_file, _content.size(), true, label, condition);
1172 CPDefineConstruct Commit_point_define() :
1174 CPDefineConstruct res;
1175 String label, potentialCPLabel, condition;
1176 ArrayList<String> content;
1182 <COMMIT_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1183 <POTENTIAL_COMMIT_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1184 <LABEL> (label = <IDENTIFIER>.image)
1187 res = new CPDefineConstruct(_file, _content.size(), false, label, potentialCPLabel, condition);
1192 CPDefineConstruct Additional_ordering_point_define() :
1194 CPDefineConstruct res;
1195 String label, potentialCPLabel, condition;
1196 ArrayList<String> content;
1202 <ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1203 <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
1204 <LABEL> (label = <IDENTIFIER>.image)
1207 // Set the boolean flag isAdditionalOrderingPoint to be true
1208 res = new CPDefineConstruct(_file, _content.size(), true, label, potentialCPLabel, condition);
1213 CPClearConstruct Commit_point_clear() :
1215 CPClearConstruct res;
1216 String label, condition;
1217 ArrayList<String> content;
1223 <COMMIT_POINT_CLEAR> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1224 <LABEL> (label = <IDENTIFIER>.image)
1227 res = new CPClearConstruct(_file, _content.size(), label, condition);
1233 CPDefineCheckConstruct Commit_point_define_check() :
1235 CPDefineCheckConstruct res;
1236 String label, condition;
1237 ArrayList<String> content;
1243 <COMMIT_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1244 <LABEL> (label = <IDENTIFIER>.image)
1247 res = new CPDefineCheckConstruct(_file, _content.size(), false, label, condition);
1252 CPDefineCheckConstruct Additional_ordering_point_define_check() :
1254 CPDefineCheckConstruct res;
1255 String label, condition;
1256 ArrayList<String> content;
1262 <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
1263 <LABEL> (label = <IDENTIFIER>.image)
1266 // Set the boolean flag isAdditionalOrderingPoint to be true
1267 res = new CPDefineCheckConstruct(_file, _content.size(), true, label, condition);
1272 EntryPointConstruct Entry_point() :
1280 return new EntryPointConstruct(_file, _content.size());
1284 ClassBeginConstruct Class_begin() :
1292 return new ClassBeginConstruct(_file, _content.size());
1296 ClassEndConstruct Class_end() :
1304 return new ClassEndConstruct(_file, _content.size());
1308 InterfaceDefineConstruct Interface_define() :
1314 <INTERFACE_DEFINE> (name = <IDENTIFIER>.image)
1317 return new InterfaceDefineConstruct(_file, _content.size(), name);