polserver/pol-core/bscript/compiler/astbuilder/ValueBuilder.h
Kevin Eady 593cfffb83
Add uninit, true, false keywords to grammar (#596)
* 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
2024-01-20 05:38:25 +01:00

46 lines
1.3 KiB
C++

#ifndef POLSERVER_VALUEBUILDER_H
#define POLSERVER_VALUEBUILDER_H
#include "bscript/compiler/astbuilder/TreeBuilder.h"
#include <EscriptGrammar/EscriptParser.h>
namespace Pol::Bscript::Compiler
{
class BooleanValue;
class IntegerValue;
class FloatValue;
class FunctionReference;
class StringValue;
class Value;
class ValueBuilder : public TreeBuilder
{
public:
ValueBuilder( const SourceFileIdentifier&, BuilderWorkspace& );
std::unique_ptr<BooleanValue> bool_value( EscriptGrammar::EscriptParser::BoolLiteralContext* );
std::unique_ptr<FloatValue> float_value( EscriptGrammar::EscriptParser::FloatLiteralContext* );
std::unique_ptr<FunctionReference> function_reference(
EscriptGrammar::EscriptParser::FunctionReferenceContext* );
std::unique_ptr<IntegerValue> integer_value(
EscriptGrammar::EscriptParser::IntegerLiteralContext* );
std::unique_ptr<StringValue> string_value( antlr4::tree::TerminalNode* string_literal,
bool expect_quotes = true );
std::string unquote( antlr4::tree::TerminalNode* string_literal, bool expect_quotes = true );
std::unique_ptr<Value> value( EscriptGrammar::EscriptParser::LiteralContext* );
private:
int to_int( EscriptGrammar::EscriptParser::IntegerLiteralContext* );
};
} // namespace Pol::Bscript::Compiler
#endif // POLSERVER_VALUEBUILDER_H