mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Update grammar * Update expression handling for uninit * update existing tests * Add new tests * Remove fullpath from escriptgrammar generation comment * fix tests * Update eScript guide * Declare escript version 0x11 * Add core-changes * Add `true` and `false` to grammar * true/false implementation * Fix existing tests * Add new tests * Update core changes * add docs * Fix BooleanValue::describe_to * bool optimizations * optimize uninit * remove unused var assignments * Update grammar for case labels for uninit, booleans * Fix case label handling for uninit, true, false * Tests * Fix compiler version display v1.1700000017881393 -> v1.17 * optimize boolean binary operations * fix unary boolean optimizer * add boolean, uninit optimizer test * Use new fmt lib apis * Fix compiler warning * really fix warning lol * Add Executor[Module]::getParam for bools, FindSubstance test
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#ifndef POLSERVER_SIMPLEVALUECLONER_H
|
|
#define POLSERVER_SIMPLEVALUECLONER_H
|
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "bscript/compiler/file/SourceLocation.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
class Report;
|
|
|
|
class SimpleValueCloner : private NodeVisitor
|
|
{
|
|
public:
|
|
explicit SimpleValueCloner( Report&, const SourceLocation& );
|
|
|
|
std::unique_ptr<Node> clone( Node& );
|
|
|
|
void visit_array_initializer( ArrayInitializer& ) override;
|
|
void visit_boolean_value( BooleanValue& ) override;
|
|
void visit_dictionary_initializer( DictionaryInitializer& ) override;
|
|
void visit_error_initializer( ErrorInitializer& ) override;
|
|
void visit_float_value( FloatValue& ) override;
|
|
void visit_function_call( FunctionCall& ) override;
|
|
void visit_identifier( Identifier& ) override;
|
|
void visit_integer_value( IntegerValue& ) override;
|
|
void visit_string_value( StringValue& ) override;
|
|
void visit_struct_initializer( StructInitializer& ) override;
|
|
void visit_uninitialized_value( UninitializedValue& ) override;
|
|
|
|
void visit_children( Node& parent ) override;
|
|
|
|
private:
|
|
Report& report;
|
|
std::unique_ptr<Node> cloned_value;
|
|
SourceLocation use_source_location;
|
|
};
|
|
|
|
} // namespace Pol::Bscript::Compiler
|
|
|
|
#endif // POLSERVER_SIMPLEVALUECLONER_H
|