mCRL2
Loading...
Searching...
No Matches
parse_impl.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_LPS_PARSE_IMPL_H
13#define MCRL2_LPS_PARSE_IMPL_H
14
16#include "mcrl2/lps/typecheck.h"
17#include "mcrl2/process/parse.h"
19
20namespace mcrl2 {
21
22namespace lps {
23
24namespace detail
25{
26
28{
29 explicit multi_action_actions(const core::parser& parser_)
30 : process::detail::action_actions(parser_)
31 {}
32
34 {
35 if ((node.child_count() == 1) && (symbol_name(node.child(0)) == "tau")) { return process::untyped_multi_action(); }
36 else if ((node.child_count() == 1) && (symbol_name(node.child(0)) == "ActionList"))
37 {
39 }
41 }
42};
43
45{
46 explicit action_rename_actions(const core::parser& parser_)
47 : process::detail::action_actions(parser_)
48 {}
49
50 // create an action with an incomplete action label
52 {
53 process::action_label label(parse_Id(node.child(0)), {});
54 return process::action(label, parse_DataExprList(node.child(1)));
55 }
56
58 {
59 if ((node.child_count() == 1) && (symbol_name(node.child(0)) == "Action")) { return parse_Action_as_action(node.child(0)); }
60 else if ((node.child_count() == 1) && (symbol_name(node.child(0)) == "tau")) { return process::tau(); }
61 else if ((node.child_count() == 1) && (symbol_name(node.child(0)) == "delta")) { return process::delta(); }
63 }
64
66 {
68 if (node.child(0).child(0))
69 {
70 condition = parse_DataExpr(node.child(0).child(0).child(0));
71 }
73 }
74
75 std::vector<lps::action_rename_rule> parse_ActionRenameRuleList(const core::parse_node& node) const
76 {
77 return parse_vector<lps::action_rename_rule>(node, "ActionRenameRule", [&](const core::parse_node& node) { return parse_ActionRenameRule(node); });
78 }
79
80 std::vector<lps::action_rename_rule> parse_ActionRenameRuleSpec(const core::parse_node& node) const
81 {
82 data::variable_list variables = parse_VarSpec(node.child(0));
83 std::vector<lps::action_rename_rule> rules = parse_ActionRenameRuleList(node.child(2));
84 for (lps::action_rename_rule& rule: rules)
85 {
86 rule.variables() = variables;
87 }
88 return rules;
89 }
90
92 {
93 if (symbol_name(node) == "SortSpec")
94 {
95 return callback_DataSpecElement(node, dataspec_result);
96 }
97 else if (symbol_name(node) == "ConsSpec")
98 {
99 return callback_DataSpecElement(node, dataspec_result);
100 }
101 else if (symbol_name(node) == "MapSpec")
102 {
103 return callback_DataSpecElement(node, dataspec_result);
104 }
105 else if (symbol_name(node) == "EqnSpec")
106 {
107 return callback_DataSpecElement(node, dataspec_result);
108 }
109 else if (symbol_name(node) == "ActSpec")
110 {
111 result.action_labels() = result.action_labels() + parse_ActSpec(node);
112 return true;
113 }
114 else if (symbol_name(node) == "ActionRenameRuleSpec")
115 {
116 std::vector<lps::action_rename_rule> rules = parse_ActionRenameRuleSpec(node);
117 result.rules().insert(result.rules().end(), rules.begin(), rules.end());
118 return true;
119 }
120 return false;
121 }
122
124 {
125 data::untyped_data_specification dataspec_result;
127 traverse(node, [&](const core::parse_node& node) { return callback_ActionRenameSpec(node, dataspec_result, result); });
128 result.data() = dataspec_result.construct_data_specification();
129 return result;
130 }
131};
132
133} // namespace detail
134
135} // namespace lps
136
137} // namespace mcrl2
138
139#endif // MCRL2_LPS_PARSE_IMPL_H
Read-only singly linked list of action rename rules.
const std::vector< action_rename_rule > & rules() const
Returns the action rename rules.
const data::data_specification & data() const
Returns the data action_rename_specification.
const process::action_label_list & action_labels() const
Returns the sequence of action labels.
\brief An action label
\brief The value delta
\brief A process expression
\brief The value tau
\brief An untyped multi action or data application
add your file description here.
add your file description here.
const function_symbol & true_()
Constructor for function symbol true.
Definition bool.h:77
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
Parse function for process specifications.
add your file description here.
core::identifier_string parse_Id(const parse_node &node) const
Definition parse.h:233
Wrapper for D_ParseNode.
Definition dparser.h:86
parse_node child(int i) const
Definition dparser.cpp:43
int child_count() const
Definition dparser.cpp:37
std::string symbol_name(const parse_node &node) const
Definition parse.h:205
void traverse(const parse_node &node, const Function &f) const
Definition parse.h:93
const parser & m_parser
Definition parse.h:85
Wrapper for D_Parser and its corresponding D_ParserTables.
Definition dparser.h:148
data::data_expression_list parse_DataExprList(const core::parse_node &node) const
Definition parse_impl.h:287
data::data_expression parse_DataExpr(const core::parse_node &node) const
Definition parse_impl.h:211
data::variable_list parse_VarSpec(const core::parse_node &node) const
Definition parse_impl.h:378
bool callback_DataSpecElement(const core::parse_node &node, untyped_data_specification &result) const
Definition parse_impl.h:413
std::vector< lps::action_rename_rule > parse_ActionRenameRuleList(const core::parse_node &node) const
Definition parse_impl.h:75
process::action parse_Action_as_action(const core::parse_node &node) const
Definition parse_impl.h:51
bool callback_ActionRenameSpec(const core::parse_node &node, data::untyped_data_specification &dataspec_result, lps::action_rename_specification &result) const
Definition parse_impl.h:91
std::vector< lps::action_rename_rule > parse_ActionRenameRuleSpec(const core::parse_node &node) const
Definition parse_impl.h:80
lps::action_rename_specification parse_ActionRenameSpec(const core::parse_node &node) const
Definition parse_impl.h:123
process::process_expression parse_ActionRenameRuleRHS(const core::parse_node &node) const
Definition parse_impl.h:57
action_rename_actions(const core::parser &parser_)
Definition parse_impl.h:46
lps::action_rename_rule parse_ActionRenameRule(const core::parse_node &node) const
Definition parse_impl.h:65
process::untyped_multi_action parse_MultAct(const core::parse_node &node) const
Definition parse_impl.h:33
multi_action_actions(const core::parser &parser_)
Definition parse_impl.h:29
action_actions(const core::parser &parser_)
Definition parse_impl.h:47
action_label_list parse_ActSpec(const core::parse_node &node) const
Definition parse_impl.h:87
data::untyped_data_parameter_list parse_ActionList(const core::parse_node &node) const
Definition parse_impl.h:56