Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
b59052a2
Commit
b59052a2
authored
Jul 30, 2019
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Move ExecUntilBreakOrContinue and INodeProcessor to their own files
parent
be4ce7ae
No related branches found
No related tags found
1 merge request
!37
Feature/language
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/language/ASTNode.hpp
+6
-57
6 additions, 57 deletions
src/language/ASTNode.hpp
src/language/ExecUntilBreakOrContinue.hpp
+44
-0
44 additions, 0 deletions
src/language/ExecUntilBreakOrContinue.hpp
src/language/INodeProcessor.hpp
+19
-0
19 additions, 0 deletions
src/language/INodeProcessor.hpp
with
69 additions
and
57 deletions
src/language/ASTNode.hpp
+
6
−
57
View file @
b59052a2
...
@@ -7,64 +7,13 @@
...
@@ -7,64 +7,13 @@
#include
<ASTNodeDataType.hpp>
#include
<ASTNodeDataType.hpp>
#include
<ASTNodeDataVariant.hpp>
#include
<ASTNodeDataVariant.hpp>
#include
<ExecUntilBreakOrContinue.hpp>
#include
<INodeProcessor.hpp>
#include
<pegtl/contrib/parse_tree.hpp>
#include
<pegtl/contrib/parse_tree.hpp>
using
namespace
TAO_PEGTL_NAMESPACE
;
using
namespace
TAO_PEGTL_NAMESPACE
;
struct
ExecUntilBreakOrContinue
{
enum
class
JumpType
{
no_jump
,
break_jump
,
continue_jump
};
private
:
JumpType
m_jump_type
{
JumpType
::
no_jump
};
bool
m_exec
{
true
};
public
:
PUGS_INLINE
bool
exec
()
const
{
return
m_exec
;
}
PUGS_INLINE
JumpType
jumpType
()
const
{
return
m_jump_type
;
}
ExecUntilBreakOrContinue
&
operator
=
(
const
ExecUntilBreakOrContinue
&
)
=
delete
;
ExecUntilBreakOrContinue
&
operator
=
(
ExecUntilBreakOrContinue
&&
)
=
default
;
ExecUntilBreakOrContinue
()
=
default
;
constexpr
ExecUntilBreakOrContinue
(
const
JumpType
&
jump_type
)
:
m_jump_type
(
jump_type
),
m_exec
((
jump_type
==
JumpType
::
no_jump
))
{
;
}
};
class
INodeProcessor
{
public:
virtual
void
execute
(
ExecUntilBreakOrContinue
&
exec_policy
)
=
0
;
virtual
std
::
string
describe
()
const
=
0
;
INodeProcessor
(
const
INodeProcessor
&
)
=
delete
;
INodeProcessor
()
=
default
;
virtual
~
INodeProcessor
()
=
default
;
};
class
SymbolTable
;
class
SymbolTable
;
struct
ASTNode
:
public
parse_tree
::
basic_node
<
ASTNode
>
struct
ASTNode
:
public
parse_tree
::
basic_node
<
ASTNode
>
...
@@ -72,6 +21,9 @@ struct ASTNode : public parse_tree::basic_node<ASTNode>
...
@@ -72,6 +21,9 @@ struct ASTNode : public parse_tree::basic_node<ASTNode>
std
::
shared_ptr
<
SymbolTable
>
m_symbol_table
;
std
::
shared_ptr
<
SymbolTable
>
m_symbol_table
;
std
::
unique_ptr
<
INodeProcessor
>
m_node_processor
;
std
::
unique_ptr
<
INodeProcessor
>
m_node_processor
;
ASTNodeDataType
m_data_type
{
ASTNodeDataType
::
undefined_t
};
ASTNodeDataVariant
m_value
;
PUGS_INLINE
PUGS_INLINE
void
void
execute
(
ExecUntilBreakOrContinue
&
exec_policy
)
execute
(
ExecUntilBreakOrContinue
&
exec_policy
)
...
@@ -81,9 +33,6 @@ struct ASTNode : public parse_tree::basic_node<ASTNode>
...
@@ -81,9 +33,6 @@ struct ASTNode : public parse_tree::basic_node<ASTNode>
m_node_processor
->
execute
(
exec_policy
);
m_node_processor
->
execute
(
exec_policy
);
}
}
}
}
ASTNodeDataType
m_data_type
{
ASTNodeDataType
::
undefined_t
};
ASTNodeDataVariant
m_value
;
};
};
#endif // AST_NODE_HPP
#endif // AST_NODE_HPP
This diff is collapsed.
Click to expand it.
src/language/ExecUntilBreakOrContinue.hpp
0 → 100644
+
44
−
0
View file @
b59052a2
#ifndef EXEC_UNTIL_BREAK_OR_CONTINUE_HPP
#define EXEC_UNTIL_BREAK_OR_CONTINUE_HPP
struct
ExecUntilBreakOrContinue
{
enum
class
JumpType
{
no_jump
,
break_jump
,
continue_jump
};
private
:
JumpType
m_jump_type
{
JumpType
::
no_jump
};
bool
m_exec
{
true
};
public
:
PUGS_INLINE
bool
exec
()
const
{
return
m_exec
;
}
PUGS_INLINE
JumpType
jumpType
()
const
{
return
m_jump_type
;
}
ExecUntilBreakOrContinue
&
operator
=
(
const
ExecUntilBreakOrContinue
&
)
=
delete
;
ExecUntilBreakOrContinue
&
operator
=
(
ExecUntilBreakOrContinue
&&
)
=
default
;
ExecUntilBreakOrContinue
()
=
default
;
constexpr
ExecUntilBreakOrContinue
(
const
JumpType
&
jump_type
)
:
m_jump_type
(
jump_type
),
m_exec
((
jump_type
==
JumpType
::
no_jump
))
{
;
}
};
#endif // EXEC_UNTIL_BREAK_OR_CONTINUE_HPP
This diff is collapsed.
Click to expand it.
src/language/INodeProcessor.hpp
0 → 100644
+
19
−
0
View file @
b59052a2
#ifndef I_NODE_PROCESSOR_HPP
#define I_NODE_PROCESSOR_HPP
class
ExecUntilBreakOrContinue
;
struct
INodeProcessor
{
virtual
void
execute
(
ExecUntilBreakOrContinue
&
exec_policy
)
=
0
;
virtual
std
::
string
describe
()
const
=
0
;
INodeProcessor
(
const
INodeProcessor
&
)
=
delete
;
INodeProcessor
()
=
default
;
virtual
~
INodeProcessor
()
=
default
;
};
#endif // I_NODE_PROCESSOR_HPP
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment