@Begin
@Potential_commit_point_define: ...
@Label: ...
+ @End
+
+ OR
+
+ @Begin
+ @Potential_additional_ordering_point_define: ...
+ @Label: ...
@End
d) Commit point define construct
@Begin
@Commit_point_define_check: ...
@Label: ...
+ @End
+
+ OR
+
+ # Addition ordering point is used to order operations when there are "equal"
+ # commit point operations on the same location and that we cannot decide
+ # which operation goes first, we will use additional ordering point to order
+ # them (it's just similar to commit points). In implementation, we can just
+ # treat them as commit points with a special flag.
+
+ @Begin
+ @Additional_ordering_point_define: ...
+ @Potential_additional_ordering_point_label: ...
+ @Label: ...
@End
OR
+
+ @Begin
+ @Additional_ordering_point_define: ...
+ @Label: ...
+ @End
+
+ OR
@Begin
- @Commit_point_define: ...
- @Potential_commit_point_label: ...
+ @Additional_ordering_point_define_check: ...
@Label: ...
@End
<POST_CHECK: "@Post_check:">
|
<POTENTIAL_COMMIT_POINT_DEFINE: "@Potential_commit_point_define:">
+|
+ <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE: "@Potential_additional_ordering_point_define:">
|
<LABEL: "@Label:">
|
<COMMIT_POINT_DEFINE_CHECK: "@Commit_point_define_check:">
+|
+ <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK: "@Additional_ordering_point_define_check:">
|
<COMMIT_POINT_DEFINE: "@Commit_point_define:">
+|
+ <ADDITIONAL_ORDERING_POINT_DEFINE: "@Additional_ordering_point_define:">
|
<COMMIT_POINT_CLEAR: "@Commit_point_clear:">
|
<POTENTIAL_COMMIT_POINT_LABEL: "@Potential_commit_point_label:">
+|
+ <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL: "@Potential_additional_ordering_point_label:">
}
LOOKAHEAD(2) res = Potential_commit_point_define() |
LOOKAHEAD(2) res = Commit_point_define() |
LOOKAHEAD(2) res = Commit_point_define_check() |
+ LOOKAHEAD(2) res = Potential_additional_ordering_point_define() |
+ LOOKAHEAD(2) res = Additional_ordering_point_define() |
+ LOOKAHEAD(2) res = Additional_ordering_point_define_check() |
LOOKAHEAD(2) res = Commit_point_clear() |
LOOKAHEAD(2) res = Entry_point() |
LOOKAHEAD(2) res = Class_begin() |
}
}
+PotentialCPDefineConstruct Potential_additional_ordering_point_define() :
+{
+ PotentialCPDefineConstruct res;
+ String label, condition;
+ ArrayList<String> content;
+}
+{
+
+ { res = null; }
+ <BEGIN>
+ <POTENTIAL_ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
+ <LABEL> (label = <IDENTIFIER>.image)
+ <END>
+ {
+ // Set the boolean flag isAdditionalOrderingPoint to be true
+ res = new PotentialCPDefineConstruct(_file, _content.size(), true, label, condition);
+ return res;
+ }
+}
+
CPDefineConstruct Commit_point_define() :
{
<LABEL> (label = <IDENTIFIER>.image)
<END>
{
- res = new CPDefineConstruct(_file, _content.size(), label, potentialCPLabel, condition);
+ res = new CPDefineConstruct(_file, _content.size(), false, label, potentialCPLabel, condition);
+ return res;
+ }
+}
+
+CPDefineConstruct Additional_ordering_point_define() :
+{
+ CPDefineConstruct res;
+ String label, potentialCPLabel, condition;
+ ArrayList<String> content;
+}
+{
+
+ { res = null; }
+ <BEGIN>
+ <ADDITIONAL_ORDERING_POINT_DEFINE> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
+ <POTENTIAL_ADDITIONAL_ORDERING_POINT_LABEL> (potentialCPLabel = <IDENTIFIER>.image)
+ <LABEL> (label = <IDENTIFIER>.image)
+ <END>
+ {
+ // Set the boolean flag isAdditionalOrderingPoint to be true
+ res = new CPDefineConstruct(_file, _content.size(), true, label, potentialCPLabel, condition);
return res;
}
}
<LABEL> (label = <IDENTIFIER>.image)
<END>
{
- res = new CPDefineCheckConstruct(_file, _content.size(), label, condition);
+ res = new CPDefineCheckConstruct(_file, _content.size(), false, label, condition);
+ return res;
+ }
+}
+
+CPDefineCheckConstruct Additional_ordering_point_define_check() :
+{
+ CPDefineCheckConstruct res;
+ String label, condition;
+ ArrayList<String> content;
+}
+{
+
+ { res = null; }
+ <BEGIN>
+ <ADDITIONAL_ORDERING_POINT_DEFINE_CHECK> (content = C_CPP_CODE(null) { condition = stringArray2String(content); })
+ <LABEL> (label = <IDENTIFIER>.image)
+ <END>
+ {
+ // Set the boolean flag isAdditionalOrderingPoint to be true
+ res = new CPDefineCheckConstruct(_file, _content.size(), true, label, condition);
return res;
}
}