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
49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
#include "CaseDispatchGroupVisitor.h"
|
|
|
|
#include "bscript/compiler/ast/BooleanValue.h"
|
|
#include "bscript/compiler/ast/CaseDispatchDefaultSelector.h"
|
|
#include "bscript/compiler/ast/IntegerValue.h"
|
|
#include "bscript/compiler/ast/StringValue.h"
|
|
#include "bscript/compiler/ast/UninitializedValue.h"
|
|
#include "bscript/compiler/codegen/CaseJumpDataBlock.h"
|
|
#include "bscript/compiler/model/FlowControlLabel.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
CaseDispatchGroupVisitor::CaseDispatchGroupVisitor( CaseJumpDataBlock& data_block,
|
|
FlowControlLabel& group_block_label,
|
|
FlowControlLabel& default_label )
|
|
: data_block( data_block ),
|
|
group_block_label( group_block_label ),
|
|
default_label( default_label )
|
|
{
|
|
}
|
|
void CaseDispatchGroupVisitor::visit_boolean_value( BooleanValue& boolean_node )
|
|
{
|
|
data_block.on_boolean_value_jump_to( boolean_node.value,
|
|
static_cast<unsigned short>( group_block_label.address() ) );
|
|
}
|
|
|
|
void CaseDispatchGroupVisitor::visit_case_dispatch_default_selector( CaseDispatchDefaultSelector& )
|
|
{
|
|
default_label = group_block_label;
|
|
}
|
|
|
|
void CaseDispatchGroupVisitor::visit_integer_value( IntegerValue& integer_node )
|
|
{
|
|
data_block.on_integer_value_jump_to( integer_node.value,
|
|
static_cast<unsigned short>( group_block_label.address() ) );
|
|
}
|
|
|
|
void CaseDispatchGroupVisitor::visit_string_value( StringValue& string_node )
|
|
{
|
|
data_block.on_string_value_jump_to( string_node.value,
|
|
static_cast<unsigned short>( group_block_label.address() ) );
|
|
}
|
|
|
|
void CaseDispatchGroupVisitor::visit_uninitialized_value( UninitializedValue& )
|
|
{
|
|
data_block.on_uninitialized_value_jump_to(
|
|
static_cast<unsigned short>( group_block_label.address() ) );
|
|
}
|
|
} // namespace Pol::Bscript::Compiler
|