You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
PI is now a built-in constant, fixes #2134
This commit is contained in:
@@ -267,6 +267,13 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
|
|||||||
constant->value=tokenizer->get_token_constant();
|
constant->value=tokenizer->get_token_constant();
|
||||||
tokenizer->advance();
|
tokenizer->advance();
|
||||||
expr=constant;
|
expr=constant;
|
||||||
|
} else if (tokenizer->get_token()==GDTokenizer::TK_CONST_PI) {
|
||||||
|
|
||||||
|
//constant defined by tokenizer
|
||||||
|
ConstantNode *constant = alloc_node<ConstantNode>();
|
||||||
|
constant->value=Math_PI;
|
||||||
|
tokenizer->advance();
|
||||||
|
expr=constant;
|
||||||
} else if (tokenizer->get_token()==GDTokenizer::TK_PR_PRELOAD) {
|
} else if (tokenizer->get_token()==GDTokenizer::TK_PR_PRELOAD) {
|
||||||
|
|
||||||
//constant defined by tokenizer
|
//constant defined by tokenizer
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ const char* GDTokenizer::token_names[TK_MAX]={
|
|||||||
"'?'",
|
"'?'",
|
||||||
"':'",
|
"':'",
|
||||||
"'\\n'",
|
"'\\n'",
|
||||||
|
"PI",
|
||||||
"Error",
|
"Error",
|
||||||
"EOF",
|
"EOF",
|
||||||
"Cursor"};
|
"Cursor"};
|
||||||
@@ -878,6 +879,7 @@ void GDTokenizerText::_advance() {
|
|||||||
{TK_CF_RETURN,"return"},
|
{TK_CF_RETURN,"return"},
|
||||||
{TK_CF_PASS,"pass"},
|
{TK_CF_PASS,"pass"},
|
||||||
{TK_SELF,"self"},
|
{TK_SELF,"self"},
|
||||||
|
{TK_CONST_PI,"PI"},
|
||||||
{TK_ERROR,NULL}
|
{TK_ERROR,NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1044,7 +1046,7 @@ void GDTokenizerText::advance(int p_amount) {
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define BYTECODE_VERSION 8
|
#define BYTECODE_VERSION 9
|
||||||
|
|
||||||
Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) {
|
Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) {
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ public:
|
|||||||
TK_QUESTION_MARK,
|
TK_QUESTION_MARK,
|
||||||
TK_COLON,
|
TK_COLON,
|
||||||
TK_NEWLINE,
|
TK_NEWLINE,
|
||||||
|
TK_CONST_PI,
|
||||||
TK_ERROR,
|
TK_ERROR,
|
||||||
TK_EOF,
|
TK_EOF,
|
||||||
TK_CURSOR, //used for code completion
|
TK_CURSOR, //used for code completion
|
||||||
|
|||||||
Reference in New Issue
Block a user