20 #ifndef PROMELACODEANALYZER_H_E89FF519
21 #define PROMELACODEANALYZER_H_E89FF519
25 #include "uscxml/plugins/datamodel/promela/parser/promela.tab.hpp"
43 std::map<std::string, PromelaTypedef> types;
44 std::set<ChartToPromela*> occurrences;
47 return name == other.name;
56 void addCode(
const std::string& code,
ChartToPromela* interpreter);
57 void addLiteral(
const std::string& stateName,
int forceIndex = -1);
59 bool usesComplexEventStruct() {
60 return _typeDefs.types.find(
"_event") != _typeDefs.types.end() && _typeDefs.types[
"_event"].types.size() > 0;
62 bool usesEventField(
const std::string& fieldName) {
63 if (usesComplexEventStruct() && _typeDefs.types[
"_event"].types.find(fieldName) != _typeDefs.types[
"_event"].types.end())
67 bool usesCancel(
const std::string& elementName) {
71 bool usesEventDataField(
const std::string& fieldName) {
72 if (usesComplexEventStruct() &&
73 _typeDefs.types[
"_event"].types.find(
"data") != _typeDefs.types[
"_event"].types.end() &&
74 _typeDefs.types[
"_event"].types[
"data"].types.find(fieldName) != _typeDefs.types[
"_event"].types[
"data"].types.end())
79 size_t largestDelay = 0;
81 std::string getTypeAssignment(
const std::string& varTo,
const std::string& varFrom,
const PromelaTypedef& type,
size_t indent = 0);
82 std::string getTypeReset(
const std::string& var,
const PromelaTypedef& type,
size_t indent = 0);
84 bool usesInPredicate() {
85 return _usesInPredicate;
87 void usesInPredicate(
bool value) {
88 _usesInPredicate = value;
90 bool usesPlatformVars() {
91 return _usesPlatformVars;
94 bool hasIndexLessLoops() {
95 return _hasIndexLessLoops;
98 std::string macroForLiteral(
const std::string& literal);
99 int indexForLiteral(
const std::string& literal);
101 std::set<std::string> getLiterals() {
104 std::set<std::string> getEventsWithPrefix(
const std::string& prefix);
110 std::string adaptCode(
const std::string& code,
const std::string& prefix);
112 static std::string prefixIdentifiers(
const std::string& expr,
const std::string& prefix);
113 static std::list<std::pair<size_t, size_t> > getTokenPositions(
const std::string& expr,
int type, PromelaParserNode* ast);
115 PromelaTypedef& getTypes() {
119 PromelaTypedef& getType(
const std::string& typeName) {
120 return _typeDefs.types.at(typeName);
123 std::string sanitizeCode(
const std::string& code);
124 void addEvent(
const std::string& eventName);
125 std::string createMacroName(
const std::string& literal);
128 void addState(
const std::string& stateName,
size_t index);
130 int enumerateLiteral(
const std::string& literal,
int forceIndex = -1);
132 std::map<std::string, std::string> _strMacros;
133 std::map<std::string, int> _strIndex;
134 std::set<std::string> _literals;
136 PromelaTypedef _typeDefs;
140 std::set<std::string> _macroNameSet;
141 int _lastStrIndex = 1;
142 bool _usesCancel =
false;
143 bool _usesInPredicate =
false;
144 bool _usesPlatformVars =
false;
145 bool _hasIndexLessLoops =
false;
Definition: Breakpoint.cpp:26
Definition: PromelaCodeAnalyzer.h:33
Definition: PromelaCodeAnalyzer.h:35
Definition: ChartToPromela.h:34