forked from bartvdbraak/blender
update python keywords (remove exec, print, add nonlocal)
This commit is contained in:
parent
df29e91a69
commit
906cd4d8a6
@ -60,8 +60,8 @@ void txt_order_cursors (struct Text *text);
|
||||
int txt_find_string (struct Text *text, const char *findstr, int wrap, int match_case);
|
||||
int txt_has_sel (struct Text *text);
|
||||
int txt_get_span (struct TextLine *from, struct TextLine *to);
|
||||
int txt_utf8_offset_to_index(char *str, int offset);
|
||||
int txt_utf8_index_to_offset(char *str, int index);
|
||||
int txt_utf8_offset_to_index(const char *str, int offset);
|
||||
int txt_utf8_index_to_offset(const char *str, int index);
|
||||
void txt_move_up (struct Text *text, short sel);
|
||||
void txt_move_down (struct Text *text, short sel);
|
||||
void txt_move_left (struct Text *text, short sel);
|
||||
@ -107,11 +107,11 @@ struct TextMarker *txt_prev_marker (struct Text *text, struct TextMarker *marke
|
||||
struct TextMarker *txt_next_marker (struct Text *text, struct TextMarker *marker);
|
||||
|
||||
/* utility functions, could be moved somewhere more generic but are python/text related */
|
||||
int text_check_bracket(char ch);
|
||||
int text_check_delim(char ch);
|
||||
int text_check_digit(char ch);
|
||||
int text_check_identifier(char ch);
|
||||
int text_check_whitespace(char ch);
|
||||
int text_check_bracket(const char ch);
|
||||
int text_check_delim(const char ch);
|
||||
int text_check_digit(const char ch);
|
||||
int text_check_identifier(const char ch);
|
||||
int text_check_whitespace(const char ch);
|
||||
|
||||
|
||||
/* Undo opcodes */
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "limits.h"
|
||||
#include <limits.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
@ -622,7 +622,7 @@ void write_text(Text *text, const char *str) /* called directly from rna */
|
||||
/* Editing utility functions */
|
||||
/*****************************/
|
||||
|
||||
static void make_new_line (TextLine *line, char *newline)
|
||||
static void make_new_line(TextLine *line, char *newline)
|
||||
{
|
||||
if (line->line) MEM_freeN(line->line);
|
||||
if (line->format) MEM_freeN(line->format);
|
||||
@ -770,7 +770,7 @@ static void txt_curs_first (Text *text, TextLine **linep, int *charp)
|
||||
/* Cursor movement functions */
|
||||
/*****************************/
|
||||
|
||||
int txt_utf8_offset_to_index(char *str, int offset)
|
||||
int txt_utf8_offset_to_index(const char *str, int offset)
|
||||
{
|
||||
int index= 0, pos= 0;
|
||||
while (pos != offset) {
|
||||
@ -780,7 +780,7 @@ int txt_utf8_offset_to_index(char *str, int offset)
|
||||
return index;
|
||||
}
|
||||
|
||||
int txt_utf8_index_to_offset(char *str, int index)
|
||||
int txt_utf8_index_to_offset(const char *str, int index)
|
||||
{
|
||||
int offset= 0, pos= 0;
|
||||
while (pos != index) {
|
||||
@ -3244,7 +3244,7 @@ TextMarker *txt_next_marker(Text *text, TextMarker *marker)
|
||||
/* Character utility functions */
|
||||
/*******************************/
|
||||
|
||||
int text_check_bracket(char ch)
|
||||
int text_check_bracket(const char ch)
|
||||
{
|
||||
int a;
|
||||
char opens[] = "([{";
|
||||
@ -3259,10 +3259,11 @@ int text_check_bracket(char ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int text_check_delim(char ch)
|
||||
/* TODO, have a function for operators - http://docs.python.org/py3k/reference/lexical_analysis.html#operators */
|
||||
int text_check_delim(const char ch)
|
||||
{
|
||||
int a;
|
||||
char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,";
|
||||
char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,@";
|
||||
|
||||
for (a=0; a<(sizeof(delims)-1); a++) {
|
||||
if (ch==delims[a])
|
||||
@ -3271,14 +3272,14 @@ int text_check_delim(char ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int text_check_digit(char ch)
|
||||
int text_check_digit(const char ch)
|
||||
{
|
||||
if (ch < '0') return 0;
|
||||
if (ch <= '9') return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int text_check_identifier(char ch)
|
||||
int text_check_identifier(const char ch)
|
||||
{
|
||||
if (ch < '0') return 0;
|
||||
if (ch <= '9') return 1;
|
||||
@ -3289,7 +3290,7 @@ int text_check_identifier(char ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int text_check_whitespace(char ch)
|
||||
int text_check_whitespace(const char ch)
|
||||
{
|
||||
if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
|
||||
return 1;
|
||||
|
@ -184,16 +184,23 @@ void flatten_string_free(FlattenString *fs)
|
||||
* a non-identifier (see text_check_identifier(char)) or null character.
|
||||
*
|
||||
* If a built-in function is found, the length of the matching name is returned.
|
||||
* Otherwise, -1 is returned. */
|
||||
* Otherwise, -1 is returned.
|
||||
*
|
||||
* See:
|
||||
* http://docs.python.org/py3k/reference/lexical_analysis.html#keywords
|
||||
*/
|
||||
|
||||
static int find_builtinfunc(char *string)
|
||||
{
|
||||
int a, i;
|
||||
char builtinfuncs[][9] = {"and", "as", "assert", "break", "class", "continue", "def",
|
||||
"del", "elif", "else", "except", "exec", "finally",
|
||||
"for", "from", "global", "if", "import", "in",
|
||||
"is", "lambda", "not", "or", "pass", "print",
|
||||
"raise", "return", "try", "while", "yield", "with"};
|
||||
const char *builtinfuncs[] = {
|
||||
/* "False", "None", "True", */ /* see find_bool() */
|
||||
"and", "as", "assert", "break",
|
||||
"class", "continue", "def", "del", "elif", "else", "except",
|
||||
"finally", "for", "from", "global", "if", "import", "in",
|
||||
"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
|
||||
"return", "try", "while", "with", "yield",
|
||||
};
|
||||
|
||||
for (a = 0; a < sizeof(builtinfuncs) / sizeof(builtinfuncs[0]); a++) {
|
||||
i = 0;
|
||||
|
@ -376,16 +376,14 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop
|
||||
{
|
||||
int a = 0;
|
||||
|
||||
/* list from http://docs.python.org/reference/lexical_analysis.html#id5 */
|
||||
/* list from http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */
|
||||
static const char *kwlist[] = {
|
||||
/* "False", "None", "True", */
|
||||
"and", "as", "assert", "break",
|
||||
"class", "continue", "def", "del",
|
||||
"elif", "else", "except", "exec",
|
||||
"finally", "for", "from", "global",
|
||||
"if", "import", "in", "is",
|
||||
"lambda", "not", "or", "pass",
|
||||
"print", "raise", "return", "try",
|
||||
"while", "with", "yield", NULL
|
||||
"class", "continue", "def", "del", "elif", "else", "except",
|
||||
"finally", "for", "from", "global", "if", "import", "in",
|
||||
"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
|
||||
"return", "try", "while", "with", "yield", NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "limits.h"
|
||||
#include <limits.h>
|
||||
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
@ -1452,11 +1452,14 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Line Numbers Background", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
/* no longer used */
|
||||
#if 0
|
||||
prop = RNA_def_property(srna, "scroll_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "shade1");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Scroll Bar", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
#endif
|
||||
|
||||
prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "shade2");
|
||||
@ -1479,7 +1482,7 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "syntaxv");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Syntax Special", "");
|
||||
RNA_def_property_ui_text(prop, "Decorator", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
|
Loading…
Reference in New Issue
Block a user