mirror of
https://github.com/IRBorisov/ConceptCore.git
synced 2025-06-26 01:00:36 +03:00
Refactoring: sync names in Parser and AstVisitor
This commit is contained in:
parent
fd92ef6797
commit
f991763bb7
|
@ -18,19 +18,20 @@ public:
|
|||
private:
|
||||
bool VisitDefault(Cursor iter);
|
||||
|
||||
bool ViGlobalDefinition(Cursor iter);
|
||||
bool ViGlobalDeclaration(Cursor iter);
|
||||
|
||||
bool ViFunctionDefinition(Cursor iter);
|
||||
bool ViFunctionCall(Cursor iter);
|
||||
|
||||
// bool ViGlobal(Cursor iter);
|
||||
// bool ViRadical(Cursor iter);
|
||||
// bool ViLocal(Cursor iter);
|
||||
// bool ViInteger(Cursor /*iter*/);
|
||||
// bool ViIntegerSet(Cursor iter)
|
||||
// bool ViEmptySet(Cursor iter);
|
||||
|
||||
bool ViLocalBind(Cursor iter);
|
||||
bool ViLocalEnum(Cursor iter);
|
||||
bool ViTupleDeclaration(Cursor iter);
|
||||
bool ViEnumDeclaration(Cursor iter);
|
||||
bool ViArgumentsEnum(Cursor iter);
|
||||
bool ViArgument(Cursor iter);
|
||||
|
||||
|
@ -41,8 +42,8 @@ private:
|
|||
bool ViNegation(Cursor iter);
|
||||
bool ViLogicBinary(Cursor iter);
|
||||
bool ViEquals(Cursor iter);
|
||||
bool ViOrdering(Cursor iter) { return ViEquals(iter); }
|
||||
bool ViTypedPredicate(Cursor iter) { return ViEquals(iter); }
|
||||
bool ViIntegerPredicate(Cursor iter) { return ViEquals(iter); }
|
||||
bool ViSetexprPredicate(Cursor iter) { return ViEquals(iter); }
|
||||
|
||||
bool ViDeclarative(Cursor iter);
|
||||
bool ViImperative(Cursor iter);
|
||||
|
@ -55,11 +56,11 @@ private:
|
|||
bool ViBoolean(Cursor iter);
|
||||
|
||||
bool ViTuple(Cursor iter);
|
||||
bool ViSetEnum(Cursor iter);
|
||||
bool ViEnumeration(Cursor iter);
|
||||
bool ViBool(Cursor iter) { return ViCard(iter); }
|
||||
bool ViDebool(Cursor iter) { return ViCard(iter); }
|
||||
|
||||
bool ViTypedBinary(Cursor iter) { return ViArithmetic(iter); }
|
||||
bool ViSetexprBinary(Cursor iter) { return ViArithmetic(iter); }
|
||||
bool ViProjectSet(Cursor iter) { return ViCard(iter); }
|
||||
bool ViProjectTuple(Cursor iter) { return ViCard(iter); }
|
||||
bool ViFilter(Cursor iter);
|
||||
|
|
|
@ -22,9 +22,10 @@ public:
|
|||
protected:
|
||||
bool VisitDefault(Cursor iter) { return MergeChildren(iter); }
|
||||
|
||||
bool ViGlobalDefinition(Cursor iter);
|
||||
bool ViGlobalDeclaration(Cursor iter);
|
||||
|
||||
bool ViGlobal(Cursor iter);
|
||||
// bool ViRadical(Cursor iter);
|
||||
bool ViLocal(Cursor iter);
|
||||
|
||||
bool ViQuantifier(Cursor iter);
|
||||
|
|
|
@ -446,44 +446,43 @@ namespace ccl { namespace rslang { namespace detail {
|
|||
S_YYACCEPT = 61, // $accept
|
||||
S_expression = 62, // expression
|
||||
S_global_declaration = 63, // global_declaration
|
||||
S_function_name = 64, // function_name
|
||||
S_logic_or_setexpr = 65, // logic_or_setexpr
|
||||
S_function_decl = 66, // function_decl
|
||||
S_arguments = 67, // arguments
|
||||
S_declaration = 68, // declaration
|
||||
S_variable = 69, // variable
|
||||
S_var_enum = 70, // var_enum
|
||||
S_var_all = 71, // var_all
|
||||
S_logic = 72, // logic
|
||||
S_logic_all = 73, // logic_all
|
||||
S_logic_par = 74, // logic_par
|
||||
S_logic_predicates = 75, // logic_predicates
|
||||
S_binary_predicate = 76, // binary_predicate
|
||||
S_logic_unary = 77, // logic_unary
|
||||
S_logic_no_binary = 78, // logic_no_binary
|
||||
S_quantifier = 79, // quantifier
|
||||
S_quant_var = 80, // quant_var
|
||||
S_quant_var_enum = 81, // quant_var_enum
|
||||
S_logic_binary = 82, // logic_binary
|
||||
S_setexpr = 83, // setexpr
|
||||
S_operation_name = 84, // operation_name
|
||||
S_setexpr_enum = 85, // setexpr_enum
|
||||
S_setexpr_enum_min2 = 86, // setexpr_enum_min2
|
||||
S_literal = 87, // literal
|
||||
S_identifier = 88, // identifier
|
||||
S_setexpr_binary = 89, // setexpr_binary
|
||||
S_setexpr_generators = 90, // setexpr_generators
|
||||
S_enumeration = 91, // enumeration
|
||||
S_tuple = 92, // tuple
|
||||
S_boolean = 93, // boolean
|
||||
S_filter_expression = 94, // filter_expression
|
||||
S_declarative = 95, // declarative
|
||||
S_recursion = 96, // recursion
|
||||
S_imperative = 97, // imperative
|
||||
S_imp_blocks = 98, // imp_blocks
|
||||
S_imp_block = 99, // imp_block
|
||||
S_RPE = 100, // RPE
|
||||
S_RCE = 101 // RCE
|
||||
S_logic_or_setexpr = 64, // logic_or_setexpr
|
||||
S_function_definition = 65, // function_definition
|
||||
S_arguments = 66, // arguments
|
||||
S_declaration = 67, // declaration
|
||||
S_variable = 68, // variable
|
||||
S_var_enum = 69, // var_enum
|
||||
S_var_all = 70, // var_all
|
||||
S_logic = 71, // logic
|
||||
S_logic_all = 72, // logic_all
|
||||
S_logic_par = 73, // logic_par
|
||||
S_logic_predicates = 74, // logic_predicates
|
||||
S_binary_predicate = 75, // binary_predicate
|
||||
S_logic_unary = 76, // logic_unary
|
||||
S_logic_no_binary = 77, // logic_no_binary
|
||||
S_quantifier = 78, // quantifier
|
||||
S_quant_var = 79, // quant_var
|
||||
S_quant_var_enum = 80, // quant_var_enum
|
||||
S_logic_binary = 81, // logic_binary
|
||||
S_setexpr = 82, // setexpr
|
||||
S_text_function = 83, // text_function
|
||||
S_setexpr_enum = 84, // setexpr_enum
|
||||
S_setexpr_enum_min2 = 85, // setexpr_enum_min2
|
||||
S_literal = 86, // literal
|
||||
S_identifier = 87, // identifier
|
||||
S_setexpr_binary = 88, // setexpr_binary
|
||||
S_setexpr_generators = 89, // setexpr_generators
|
||||
S_enumeration = 90, // enumeration
|
||||
S_tuple = 91, // tuple
|
||||
S_boolean = 92, // boolean
|
||||
S_filter_expression = 93, // filter_expression
|
||||
S_declarative = 94, // declarative
|
||||
S_recursion = 95, // recursion
|
||||
S_imperative = 96, // imperative
|
||||
S_imp_blocks = 97, // imp_blocks
|
||||
S_imp_block = 98, // imp_block
|
||||
S_RPE = 99, // RPE
|
||||
S_RCE = 100 // RCE
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -981,9 +980,9 @@ namespace ccl { namespace rslang { namespace detail {
|
|||
/// Constants.
|
||||
enum
|
||||
{
|
||||
yylast_ = 589, ///< Last index in yytable_.
|
||||
yynnts_ = 41, ///< Number of nonterminal symbols.
|
||||
yyfinal_ = 85 ///< Termination state number.
|
||||
yylast_ = 640, ///< Last index in yytable_.
|
||||
yynnts_ = 40, ///< Number of nonterminal symbols.
|
||||
yyfinal_ = 87 ///< Termination state number.
|
||||
};
|
||||
|
||||
|
||||
|
@ -995,7 +994,7 @@ namespace ccl { namespace rslang { namespace detail {
|
|||
|
||||
#line 15 "RSParserImpl.y"
|
||||
} } } // ccl::rslang::detail
|
||||
#line 999 "../header/RSParserImpl.h"
|
||||
#line 998 "../header/RSParserImpl.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -50,19 +50,20 @@ public:
|
|||
protected:
|
||||
bool VisitDefault(Cursor /*iter*/) noexcept { return false; } // NOLINT(readability-convert-member-functions-to-static)
|
||||
|
||||
bool ViGlobalDefinition(Cursor iter);
|
||||
bool ViGlobalDeclaration(Cursor iter);
|
||||
|
||||
// bool ViFunctionDefinition(Cursor iter)
|
||||
// bool ViFunctionCall(Cursor iter);
|
||||
|
||||
bool ViGlobal(Cursor iter) { return ViLocal(iter); }
|
||||
// bool ViRadical(Cursor iter);
|
||||
bool ViLocal(Cursor iter);
|
||||
bool ViInteger(Cursor /*iter*/);
|
||||
bool ViIntegerSet(Cursor /*iter*/);
|
||||
bool ViEmptySet(Cursor iter);
|
||||
|
||||
//bool ViLocalBind(Cursor iter);
|
||||
//bool ViLocalEnum(Cursor iter);
|
||||
//bool ViTupleDeclaration(Cursor iter);
|
||||
//bool ViEnumDeclaration(Cursor iter);
|
||||
//bool ViArgumentsEnum(Cursor iter);
|
||||
//bool ViArgument(Cursor iter);
|
||||
|
||||
|
@ -73,8 +74,8 @@ protected:
|
|||
bool ViNegation(Cursor iter);
|
||||
bool ViLogicBinary(Cursor iter);
|
||||
bool ViEquals(Cursor iter);
|
||||
bool ViOrdering(Cursor iter);
|
||||
bool ViTypedPredicate(Cursor iter) { return ViTypedBinary(iter); }
|
||||
bool ViIntegerPredicate(Cursor iter);
|
||||
bool ViSetexprPredicate(Cursor iter) { return ViSetexprBinary(iter); }
|
||||
|
||||
bool ViDecart(Cursor iter);
|
||||
bool ViBoolean(Cursor iter);
|
||||
|
@ -87,11 +88,11 @@ protected:
|
|||
bool ViRecursion(Cursor iter);
|
||||
|
||||
bool ViTuple(Cursor iter);
|
||||
bool ViSetEnum(Cursor iter);
|
||||
bool ViEnumeration(Cursor iter);
|
||||
bool ViBool(Cursor iter);
|
||||
bool ViDebool(Cursor iter);
|
||||
|
||||
bool ViTypedBinary(Cursor iter);
|
||||
bool ViSetexprBinary(Cursor iter);
|
||||
bool ViProjectSet(Cursor iter);
|
||||
bool ViProjectTuple(Cursor iter);
|
||||
bool ViFilter(Cursor iter);
|
||||
|
|
|
@ -143,15 +143,22 @@ public:
|
|||
case TokenID::PUNC_DEFINE:
|
||||
case TokenID::PUNC_STRUCT:
|
||||
assert(ChildrenCount() != 0);
|
||||
return visitor.ViGlobalDefinition(*this);
|
||||
return visitor.ViGlobalDeclaration(*this);
|
||||
|
||||
case TokenID::ID_GLOBAL:
|
||||
case TokenID::ID_FUNCTION:
|
||||
case TokenID::ID_PREDICATE:
|
||||
case TokenID::ID_RADICAL:
|
||||
assert(ChildrenCount() == 0);
|
||||
return visitor.ViGlobal(*this);
|
||||
|
||||
case TokenID::ID_LOCAL:
|
||||
assert(ChildrenCount() == 0);
|
||||
return visitor.ViLocal(*this);
|
||||
|
||||
case TokenID::ID_RADICAL:
|
||||
assert(ChildrenCount() == 0);
|
||||
return visitor.ViRadical(*this);
|
||||
|
||||
case TokenID::NT_FUNC_DEFINITION:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViFunctionDefinition(*this);
|
||||
|
@ -159,14 +166,9 @@ public:
|
|||
assert(ChildrenCount() > 1);
|
||||
return visitor.ViFunctionCall(*this);
|
||||
|
||||
case TokenID::ID_LOCAL:
|
||||
assert(ChildrenCount() == 0);
|
||||
return visitor.ViLocal(*this);
|
||||
|
||||
case TokenID::LIT_INTSET:
|
||||
assert(ChildrenCount() == 0);
|
||||
return visitor.ViIntegerSet(*this);
|
||||
|
||||
case TokenID::LIT_INTEGER:
|
||||
assert(ChildrenCount() == 0);
|
||||
return visitor.ViInteger(*this);
|
||||
|
@ -176,9 +178,9 @@ public:
|
|||
|
||||
case TokenID::NT_TUPLE_DECL:
|
||||
assert(ChildrenCount() > 1);
|
||||
return visitor.ViLocalBind(*this);
|
||||
return visitor.ViTupleDeclaration(*this);
|
||||
case TokenID::NT_ENUM_DECL:
|
||||
return visitor.ViLocalEnum(*this);
|
||||
return visitor.ViEnumDeclaration(*this);
|
||||
case TokenID::NT_ARGUMENTS:
|
||||
assert(ChildrenCount() > 0);
|
||||
return visitor.ViArgumentsEnum(*this);
|
||||
|
@ -186,22 +188,6 @@ public:
|
|||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViArgument(*this);
|
||||
|
||||
case TokenID::NT_DECLARATIVE_EXPR:
|
||||
assert(ChildrenCount() == 3);
|
||||
return visitor.ViDeclarative(*this);
|
||||
case TokenID::NT_IMPERATIVE_EXPR:
|
||||
assert(ChildrenCount() > 1);
|
||||
return visitor.ViImperative(*this);
|
||||
case TokenID::NT_IMP_DECLARE:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViImpDeclare(*this);
|
||||
case TokenID::NT_IMP_ASSIGN:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViImpAssign(*this);
|
||||
case TokenID::NT_IMP_LOGIC:
|
||||
assert(ChildrenCount() == 1);
|
||||
return visitor.ViImpCheck(*this);
|
||||
|
||||
case TokenID::PLUS:
|
||||
case TokenID::MINUS:
|
||||
case TokenID::MULTIPLY:
|
||||
|
@ -236,7 +222,7 @@ public:
|
|||
case TokenID::GREATER_OR_EQ:
|
||||
case TokenID::LESSER_OR_EQ:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViOrdering(*this);
|
||||
return visitor.ViIntegerPredicate(*this);
|
||||
|
||||
case TokenID::IN:
|
||||
case TokenID::NOTIN:
|
||||
|
@ -244,7 +230,23 @@ public:
|
|||
case TokenID::SUBSET_OR_EQ:
|
||||
case TokenID::NOTSUBSET:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViTypedPredicate(*this);
|
||||
return visitor.ViSetexprPredicate(*this);
|
||||
|
||||
case TokenID::NT_DECLARATIVE_EXPR:
|
||||
assert(ChildrenCount() == 3);
|
||||
return visitor.ViDeclarative(*this);
|
||||
case TokenID::NT_IMPERATIVE_EXPR:
|
||||
assert(ChildrenCount() > 1);
|
||||
return visitor.ViImperative(*this);
|
||||
case TokenID::NT_IMP_DECLARE:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViImpDeclare(*this);
|
||||
case TokenID::NT_IMP_ASSIGN:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViImpAssign(*this);
|
||||
case TokenID::NT_IMP_LOGIC:
|
||||
assert(ChildrenCount() == 1);
|
||||
return visitor.ViImpCheck(*this);
|
||||
|
||||
case TokenID::DECART:
|
||||
assert(ChildrenCount() > 1);
|
||||
|
@ -264,7 +266,7 @@ public:
|
|||
assert(ChildrenCount() > 1);
|
||||
return visitor.ViTuple(*this);
|
||||
case TokenID::NT_ENUMERATION:
|
||||
return visitor.ViSetEnum(*this);
|
||||
return visitor.ViEnumeration(*this);
|
||||
case TokenID::BOOL:
|
||||
assert(ChildrenCount() == 1);
|
||||
return visitor.ViBool(*this);
|
||||
|
@ -277,7 +279,7 @@ public:
|
|||
case TokenID::SET_MINUS:
|
||||
case TokenID::SYMMINUS:
|
||||
assert(ChildrenCount() == 2);
|
||||
return visitor.ViTypedBinary(*this);
|
||||
return visitor.ViSetexprBinary(*this);
|
||||
|
||||
case TokenID::BIGPR:
|
||||
assert(ChildrenCount() == 1);
|
||||
|
@ -319,19 +321,20 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
bool ViGlobalDefinition(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViGlobalDeclaration(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
bool ViFunctionDefinition(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViFunctionCall(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
bool ViGlobal(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViRadical(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViLocal(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViInteger(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViIntegerSet(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViEmptySet(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
bool ViLocalBind(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViLocalEnum(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViTupleDeclaration(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViEnumDeclaration(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViArgumentsEnum(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViArgument(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
|
@ -342,8 +345,8 @@ private:
|
|||
bool ViNegation(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViLogicBinary(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViEquals(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViOrdering(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViTypedPredicate(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViIntegerPredicate(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViSetexprPredicate(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
bool ViDeclarative(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViImperative(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
@ -356,11 +359,11 @@ private:
|
|||
bool ViBoolean(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
bool ViTuple(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViSetEnum(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViEnumeration(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViBool(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViDebool(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
||||
bool ViTypedBinary(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViSetexprBinary(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViProjectSet(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViProjectTuple(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
bool ViFilter(Cursor iter) { return this->BaseT().VisitDefault(iter); }
|
||||
|
|
|
@ -73,19 +73,20 @@ public:
|
|||
void SetExepectTypification(const bool value = true) noexcept;
|
||||
|
||||
protected:
|
||||
bool ViGlobalDefinition(Cursor iter);
|
||||
bool ViGlobalDeclaration(Cursor iter);
|
||||
|
||||
bool ViFunctionDefinition(Cursor iter);
|
||||
bool ViFunctionCall(Cursor iter);
|
||||
|
||||
bool ViGlobal(Cursor iter);
|
||||
bool ViRadical(Cursor iter);
|
||||
bool ViLocal(Cursor iter);
|
||||
bool ViInteger(Cursor /*iter*/) { return SetCurrent(Typification::Integer()); }
|
||||
bool ViIntegerSet(Cursor /*iter*/) { return SetCurrent(Typification::Integer().Bool()); }
|
||||
bool ViEmptySet(Cursor /*iter*/);
|
||||
|
||||
bool ViLocalBind(Cursor iter);
|
||||
bool ViLocalEnum(Cursor iter) { return VisitAllAndSetCurrent(iter, LogicT{}); }
|
||||
bool ViTupleDeclaration(Cursor iter);
|
||||
bool ViEnumDeclaration(Cursor iter) { return VisitAllAndSetCurrent(iter, LogicT{}); }
|
||||
bool ViArgumentsEnum(Cursor iter) { return VisitAllAndSetCurrent(iter, LogicT{}); }
|
||||
bool ViArgument(Cursor iter);
|
||||
|
||||
|
@ -96,8 +97,8 @@ protected:
|
|||
bool ViNegation(Cursor iter) { return VisitAllAndSetCurrent(iter, LogicT{}); }
|
||||
bool ViLogicBinary(Cursor iter) { return VisitAllAndSetCurrent(iter, LogicT{}); }
|
||||
bool ViEquals(Cursor iter);
|
||||
bool ViOrdering(Cursor iter);
|
||||
bool ViTypedPredicate(Cursor iter);
|
||||
bool ViIntegerPredicate(Cursor iter);
|
||||
bool ViSetexprPredicate(Cursor iter);
|
||||
|
||||
bool ViDecart(Cursor iter);
|
||||
bool ViBoolean(Cursor iter);
|
||||
|
@ -110,11 +111,11 @@ protected:
|
|||
bool ViRecursion(Cursor iter);
|
||||
|
||||
bool ViTuple(Cursor iter);
|
||||
bool ViSetEnum(Cursor iter);
|
||||
bool ViBool(Cursor iter) { return ViSetEnum(iter); }
|
||||
bool ViEnumeration(Cursor iter);
|
||||
bool ViBool(Cursor iter) { return ViEnumeration(iter); }
|
||||
bool ViDebool(Cursor iter);
|
||||
|
||||
bool ViTypedBinary(Cursor iter);
|
||||
bool ViSetexprBinary(Cursor iter);
|
||||
bool ViProjectSet(Cursor iter);
|
||||
bool ViProjectTuple(Cursor iter);
|
||||
bool ViFilter(Cursor iter);
|
||||
|
|
|
@ -33,19 +33,20 @@ public:
|
|||
[[nodiscard]] ValueClass VType() const noexcept { return current; }
|
||||
|
||||
protected:
|
||||
bool ViGlobalDefinition(Cursor iter);
|
||||
bool ViGlobalDeclaration(Cursor iter);
|
||||
|
||||
bool ViFunctionDefinition(Cursor iter) { return VisitAllChildren(iter); }
|
||||
bool ViFunctionCall(Cursor iter);
|
||||
|
||||
bool ViGlobal(Cursor iter);
|
||||
bool ViRadical(Cursor /*iter*/);
|
||||
bool ViLocal(Cursor iter);
|
||||
bool ViInteger(Cursor /*iter*/) noexcept { return SetCurrent(ValueClass::value); }
|
||||
bool ViIntegerSet(Cursor /*iter*/) noexcept { return SetCurrent(ValueClass::props); }
|
||||
bool ViEmptySet(Cursor /*iter*/) noexcept { return SetCurrent(ValueClass::value); }
|
||||
|
||||
bool ViLocalBind(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViLocalEnum(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViTupleDeclaration(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViEnumDeclaration(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViArgumentsEnum(Cursor iter) { return VisitAllChildren(iter); }
|
||||
bool ViArgument(Cursor iter) { return VisitAllChildren(iter); }
|
||||
|
||||
|
@ -56,8 +57,8 @@ protected:
|
|||
bool ViNegation(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViLogicBinary(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViEquals(Cursor iter) { return AssertAllValues(iter); }
|
||||
bool ViOrdering(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViTypedPredicate(Cursor iter);
|
||||
bool ViIntegerPredicate(Cursor iter) { return VisitAllAndSetCurrent(iter, ValueClass::value); }
|
||||
bool ViSetexprPredicate(Cursor iter);
|
||||
|
||||
bool ViDecart(Cursor iter);
|
||||
bool ViBoolean(Cursor iter);
|
||||
|
@ -70,11 +71,11 @@ protected:
|
|||
bool ViRecursion(Cursor iter) { return AssertAllValues(iter); }
|
||||
|
||||
bool ViTuple(Cursor iter) { return AssertAllValues(iter); }
|
||||
bool ViSetEnum(Cursor iter) { return AssertAllValues(iter); }
|
||||
bool ViEnumeration(Cursor iter) { return AssertAllValues(iter); }
|
||||
bool ViBool(Cursor iter) { return AssertChildIsValue(iter, 0); }
|
||||
bool ViDebool(Cursor iter) { return AssertChildIsValue(iter, 0); }
|
||||
|
||||
bool ViTypedBinary(Cursor iter);
|
||||
bool ViSetexprBinary(Cursor iter);
|
||||
bool ViProjectSet(Cursor iter) { return AssertChildIsValue(iter, 0); }
|
||||
bool ViProjectTuple(Cursor iter) { return AssertChildIsValue(iter, 0); }
|
||||
bool ViFilter(Cursor iter) { return VisitAllChildren(iter); }
|
||||
|
|
|
@ -225,7 +225,7 @@ bool ASTInterpreter::SetCurrent(const ExpressionValue& value) noexcept {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ASTInterpreter::ViGlobalDefinition(Cursor iter) {
|
||||
bool ASTInterpreter::ViGlobalDeclaration(Cursor iter) {
|
||||
return VisitChild(iter, 1);
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ bool ASTInterpreter::ViEquals(Cursor iter) {
|
|||
return SetCurrent((val1 == val2) != (iter->id == TokenID::NOTEQUAL));
|
||||
}
|
||||
|
||||
bool ASTInterpreter::ViOrdering(Cursor iter) {
|
||||
bool ASTInterpreter::ViIntegerPredicate(Cursor iter) {
|
||||
const auto val1 = EvaluateChild(iter, 0);
|
||||
if (!val1.has_value()) {
|
||||
return false;
|
||||
|
@ -501,7 +501,7 @@ bool ASTInterpreter::ViTuple(Cursor iter) {
|
|||
return SetCurrent(Factory::Tuple(args));
|
||||
}
|
||||
|
||||
bool ASTInterpreter::ViSetEnum(Cursor iter) {
|
||||
bool ASTInterpreter::ViEnumeration(Cursor iter) {
|
||||
std::vector<StructuredData> args{};
|
||||
for (Index child = 0; child < iter.ChildrenCount(); ++child) {
|
||||
const auto childValue = EvaluateChild(iter, child);
|
||||
|
@ -521,7 +521,7 @@ bool ASTInterpreter::ViBool(Cursor iter) {
|
|||
return SetCurrent(Factory::Singleton(std::get<StructuredData>(childValue.value())));
|
||||
}
|
||||
|
||||
bool ASTInterpreter::ViTypedBinary(Cursor iter) {
|
||||
bool ASTInterpreter::ViSetexprBinary(Cursor iter) {
|
||||
const auto val1 = EvaluateChild(iter, 0);
|
||||
if (!val1.has_value()) {
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,7 @@ bool GeneratorImplAST::VisitDefault(Cursor iter) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GeneratorImplAST::ViGlobalDefinition(Cursor iter) {
|
||||
bool GeneratorImplAST::ViGlobalDeclaration(Cursor iter) {
|
||||
OutputChild(iter, 0);
|
||||
rsText += iter->ToString(syntax);
|
||||
if (iter.ChildrenCount() > 1) {
|
||||
|
@ -48,12 +48,12 @@ bool GeneratorImplAST::ViFunctionCall(Cursor iter) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GeneratorImplAST::ViLocalBind(Cursor iter) {
|
||||
bool GeneratorImplAST::ViTupleDeclaration(Cursor iter) {
|
||||
EnumChildren(iter, '(', ')', std::string(R"(, )"));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeneratorImplAST::ViLocalEnum(Cursor iter) {
|
||||
bool GeneratorImplAST::ViEnumDeclaration(Cursor iter) {
|
||||
EnumChildren(iter, R"(, )");
|
||||
return true;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ bool GeneratorImplAST::ViTuple(Cursor iter) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GeneratorImplAST::ViSetEnum(Cursor iter) {
|
||||
bool GeneratorImplAST::ViEnumeration(Cursor iter) {
|
||||
EnumChildren(iter, '{', '}', R"(, )");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ bool ASTInterpreter::NameCollector::MergeChildren(Cursor iter) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ASTInterpreter::NameCollector::ViGlobalDefinition(Cursor iter) {
|
||||
bool ASTInterpreter::NameCollector::ViGlobalDeclaration(Cursor iter) {
|
||||
if (iter->id == TokenID::PUNC_STRUCT) {
|
||||
return false; // TODO: specify error
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "ccl/rslang/Parser.h"
|
||||
|
||||
namespace ccl::rslang {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -261,18 +261,15 @@ RawNode Imperative(
|
|||
expression
|
||||
: global_declaration
|
||||
| logic_or_setexpr { state->FinalizeExpression($1); }
|
||||
| function_decl { state->FinalizeExpression($1); }
|
||||
| function_definition { state->FinalizeExpression($1); }
|
||||
;
|
||||
|
||||
global_declaration
|
||||
: GLOBAL DEFINE { state->FinalizeCstEmpty($1, $2); }
|
||||
| GLOBAL STRUCT setexpr { state->FinalizeCstExpression($1, $2, $3); }
|
||||
| GLOBAL DEFINE logic_or_setexpr { state->FinalizeCstExpression($1, $2, $3); }
|
||||
| function_name DEFINE function_decl { state->FinalizeCstExpression($1, $2, $3); }
|
||||
;
|
||||
function_name
|
||||
: FUNCTION
|
||||
| PREDICATE
|
||||
| FUNCTION DEFINE function_definition { state->FinalizeCstExpression($1, $2, $3); }
|
||||
| PREDICATE DEFINE function_definition { state->FinalizeCstExpression($1, $2, $3); }
|
||||
;
|
||||
|
||||
logic_or_setexpr
|
||||
|
@ -280,7 +277,7 @@ logic_or_setexpr
|
|||
| setexpr
|
||||
;
|
||||
|
||||
function_decl
|
||||
function_definition
|
||||
: LS arguments RS logic_or_setexpr { $$ = FunctionDeclaration($1, $2, $4); }
|
||||
| LS error { state->OnError(ParseEID::expectedDeclaration); YYABORT; }
|
||||
;
|
||||
|
@ -407,9 +404,10 @@ literal
|
|||
|
||||
identifier
|
||||
: GLOBAL
|
||||
| function_name
|
||||
| FUNCTION
|
||||
| PREDICATE
|
||||
| LOCAL
|
||||
| RADICAL
|
||||
| LOCAL
|
||||
;
|
||||
|
||||
setexpr_binary
|
||||
|
|
|
@ -49,8 +49,8 @@ bool IsEchelon(SyntaxTree::Cursor iter, const Index index) {
|
|||
return IsEchelon(iter);
|
||||
}
|
||||
|
||||
bool IsRadical(const std::string& globalName) {
|
||||
return !empty(globalName) && globalName.at(0) == 'R' && globalName.at(1) != '0';
|
||||
bool IsRadical(const std::string& alias) {
|
||||
return !empty(alias) && alias.at(0) == 'R' && alias.at(1) != '0';
|
||||
}
|
||||
|
||||
void MangleRadicals(const std::string& funcName, Typification& type) {
|
||||
|
@ -301,7 +301,7 @@ void TypeAuditor::Clear() noexcept {
|
|||
currentType = {};
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViGlobalDefinition(Cursor iter) {
|
||||
bool TypeAuditor::ViGlobalDeclaration(Cursor iter) {
|
||||
const auto childrenCount = iter.ChildrenCount();
|
||||
if (iter->id == TokenID::PUNC_STRUCT) {
|
||||
if (childrenCount != 2 || !IsEchelon(iter, 1)) {
|
||||
|
@ -420,37 +420,38 @@ std::optional<Typification::Substitutes> TypeAuditor::CheckFuncArguments(Cursor
|
|||
}
|
||||
|
||||
bool TypeAuditor::ViGlobal(Cursor iter) {
|
||||
const auto& globalName = iter->data.ToText();
|
||||
if (iter->id == TokenID::ID_RADICAL) {
|
||||
if (!isFuncDeclaration && !isTypification) {
|
||||
OnError(
|
||||
SemanticEID::radicalUsage,
|
||||
iter->pos.start,
|
||||
globalName
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return SetCurrent(Typification(globalName).ApplyBool());
|
||||
} else {
|
||||
if (env.context.FunctionArgsFor(globalName) != nullptr) {
|
||||
OnError(
|
||||
SemanticEID::globalFuncWithoutArgs,
|
||||
iter->pos.start,
|
||||
globalName
|
||||
);
|
||||
return false;
|
||||
}
|
||||
const auto* type = env.context.TypeFor(globalName);
|
||||
if (type == nullptr) {
|
||||
OnError(
|
||||
SemanticEID::globalNotTyped,
|
||||
iter->pos.start,
|
||||
globalName
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return SetCurrent(*type);
|
||||
const auto& alias = iter->data.ToText();
|
||||
if (env.context.FunctionArgsFor(alias) != nullptr) {
|
||||
OnError(
|
||||
SemanticEID::globalFuncWithoutArgs,
|
||||
iter->pos.start,
|
||||
alias
|
||||
);
|
||||
return false;
|
||||
}
|
||||
const auto* type = env.context.TypeFor(alias);
|
||||
if (type == nullptr) {
|
||||
OnError(
|
||||
SemanticEID::globalNotTyped,
|
||||
iter->pos.start,
|
||||
alias
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return SetCurrent(*type);
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViRadical(Cursor iter) {
|
||||
const auto& alias = iter->data.ToText();
|
||||
if (!isFuncDeclaration && !isTypification) {
|
||||
OnError(
|
||||
SemanticEID::radicalUsage,
|
||||
iter->pos.start,
|
||||
alias
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return SetCurrent(Typification(alias).ApplyBool());
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViLocal(Cursor iter) {
|
||||
|
@ -470,7 +471,7 @@ bool TypeAuditor::ViEmptySet(Cursor /*iter*/) {
|
|||
return SetCurrent(Typification::EmptySet());
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViLocalBind(Cursor iter) {
|
||||
bool TypeAuditor::ViTupleDeclaration(Cursor iter) {
|
||||
assert(isLocalDeclaration || isFuncDeclaration);
|
||||
const Typification type = std::get<Typification>(currentType);
|
||||
if (!type.IsTuple() || type.T().Arity() != iter.ChildrenCount()) {
|
||||
|
@ -545,7 +546,7 @@ bool TypeAuditor::ViArithmetic(Cursor iter) {
|
|||
return SetCurrent(result.value());
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViOrdering(Cursor iter) {
|
||||
bool TypeAuditor::ViIntegerPredicate(Cursor iter) {
|
||||
const auto test1 = ChildType(iter, 0);
|
||||
if(!test1.has_value()) {
|
||||
return false;
|
||||
|
@ -629,7 +630,7 @@ bool TypeAuditor::ViEquals(Cursor iter) {
|
|||
return SetCurrent(LogicT{});
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViTypedPredicate(Cursor iter) {
|
||||
bool TypeAuditor::ViSetexprPredicate(Cursor iter) {
|
||||
auto type2 = ChildTypeDebool(iter, 1, SemanticEID::invalidTypeOperation);
|
||||
if (!type2.has_value()) {
|
||||
return false;
|
||||
|
@ -721,7 +722,7 @@ bool TypeAuditor::ViRecursion(Cursor iter) {
|
|||
}
|
||||
|
||||
const bool isFull = iter->id == TokenID::NT_RECURSIVE_FULL;
|
||||
Index iterationIndex{ isFull ? 3 : 2 };
|
||||
const auto iterationIndex = static_cast<Index>(isFull ? 3 : 2);
|
||||
|
||||
const auto iterationType = ChildType(iter, iterationIndex);
|
||||
if (!iterationType.has_value()) {
|
||||
|
@ -791,7 +792,7 @@ bool TypeAuditor::ViTuple(Cursor iter) {
|
|||
return SetCurrent(Typification::Tuple(components));
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViSetEnum(Cursor iter) {
|
||||
bool TypeAuditor::ViEnumeration(Cursor iter) {
|
||||
auto test = ChildType(iter, 0);
|
||||
if (!test.has_value()) {
|
||||
return false;
|
||||
|
@ -826,7 +827,7 @@ bool TypeAuditor::ViDebool(Cursor iter) {
|
|||
return SetCurrent(type.value());
|
||||
}
|
||||
|
||||
bool TypeAuditor::ViTypedBinary(Cursor iter) {
|
||||
bool TypeAuditor::ViSetexprBinary(Cursor iter) {
|
||||
auto type1 = ChildTypeDebool(iter, 0, SemanticEID::invalidTypeOperation);
|
||||
if (!type1.has_value()) {
|
||||
return false;
|
||||
|
|
|
@ -66,7 +66,7 @@ bool ValueAuditor::AssertAllValues(Cursor iter) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ValueAuditor::ViGlobalDefinition(Cursor iter) {
|
||||
bool ValueAuditor::ViGlobalDeclaration(Cursor iter) {
|
||||
if (iter->id == TokenID::PUNC_STRUCT) {
|
||||
return VisitChild(iter, 1) && SetCurrent(ValueClass::value);
|
||||
} else if (iter.ChildrenCount() == 1) {
|
||||
|
@ -77,10 +77,10 @@ bool ValueAuditor::ViGlobalDefinition(Cursor iter) {
|
|||
}
|
||||
|
||||
bool ValueAuditor::ViFunctionCall(Cursor iter) {
|
||||
const auto& globalName = iter(0).data.ToText();
|
||||
const auto funcType = globalClass(globalName);
|
||||
const auto& alias = iter(0).data.ToText();
|
||||
const auto funcType = globalClass(alias);
|
||||
if (funcType == ValueClass::invalid) {
|
||||
OnError(SemanticEID::globalNoValue, iter->pos.start, globalName);
|
||||
OnError(SemanticEID::globalNoValue, iter->pos.start, alias);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ bool ValueAuditor::ViFunctionCall(Cursor iter) {
|
|||
current = funcType;
|
||||
return true;
|
||||
} else {
|
||||
return RunCheckOnFunc(iter, globalName, args);
|
||||
return RunCheckOnFunc(iter, alias, args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,18 +131,18 @@ bool ValueAuditor::RunCheckOnFunc(
|
|||
}
|
||||
|
||||
bool ValueAuditor::ViGlobal(Cursor iter) {
|
||||
const auto& globalName = iter->data.ToText();
|
||||
if (iter->id == TokenID::ID_RADICAL) {
|
||||
return SetCurrent(ValueClass::value);
|
||||
} else {
|
||||
const auto type = globalClass(globalName);
|
||||
if (type == ValueClass::invalid) {
|
||||
OnError(SemanticEID::globalNoValue, iter->pos.start, globalName);
|
||||
return false;
|
||||
}
|
||||
current = type;
|
||||
return true;
|
||||
const auto& alias = iter->data.ToText();
|
||||
const auto type = globalClass(alias);
|
||||
if (type == ValueClass::invalid) {
|
||||
OnError(SemanticEID::globalNoValue, iter->pos.start, alias);
|
||||
return false;
|
||||
}
|
||||
current = type;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValueAuditor::ViRadical(Cursor /*iter*/) {
|
||||
return SetCurrent(ValueClass::value);
|
||||
}
|
||||
|
||||
bool ValueAuditor::ViLocal(Cursor iter) {
|
||||
|
@ -158,7 +158,7 @@ bool ValueAuditor::ViQuantifier(Cursor iter) {
|
|||
return AssertChildIsValue(iter, 1) && VisitChild(iter, 2);
|
||||
}
|
||||
|
||||
bool ValueAuditor::ViTypedPredicate(Cursor iter) {
|
||||
bool ValueAuditor::ViSetexprPredicate(Cursor iter) {
|
||||
switch (iter->id) {
|
||||
default:
|
||||
case TokenID::IN:
|
||||
|
@ -202,7 +202,7 @@ bool ValueAuditor::ViBoolean(Cursor iter) {
|
|||
return VisitChild(iter, 0) && SetCurrent(ValueClass::props);
|
||||
}
|
||||
|
||||
bool ValueAuditor::ViTypedBinary(Cursor iter) {
|
||||
bool ValueAuditor::ViSetexprBinary(Cursor iter) {
|
||||
if (!VisitChild(iter, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user