repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
boriel/zxbasic
zxbparser.py
p_function_def
def p_function_def(p): """ function_def : FUNCTION convention ID | SUB convention ID """ p[0] = make_func_declaration(p[3], p.lineno(3)) SYMBOL_TABLE.enter_scope(p[3]) FUNCTION_LEVEL.append(SYMBOL_TABLE.get_entry(p[3])) FUNCTION_LEVEL[-1].convention = p[2] if p[0] is no...
python
def p_function_def(p): """ function_def : FUNCTION convention ID | SUB convention ID """ p[0] = make_func_declaration(p[3], p.lineno(3)) SYMBOL_TABLE.enter_scope(p[3]) FUNCTION_LEVEL.append(SYMBOL_TABLE.get_entry(p[3])) FUNCTION_LEVEL[-1].convention = p[2] if p[0] is no...
[ "def", "p_function_def", "(", "p", ")", ":", "p", "[", "0", "]", "=", "make_func_declaration", "(", "p", "[", "3", "]", ",", "p", ".", "lineno", "(", "3", ")", ")", "SYMBOL_TABLE", ".", "enter_scope", "(", "p", "[", "3", "]", ")", "FUNCTION_LEVEL",...
function_def : FUNCTION convention ID | SUB convention ID
[ "function_def", ":", "FUNCTION", "convention", "ID", "|", "SUB", "convention", "ID" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2850-L2861
boriel/zxbasic
zxbparser.py
p_param_definition
def p_param_definition(p): """ param_definition : param_def """ p[0] = p[1] if p[0] is not None: p[0].byref = OPTIONS.byref.value
python
def p_param_definition(p): """ param_definition : param_def """ p[0] = p[1] if p[0] is not None: p[0].byref = OPTIONS.byref.value
[ "def", "p_param_definition", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "if", "p", "[", "0", "]", "is", "not", "None", ":", "p", "[", "0", "]", ".", "byref", "=", "OPTIONS", ".", "byref", ".", "value" ]
param_definition : param_def
[ "param_definition", ":", "param_def" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2926-L2931
boriel/zxbasic
zxbparser.py
p_param_def_type
def p_param_def_type(p): """ param_def : ID typedef """ if p[2] is not None: api.check.check_type_is_explicit(p.lineno(1), p[1], p[2]) p[0] = make_param_decl(p[1], p.lineno(1), p[2])
python
def p_param_def_type(p): """ param_def : ID typedef """ if p[2] is not None: api.check.check_type_is_explicit(p.lineno(1), p[1], p[2]) p[0] = make_param_decl(p[1], p.lineno(1), p[2])
[ "def", "p_param_def_type", "(", "p", ")", ":", "if", "p", "[", "2", "]", "is", "not", "None", ":", "api", ".", "check", ".", "check_type_is_explicit", "(", "p", ".", "lineno", "(", "1", ")", ",", "p", "[", "1", "]", ",", "p", "[", "2", "]", "...
param_def : ID typedef
[ "param_def", ":", "ID", "typedef" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2934-L2939
boriel/zxbasic
zxbparser.py
p_function_body
def p_function_body(p): """ function_body : program_co END FUNCTION | program_co END SUB | statements_co END FUNCTION | statements_co END SUB | co_statements_co END FUNCTION | co_statements_co END SUB ...
python
def p_function_body(p): """ function_body : program_co END FUNCTION | program_co END SUB | statements_co END FUNCTION | statements_co END SUB | co_statements_co END FUNCTION | co_statements_co END SUB ...
[ "def", "p_function_body", "(", "p", ")", ":", "if", "not", "FUNCTION_LEVEL", ":", "syntax_error", "(", "p", ".", "lineno", "(", "3", ")", ",", "\"Unexpected token 'END %s'. No Function or Sub has been defined.\"", "%", "p", "[", "2", "]", ")", "p", "[", "0", ...
function_body : program_co END FUNCTION | program_co END SUB | statements_co END FUNCTION | statements_co END SUB | co_statements_co END FUNCTION | co_statements_co END SUB | END FUNCTION ...
[ "function_body", ":", "program_co", "END", "FUNCTION", "|", "program_co", "END", "SUB", "|", "statements_co", "END", "FUNCTION", "|", "statements_co", "END", "SUB", "|", "co_statements_co", "END", "FUNCTION", "|", "co_statements_co", "END", "SUB", "|", "END", "F...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2942-L2969
boriel/zxbasic
zxbparser.py
p_type_def_empty
def p_type_def_empty(p): """ typedef : """ # Epsilon. Defaults to float p[0] = make_type(_TYPE(gl.DEFAULT_TYPE).name, p.lexer.lineno, implicit=True)
python
def p_type_def_empty(p): """ typedef : """ # Epsilon. Defaults to float p[0] = make_type(_TYPE(gl.DEFAULT_TYPE).name, p.lexer.lineno, implicit=True)
[ "def", "p_type_def_empty", "(", "p", ")", ":", "# Epsilon. Defaults to float", "p", "[", "0", "]", "=", "make_type", "(", "_TYPE", "(", "gl", ".", "DEFAULT_TYPE", ")", ".", "name", ",", "p", ".", "lexer", ".", "lineno", ",", "implicit", "=", "True", ")...
typedef :
[ "typedef", ":" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2972-L2975
boriel/zxbasic
zxbparser.py
p_expr_usr
def p_expr_usr(p): """ bexpr : USR bexpr %prec UMINUS """ if p[2].type_ == TYPE.string: p[0] = make_builtin(p.lineno(1), 'USR_STR', p[2], type_=TYPE.uinteger) else: p[0] = make_builtin(p.lineno(1), 'USR', make_typecast(TYPE.uinteger, p[2], p.lineno(1)), ...
python
def p_expr_usr(p): """ bexpr : USR bexpr %prec UMINUS """ if p[2].type_ == TYPE.string: p[0] = make_builtin(p.lineno(1), 'USR_STR', p[2], type_=TYPE.uinteger) else: p[0] = make_builtin(p.lineno(1), 'USR', make_typecast(TYPE.uinteger, p[2], p.lineno(1)), ...
[ "def", "p_expr_usr", "(", "p", ")", ":", "if", "p", "[", "2", "]", ".", "type_", "==", "TYPE", ".", "string", ":", "p", "[", "0", "]", "=", "make_builtin", "(", "p", ".", "lineno", "(", "1", ")", ",", "'USR_STR'", ",", "p", "[", "2", "]", "...
bexpr : USR bexpr %prec UMINUS
[ "bexpr", ":", "USR", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3056-L3064
boriel/zxbasic
zxbparser.py
p_expr_peek
def p_expr_peek(p): """ bexpr : PEEK bexpr %prec UMINUS """ p[0] = make_builtin(p.lineno(1), 'PEEK', make_typecast(TYPE.uinteger, p[2], p.lineno(1)), type_=TYPE.ubyte)
python
def p_expr_peek(p): """ bexpr : PEEK bexpr %prec UMINUS """ p[0] = make_builtin(p.lineno(1), 'PEEK', make_typecast(TYPE.uinteger, p[2], p.lineno(1)), type_=TYPE.ubyte)
[ "def", "p_expr_peek", "(", "p", ")", ":", "p", "[", "0", "]", "=", "make_builtin", "(", "p", ".", "lineno", "(", "1", ")", ",", "'PEEK'", ",", "make_typecast", "(", "TYPE", ".", "uinteger", ",", "p", "[", "2", "]", ",", "p", ".", "lineno", "(",...
bexpr : PEEK bexpr %prec UMINUS
[ "bexpr", ":", "PEEK", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3074-L3079
boriel/zxbasic
zxbparser.py
p_expr_peektype_
def p_expr_peektype_(p): """ bexpr : PEEK LP numbertype COMMA expr RP """ p[0] = make_builtin(p.lineno(1), 'PEEK', make_typecast(TYPE.uinteger, p[5], p.lineno(4)), type_=p[3])
python
def p_expr_peektype_(p): """ bexpr : PEEK LP numbertype COMMA expr RP """ p[0] = make_builtin(p.lineno(1), 'PEEK', make_typecast(TYPE.uinteger, p[5], p.lineno(4)), type_=p[3])
[ "def", "p_expr_peektype_", "(", "p", ")", ":", "p", "[", "0", "]", "=", "make_builtin", "(", "p", ".", "lineno", "(", "1", ")", ",", "'PEEK'", ",", "make_typecast", "(", "TYPE", ".", "uinteger", ",", "p", "[", "5", "]", ",", "p", ".", "lineno", ...
bexpr : PEEK LP numbertype COMMA expr RP
[ "bexpr", ":", "PEEK", "LP", "numbertype", "COMMA", "expr", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3082-L3087
boriel/zxbasic
zxbparser.py
p_expr_lbound
def p_expr_lbound(p): """ bexpr : LBOUND LP ARRAY_ID RP | UBOUND LP ARRAY_ID RP """ entry = SYMBOL_TABLE.access_array(p[3], p.lineno(3)) if entry is None: p[0] = None return entry.accessed = True if p[1] == 'LBOUND': p[0] = make_number(entry.bounds[OPTIONS....
python
def p_expr_lbound(p): """ bexpr : LBOUND LP ARRAY_ID RP | UBOUND LP ARRAY_ID RP """ entry = SYMBOL_TABLE.access_array(p[3], p.lineno(3)) if entry is None: p[0] = None return entry.accessed = True if p[1] == 'LBOUND': p[0] = make_number(entry.bounds[OPTIONS....
[ "def", "p_expr_lbound", "(", "p", ")", ":", "entry", "=", "SYMBOL_TABLE", ".", "access_array", "(", "p", "[", "3", "]", ",", "p", ".", "lineno", "(", "3", ")", ")", "if", "entry", "is", "None", ":", "p", "[", "0", "]", "=", "None", "return", "e...
bexpr : LBOUND LP ARRAY_ID RP | UBOUND LP ARRAY_ID RP
[ "bexpr", ":", "LBOUND", "LP", "ARRAY_ID", "RP", "|", "UBOUND", "LP", "ARRAY_ID", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3098-L3114
boriel/zxbasic
zxbparser.py
p_expr_lbound_expr
def p_expr_lbound_expr(p): """ bexpr : LBOUND LP ARRAY_ID COMMA expr RP | UBOUND LP ARRAY_ID COMMA expr RP """ entry = SYMBOL_TABLE.access_array(p[3], p.lineno(3)) if entry is None: p[0] = None return entry.accessed = True num = make_typecast(TYPE.uinteger, p[5], p....
python
def p_expr_lbound_expr(p): """ bexpr : LBOUND LP ARRAY_ID COMMA expr RP | UBOUND LP ARRAY_ID COMMA expr RP """ entry = SYMBOL_TABLE.access_array(p[3], p.lineno(3)) if entry is None: p[0] = None return entry.accessed = True num = make_typecast(TYPE.uinteger, p[5], p....
[ "def", "p_expr_lbound_expr", "(", "p", ")", ":", "entry", "=", "SYMBOL_TABLE", ".", "access_array", "(", "p", "[", "3", "]", ",", "p", ".", "lineno", "(", "3", ")", ")", "if", "entry", "is", "None", ":", "p", "[", "0", "]", "=", "None", "return",...
bexpr : LBOUND LP ARRAY_ID COMMA expr RP | UBOUND LP ARRAY_ID COMMA expr RP
[ "bexpr", ":", "LBOUND", "LP", "ARRAY_ID", "COMMA", "expr", "RP", "|", "UBOUND", "LP", "ARRAY_ID", "COMMA", "expr", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3117-L3151
boriel/zxbasic
zxbparser.py
p_len
def p_len(p): """ bexpr : LEN bexpr %prec UMINUS """ arg = p[2] if arg is None: p[0] = None elif isinstance(arg, symbols.VAR) and arg.class_ == CLASS.array: p[0] = make_number(len(arg.bounds), lineno=p.lineno(1)) # Do constant folding elif arg.type_ != TYPE.string: api.e...
python
def p_len(p): """ bexpr : LEN bexpr %prec UMINUS """ arg = p[2] if arg is None: p[0] = None elif isinstance(arg, symbols.VAR) and arg.class_ == CLASS.array: p[0] = make_number(len(arg.bounds), lineno=p.lineno(1)) # Do constant folding elif arg.type_ != TYPE.string: api.e...
[ "def", "p_len", "(", "p", ")", ":", "arg", "=", "p", "[", "2", "]", "if", "arg", "is", "None", ":", "p", "[", "0", "]", "=", "None", "elif", "isinstance", "(", "arg", ",", "symbols", ".", "VAR", ")", "and", "arg", ".", "class_", "==", "CLASS"...
bexpr : LEN bexpr %prec UMINUS
[ "bexpr", ":", "LEN", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3154-L3168
boriel/zxbasic
zxbparser.py
p_sizeof
def p_sizeof(p): """ bexpr : SIZEOF LP type RP | SIZEOF LP ID RP | SIZEOF LP ARRAY_ID RP """ if TYPE.to_type(p[3].lower()) is not None: p[0] = make_number(TYPE.size(TYPE.to_type(p[3].lower())), lineno=p.lineno(3)) else: entry = SYMBOL_...
python
def p_sizeof(p): """ bexpr : SIZEOF LP type RP | SIZEOF LP ID RP | SIZEOF LP ARRAY_ID RP """ if TYPE.to_type(p[3].lower()) is not None: p[0] = make_number(TYPE.size(TYPE.to_type(p[3].lower())), lineno=p.lineno(3)) else: entry = SYMBOL_...
[ "def", "p_sizeof", "(", "p", ")", ":", "if", "TYPE", ".", "to_type", "(", "p", "[", "3", "]", ".", "lower", "(", ")", ")", "is", "not", "None", ":", "p", "[", "0", "]", "=", "make_number", "(", "TYPE", ".", "size", "(", "TYPE", ".", "to_type"...
bexpr : SIZEOF LP type RP | SIZEOF LP ID RP | SIZEOF LP ARRAY_ID RP
[ "bexpr", ":", "SIZEOF", "LP", "type", "RP", "|", "SIZEOF", "LP", "ID", "RP", "|", "SIZEOF", "LP", "ARRAY_ID", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3171-L3181
boriel/zxbasic
zxbparser.py
p_str
def p_str(p): """ string : STR expr %prec UMINUS """ if is_number(p[2]): # A constant is converted to string directly p[0] = symbols.STRING(str(p[2].value), p.lineno(1)) else: p[0] = make_builtin(p.lineno(1), 'STR', make_typecast(TYPE.float_, p[2], p.lineno(1...
python
def p_str(p): """ string : STR expr %prec UMINUS """ if is_number(p[2]): # A constant is converted to string directly p[0] = symbols.STRING(str(p[2].value), p.lineno(1)) else: p[0] = make_builtin(p.lineno(1), 'STR', make_typecast(TYPE.float_, p[2], p.lineno(1...
[ "def", "p_str", "(", "p", ")", ":", "if", "is_number", "(", "p", "[", "2", "]", ")", ":", "# A constant is converted to string directly", "p", "[", "0", "]", "=", "symbols", ".", "STRING", "(", "str", "(", "p", "[", "2", "]", ".", "value", ")", ","...
string : STR expr %prec UMINUS
[ "string", ":", "STR", "expr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3184-L3192
boriel/zxbasic
zxbparser.py
p_chr_one
def p_chr_one(p): """ string : CHR bexpr %prec UMINUS """ arg_list = make_arg_list(make_argument(p[2], p.lineno(1))) arg_list[0].value = make_typecast(TYPE.ubyte, arg_list[0].value, p.lineno(1)) p[0] = make_builtin(p.lineno(1), 'CHR', arg_list, type_=TYPE.string)
python
def p_chr_one(p): """ string : CHR bexpr %prec UMINUS """ arg_list = make_arg_list(make_argument(p[2], p.lineno(1))) arg_list[0].value = make_typecast(TYPE.ubyte, arg_list[0].value, p.lineno(1)) p[0] = make_builtin(p.lineno(1), 'CHR', arg_list, type_=TYPE.string)
[ "def", "p_chr_one", "(", "p", ")", ":", "arg_list", "=", "make_arg_list", "(", "make_argument", "(", "p", "[", "2", "]", ",", "p", ".", "lineno", "(", "1", ")", ")", ")", "arg_list", "[", "0", "]", ".", "value", "=", "make_typecast", "(", "TYPE", ...
string : CHR bexpr %prec UMINUS
[ "string", ":", "CHR", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3201-L3206
boriel/zxbasic
zxbparser.py
p_chr
def p_chr(p): """ string : CHR arg_list """ if len(p[2]) < 1: syntax_error(p.lineno(1), "CHR$ function need at less 1 parameter") p[0] = None return for i in range(len(p[2])): # Convert every argument to 8bit unsigned p[2][i].value = make_typecast(TYPE.ubyte, p[2][i].va...
python
def p_chr(p): """ string : CHR arg_list """ if len(p[2]) < 1: syntax_error(p.lineno(1), "CHR$ function need at less 1 parameter") p[0] = None return for i in range(len(p[2])): # Convert every argument to 8bit unsigned p[2][i].value = make_typecast(TYPE.ubyte, p[2][i].va...
[ "def", "p_chr", "(", "p", ")", ":", "if", "len", "(", "p", "[", "2", "]", ")", "<", "1", ":", "syntax_error", "(", "p", ".", "lineno", "(", "1", ")", ",", "\"CHR$ function need at less 1 parameter\"", ")", "p", "[", "0", "]", "=", "None", "return",...
string : CHR arg_list
[ "string", ":", "CHR", "arg_list" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3209-L3220
boriel/zxbasic
zxbparser.py
p_val
def p_val(p): """ bexpr : VAL bexpr %prec UMINUS """ def val(s): try: x = float(s) except: x = 0 warning(p.lineno(1), "Invalid string numeric constant '%s' evaluated as 0" % s) return x if p[2].type_ != TYPE.string: api.errmsg.syntax_...
python
def p_val(p): """ bexpr : VAL bexpr %prec UMINUS """ def val(s): try: x = float(s) except: x = 0 warning(p.lineno(1), "Invalid string numeric constant '%s' evaluated as 0" % s) return x if p[2].type_ != TYPE.string: api.errmsg.syntax_...
[ "def", "p_val", "(", "p", ")", ":", "def", "val", "(", "s", ")", ":", "try", ":", "x", "=", "float", "(", "s", ")", "except", ":", "x", "=", "0", "warning", "(", "p", ".", "lineno", "(", "1", ")", ",", "\"Invalid string numeric constant '%s' evalua...
bexpr : VAL bexpr %prec UMINUS
[ "bexpr", ":", "VAL", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3223-L3239
boriel/zxbasic
zxbparser.py
p_code
def p_code(p): """ bexpr : CODE bexpr %prec UMINUS """ def asc(x): if len(x): return ord(x[0]) return 0 if p[2] is None: p[0] = None return if p[2].type_ != TYPE.string: api.errmsg.syntax_error_expected_string(p.lineno(1), TYPE.to_string(p[2].t...
python
def p_code(p): """ bexpr : CODE bexpr %prec UMINUS """ def asc(x): if len(x): return ord(x[0]) return 0 if p[2] is None: p[0] = None return if p[2].type_ != TYPE.string: api.errmsg.syntax_error_expected_string(p.lineno(1), TYPE.to_string(p[2].t...
[ "def", "p_code", "(", "p", ")", ":", "def", "asc", "(", "x", ")", ":", "if", "len", "(", "x", ")", ":", "return", "ord", "(", "x", "[", "0", "]", ")", "return", "0", "if", "p", "[", "2", "]", "is", "None", ":", "p", "[", "0", "]", "=", ...
bexpr : CODE bexpr %prec UMINUS
[ "bexpr", ":", "CODE", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3242-L3260
boriel/zxbasic
zxbparser.py
p_sgn
def p_sgn(p): """ bexpr : SGN bexpr %prec UMINUS """ sgn = lambda x: x < 0 and -1 or x > 0 and 1 or 0 # noqa if p[2].type_ == TYPE.string: syntax_error(p.lineno(1), "Expected a numeric expression, got TYPE.string instead") p[0] = None else: if is_unsigned(p[2]) and not is_n...
python
def p_sgn(p): """ bexpr : SGN bexpr %prec UMINUS """ sgn = lambda x: x < 0 and -1 or x > 0 and 1 or 0 # noqa if p[2].type_ == TYPE.string: syntax_error(p.lineno(1), "Expected a numeric expression, got TYPE.string instead") p[0] = None else: if is_unsigned(p[2]) and not is_n...
[ "def", "p_sgn", "(", "p", ")", ":", "sgn", "=", "lambda", "x", ":", "x", "<", "0", "and", "-", "1", "or", "x", ">", "0", "and", "1", "or", "0", "# noqa", "if", "p", "[", "2", "]", ".", "type_", "==", "TYPE", ".", "string", ":", "syntax_erro...
bexpr : SGN bexpr %prec UMINUS
[ "bexpr", ":", "SGN", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3263-L3275
boriel/zxbasic
zxbparser.py
p_expr_trig
def p_expr_trig(p): """ bexpr : math_fn bexpr %prec UMINUS """ p[0] = make_builtin(p.lineno(1), p[1], make_typecast(TYPE.float_, p[2], p.lineno(1)), {'SIN': math.sin, 'COS': math.cos, 'TAN': math.tan, ...
python
def p_expr_trig(p): """ bexpr : math_fn bexpr %prec UMINUS """ p[0] = make_builtin(p.lineno(1), p[1], make_typecast(TYPE.float_, p[2], p.lineno(1)), {'SIN': math.sin, 'COS': math.cos, 'TAN': math.tan, ...
[ "def", "p_expr_trig", "(", "p", ")", ":", "p", "[", "0", "]", "=", "make_builtin", "(", "p", ".", "lineno", "(", "1", ")", ",", "p", "[", "1", "]", ",", "make_typecast", "(", "TYPE", ".", "float_", ",", "p", "[", "2", "]", ",", "p", ".", "l...
bexpr : math_fn bexpr %prec UMINUS
[ "bexpr", ":", "math_fn", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3281-L3295
boriel/zxbasic
zxbparser.py
p_abs
def p_abs(p): """ bexpr : ABS bexpr %prec UMINUS """ if is_unsigned(p[2]): p[0] = p[2] warning(p.lineno(1), "Redundant operation ABS for unsigned value") return p[0] = make_builtin(p.lineno(1), 'ABS', p[2], lambda x: x if x >= 0 else -x)
python
def p_abs(p): """ bexpr : ABS bexpr %prec UMINUS """ if is_unsigned(p[2]): p[0] = p[2] warning(p.lineno(1), "Redundant operation ABS for unsigned value") return p[0] = make_builtin(p.lineno(1), 'ABS', p[2], lambda x: x if x >= 0 else -x)
[ "def", "p_abs", "(", "p", ")", ":", "if", "is_unsigned", "(", "p", "[", "2", "]", ")", ":", "p", "[", "0", "]", "=", "p", "[", "2", "]", "warning", "(", "p", ".", "lineno", "(", "1", ")", ",", "\"Redundant operation ABS for unsigned value\"", ")", ...
bexpr : ABS bexpr %prec UMINUS
[ "bexpr", ":", "ABS", "bexpr", "%prec", "UMINUS" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L3321-L3329
boriel/zxbasic
symbols/bound.py
SymbolBOUND.make_node
def make_node(lower, upper, lineno): """ Creates an array bound """ if not is_static(lower, upper): syntax_error(lineno, 'Array bounds must be constants') return None if isinstance(lower, SymbolVAR): lower = lower.value if isinstance(upper, Sy...
python
def make_node(lower, upper, lineno): """ Creates an array bound """ if not is_static(lower, upper): syntax_error(lineno, 'Array bounds must be constants') return None if isinstance(lower, SymbolVAR): lower = lower.value if isinstance(upper, Sy...
[ "def", "make_node", "(", "lower", ",", "upper", ",", "lineno", ")", ":", "if", "not", "is_static", "(", "lower", ",", "upper", ")", ":", "syntax_error", "(", "lineno", ",", "'Array bounds must be constants'", ")", "return", "None", "if", "isinstance", "(", ...
Creates an array bound
[ "Creates", "an", "array", "bound" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/bound.py#L44-L67
boriel/zxbasic
basic.py
Basic.number
def number(self, number): """ Returns a floating point (or integer) number for a BASIC program. That is: It's ASCII representation followed by 5 bytes in floating point or integer format (if number in (-65535 + 65535) """ s = [ord(x) for x in str(number)] + [14] # Bytes of strin...
python
def number(self, number): """ Returns a floating point (or integer) number for a BASIC program. That is: It's ASCII representation followed by 5 bytes in floating point or integer format (if number in (-65535 + 65535) """ s = [ord(x) for x in str(number)] + [14] # Bytes of strin...
[ "def", "number", "(", "self", ",", "number", ")", ":", "s", "=", "[", "ord", "(", "x", ")", "for", "x", "in", "str", "(", "number", ")", "]", "+", "[", "14", "]", "# Bytes of string representation in bytes", "if", "number", "==", "int", "(", "number"...
Returns a floating point (or integer) number for a BASIC program. That is: It's ASCII representation followed by 5 bytes in floating point or integer format (if number in (-65535 + 65535)
[ "Returns", "a", "floating", "point", "(", "or", "integer", ")", "number", "for", "a", "BASIC", "program", ".", "That", "is", ":", "It", "s", "ASCII", "representation", "followed", "by", "5", "bytes", "in", "floating", "point", "or", "integer", "format", ...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/basic.py#L79-L99
boriel/zxbasic
basic.py
Basic.parse_sentence
def parse_sentence(self, string): """ Parses the given sentence. BASIC commands must be types UPPERCASE and as SEEN in ZX BASIC. e.g. GO SUB for gosub, etc... """ result = [] def shift(string_): """ Returns first word of a string, and remaining """ ...
python
def parse_sentence(self, string): """ Parses the given sentence. BASIC commands must be types UPPERCASE and as SEEN in ZX BASIC. e.g. GO SUB for gosub, etc... """ result = [] def shift(string_): """ Returns first word of a string, and remaining """ ...
[ "def", "parse_sentence", "(", "self", ",", "string", ")", ":", "result", "=", "[", "]", "def", "shift", "(", "string_", ")", ":", "\"\"\" Returns first word of a string, and remaining\n \"\"\"", "string_", "=", "string_", ".", "strip", "(", ")", "# Remo...
Parses the given sentence. BASIC commands must be types UPPERCASE and as SEEN in ZX BASIC. e.g. GO SUB for gosub, etc...
[ "Parses", "the", "given", "sentence", ".", "BASIC", "commands", "must", "be", "types", "UPPERCASE", "and", "as", "SEEN", "in", "ZX", "BASIC", ".", "e", ".", "g", ".", "GO", "SUB", "for", "gosub", "etc", "..." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/basic.py#L114-L141
boriel/zxbasic
basic.py
Basic.sentence_bytes
def sentence_bytes(self, sentence): """ Return bytes of a sentence. This is a very simple parser. Sentence is a list of strings and numbers. 1st element of sentence MUST match a token. """ result = [TOKENS[sentence[0]]] for i in sentence[1:]: # Remaining bytes ...
python
def sentence_bytes(self, sentence): """ Return bytes of a sentence. This is a very simple parser. Sentence is a list of strings and numbers. 1st element of sentence MUST match a token. """ result = [TOKENS[sentence[0]]] for i in sentence[1:]: # Remaining bytes ...
[ "def", "sentence_bytes", "(", "self", ",", "sentence", ")", ":", "result", "=", "[", "TOKENS", "[", "sentence", "[", "0", "]", "]", "]", "for", "i", "in", "sentence", "[", "1", ":", "]", ":", "# Remaining bytes", "if", "isinstance", "(", "i", ",", ...
Return bytes of a sentence. This is a very simple parser. Sentence is a list of strings and numbers. 1st element of sentence MUST match a token.
[ "Return", "bytes", "of", "a", "sentence", ".", "This", "is", "a", "very", "simple", "parser", ".", "Sentence", "is", "a", "list", "of", "strings", "and", "numbers", ".", "1st", "element", "of", "sentence", "MUST", "match", "a", "token", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/basic.py#L143-L158
boriel/zxbasic
basic.py
Basic.line
def line(self, sentences, line_number=None): """ Return the bytes for a basic line. If no line number is given, current one + 10 will be used Sentences if a list of sentences """ if line_number is None: line_number = self.current_line + 10 self.current_line = ...
python
def line(self, sentences, line_number=None): """ Return the bytes for a basic line. If no line number is given, current one + 10 will be used Sentences if a list of sentences """ if line_number is None: line_number = self.current_line + 10 self.current_line = ...
[ "def", "line", "(", "self", ",", "sentences", ",", "line_number", "=", "None", ")", ":", "if", "line_number", "is", "None", ":", "line_number", "=", "self", ".", "current_line", "+", "10", "self", ".", "current_line", "=", "line_number", "sep", "=", "[",...
Return the bytes for a basic line. If no line number is given, current one + 10 will be used Sentences if a list of sentences
[ "Return", "the", "bytes", "for", "a", "basic", "line", ".", "If", "no", "line", "number", "is", "given", "current", "one", "+", "10", "will", "be", "used", "Sentences", "if", "a", "list", "of", "sentences" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/basic.py#L160-L179
boriel/zxbasic
basic.py
Basic.add_line
def add_line(self, sentences, line_number=None): """ Add current line to the output. See self.line() for more info """ self.bytes += self.line(sentences, line_number)
python
def add_line(self, sentences, line_number=None): """ Add current line to the output. See self.line() for more info """ self.bytes += self.line(sentences, line_number)
[ "def", "add_line", "(", "self", ",", "sentences", ",", "line_number", "=", "None", ")", ":", "self", ".", "bytes", "+=", "self", ".", "line", "(", "sentences", ",", "line_number", ")" ]
Add current line to the output. See self.line() for more info
[ "Add", "current", "line", "to", "the", "output", ".", "See", "self", ".", "line", "()", "for", "more", "info" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/basic.py#L181-L185
boriel/zxbasic
symbols/arrayaccess.py
SymbolARRAYACCESS.offset
def offset(self): """ If this is a constant access (e.g. A(1)) return the offset in bytes from the beginning of the variable in memory. Otherwise, if it's not constant (e.g. A(i)) returns None """ offset = 0 # Now we must typecast each argument to a u16 (...
python
def offset(self): """ If this is a constant access (e.g. A(1)) return the offset in bytes from the beginning of the variable in memory. Otherwise, if it's not constant (e.g. A(i)) returns None """ offset = 0 # Now we must typecast each argument to a u16 (...
[ "def", "offset", "(", "self", ")", ":", "offset", "=", "0", "# Now we must typecast each argument to a u16 (POINTER) type", "# i is the dimension ith index, b is the bound", "for", "i", ",", "b", "in", "zip", "(", "self", ".", "arglist", ",", "self", ".", "entry", "...
If this is a constant access (e.g. A(1)) return the offset in bytes from the beginning of the variable in memory. Otherwise, if it's not constant (e.g. A(i)) returns None
[ "If", "this", "is", "a", "constant", "access", "(", "e", ".", "g", ".", "A", "(", "1", "))", "return", "the", "offset", "in", "bytes", "from", "the", "beginning", "of", "the", "variable", "in", "memory", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/arrayaccess.py#L73-L96
boriel/zxbasic
symbols/arrayaccess.py
SymbolARRAYACCESS.make_node
def make_node(cls, id_, arglist, lineno): """ Creates an array access. A(x1, x2, ..., xn) """ assert isinstance(arglist, SymbolARGLIST) variable = gl.SYMBOL_TABLE.access_array(id_, lineno) if variable is None: return None if len(variable.bounds) != len(arglis...
python
def make_node(cls, id_, arglist, lineno): """ Creates an array access. A(x1, x2, ..., xn) """ assert isinstance(arglist, SymbolARGLIST) variable = gl.SYMBOL_TABLE.access_array(id_, lineno) if variable is None: return None if len(variable.bounds) != len(arglis...
[ "def", "make_node", "(", "cls", ",", "id_", ",", "arglist", ",", "lineno", ")", ":", "assert", "isinstance", "(", "arglist", ",", "SymbolARGLIST", ")", "variable", "=", "gl", ".", "SYMBOL_TABLE", ".", "access_array", "(", "id_", ",", "lineno", ")", "if",...
Creates an array access. A(x1, x2, ..., xn)
[ "Creates", "an", "array", "access", ".", "A", "(", "x1", "x2", "...", "xn", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/arrayaccess.py#L99-L127
boriel/zxbasic
zxbasmpplex.py
Lexer.t_INITIAL_COMMENT
def t_INITIAL_COMMENT(self, t): r';' t.lexer.push_state('asmcomment') t.type = 'TOKEN' t.value = ';' return t
python
def t_INITIAL_COMMENT(self, t): r';' t.lexer.push_state('asmcomment') t.type = 'TOKEN' t.value = ';' return t
[ "def", "t_INITIAL_COMMENT", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "push_state", "(", "'asmcomment'", ")", "t", ".", "type", "=", "'TOKEN'", "t", ".", "value", "=", "';'", "return", "t" ]
r';
[ "r", ";" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L74-L79
boriel/zxbasic
zxbasmpplex.py
Lexer.t_prepro_define_defargs_defargsopt_defexpr_pragma_NEWLINE
def t_prepro_define_defargs_defargsopt_defexpr_pragma_NEWLINE(self, t): r'\r?\n' t.lexer.lineno += 1 t.lexer.pop_state() return t
python
def t_prepro_define_defargs_defargsopt_defexpr_pragma_NEWLINE(self, t): r'\r?\n' t.lexer.lineno += 1 t.lexer.pop_state() return t
[ "def", "t_prepro_define_defargs_defargsopt_defexpr_pragma_NEWLINE", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "lexer", ".", "pop_state", "(", ")", "return", "t" ]
r'\r?\n
[ "r", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L111-L115
boriel/zxbasic
zxbasmpplex.py
Lexer.t_prepro_define_pragma_defargs_defargsopt_CONTINUE
def t_prepro_define_pragma_defargs_defargsopt_CONTINUE(self, t): r'[_\\]\r?\n' t.lexer.lineno += 1 t.value = t.value[1:] t.type = 'NEWLINE' return t
python
def t_prepro_define_pragma_defargs_defargsopt_CONTINUE(self, t): r'[_\\]\r?\n' t.lexer.lineno += 1 t.value = t.value[1:] t.type = 'NEWLINE' return t
[ "def", "t_prepro_define_pragma_defargs_defargsopt_CONTINUE", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "value", "=", "t", ".", "value", "[", "1", ":", "]", "t", ".", "type", "=", "'NEWLINE'", "return", "t" ...
r'[_\\]\r?\n
[ "r", "[", "_", "\\\\", "]", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L127-L132
boriel/zxbasic
zxbasmpplex.py
Lexer.t_prepro_ID
def t_prepro_ID(self, t): r'[_a-zA-Z][_a-zA-Z0-9]*' # preprocessor directives t.type = reserved_directives.get(t.value.lower(), 'ID') if t.type == 'DEFINE': t.lexer.begin('define') elif t.type == 'PRAGMA': t.lexer.begin('pragma') return t
python
def t_prepro_ID(self, t): r'[_a-zA-Z][_a-zA-Z0-9]*' # preprocessor directives t.type = reserved_directives.get(t.value.lower(), 'ID') if t.type == 'DEFINE': t.lexer.begin('define') elif t.type == 'PRAGMA': t.lexer.begin('pragma') return t
[ "def", "t_prepro_ID", "(", "self", ",", "t", ")", ":", "# preprocessor directives", "t", ".", "type", "=", "reserved_directives", ".", "get", "(", "t", ".", "value", ".", "lower", "(", ")", ",", "'ID'", ")", "if", "t", ".", "type", "==", "'DEFINE'", ...
r'[_a-zA-Z][_a-zA-Z0-9]*
[ "r", "[", "_a", "-", "zA", "-", "Z", "]", "[", "_a", "-", "zA", "-", "Z0", "-", "9", "]", "*" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L149-L156
boriel/zxbasic
zxbasmpplex.py
Lexer.t_INIIAL_sharp
def t_INIIAL_sharp(self, t): r'\#' # Only matches if at beginning of line and "#" if t.value == '#' and self.find_column(t) == 1: t.lexer.push_state('prepro')
python
def t_INIIAL_sharp(self, t): r'\#' # Only matches if at beginning of line and "#" if t.value == '#' and self.find_column(t) == 1: t.lexer.push_state('prepro')
[ "def", "t_INIIAL_sharp", "(", "self", ",", "t", ")", ":", "# Only matches if at beginning of line and \"#\"", "if", "t", ".", "value", "==", "'#'", "and", "self", ".", "find_column", "(", "t", ")", "==", "1", ":", "t", ".", "lexer", ".", "push_state", "(",...
r'\#
[ "r", "\\", "#" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L249-L252
boriel/zxbasic
zxbasmpplex.py
Lexer.put_current_line
def put_current_line(self, prefix=''): """ Returns line and file for include / end of include sequences. """ return '%s#line %i "%s"\n' % (prefix, self.lex.lineno, os.path.basename(self.filestack[-1][0]))
python
def put_current_line(self, prefix=''): """ Returns line and file for include / end of include sequences. """ return '%s#line %i "%s"\n' % (prefix, self.lex.lineno, os.path.basename(self.filestack[-1][0]))
[ "def", "put_current_line", "(", "self", ",", "prefix", "=", "''", ")", ":", "return", "'%s#line %i \"%s\"\\n'", "%", "(", "prefix", ",", "self", ".", "lex", ".", "lineno", ",", "os", ".", "path", ".", "basename", "(", "self", ".", "filestack", "[", "-"...
Returns line and file for include / end of include sequences.
[ "Returns", "line", "and", "file", "for", "include", "/", "end", "of", "include", "sequences", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L295-L298
boriel/zxbasic
zxbasmpplex.py
Lexer.include
def include(self, filename): """ Changes FILENAME and line count """ if filename != STDIN and filename in [x[0] for x in self.filestack]: # Already included? self.warning(' Recursive inclusion') self.filestack.append([filename, 1, self.lex, self.input_data]) self.le...
python
def include(self, filename): """ Changes FILENAME and line count """ if filename != STDIN and filename in [x[0] for x in self.filestack]: # Already included? self.warning(' Recursive inclusion') self.filestack.append([filename, 1, self.lex, self.input_data]) self.le...
[ "def", "include", "(", "self", ",", "filename", ")", ":", "if", "filename", "!=", "STDIN", "and", "filename", "in", "[", "x", "[", "0", "]", "for", "x", "in", "self", ".", "filestack", "]", ":", "# Already included?", "self", ".", "warning", "(", "' ...
Changes FILENAME and line count
[ "Changes", "FILENAME", "and", "line", "count" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L300-L322
boriel/zxbasic
symbols/var.py
SymbolVAR.add_alias
def add_alias(self, entry): """ Adds id to the current list 'aliased_by' """ assert isinstance(entry, SymbolVAR) self.aliased_by.append(entry)
python
def add_alias(self, entry): """ Adds id to the current list 'aliased_by' """ assert isinstance(entry, SymbolVAR) self.aliased_by.append(entry)
[ "def", "add_alias", "(", "self", ",", "entry", ")", ":", "assert", "isinstance", "(", "entry", ",", "SymbolVAR", ")", "self", ".", "aliased_by", ".", "append", "(", "entry", ")" ]
Adds id to the current list 'aliased_by'
[ "Adds", "id", "to", "the", "current", "list", "aliased_by" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/var.py#L78-L82
boriel/zxbasic
symbols/var.py
SymbolVAR.make_alias
def make_alias(self, entry): """ Make this variable an alias of another one """ entry.add_alias(self) self.alias = entry self.scope = entry.scope # Local aliases can be "global" (static) self.byref = entry.byref self.offset = entry.offset self.addr = entr...
python
def make_alias(self, entry): """ Make this variable an alias of another one """ entry.add_alias(self) self.alias = entry self.scope = entry.scope # Local aliases can be "global" (static) self.byref = entry.byref self.offset = entry.offset self.addr = entr...
[ "def", "make_alias", "(", "self", ",", "entry", ")", ":", "entry", ".", "add_alias", "(", "self", ")", "self", ".", "alias", "=", "entry", "self", ".", "scope", "=", "entry", ".", "scope", "# Local aliases can be \"global\" (static)", "self", ".", "byref", ...
Make this variable an alias of another one
[ "Make", "this", "variable", "an", "alias", "of", "another", "one" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/var.py#L84-L92
boriel/zxbasic
symbols/var.py
SymbolVAR.to_label
def to_label(var_instance): """ Converts a var_instance to a label one """ # This can be done 'cause LABEL is just a dummy descent of VAR assert isinstance(var_instance, SymbolVAR) from symbols import LABEL var_instance.__class__ = LABEL var_instance.class_ = CLAS...
python
def to_label(var_instance): """ Converts a var_instance to a label one """ # This can be done 'cause LABEL is just a dummy descent of VAR assert isinstance(var_instance, SymbolVAR) from symbols import LABEL var_instance.__class__ = LABEL var_instance.class_ = CLAS...
[ "def", "to_label", "(", "var_instance", ")", ":", "# This can be done 'cause LABEL is just a dummy descent of VAR", "assert", "isinstance", "(", "var_instance", ",", "SymbolVAR", ")", "from", "symbols", "import", "LABEL", "var_instance", ".", "__class__", "=", "LABEL", ...
Converts a var_instance to a label one
[ "Converts", "a", "var_instance", "to", "a", "label", "one" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/var.py#L130-L139
boriel/zxbasic
symbols/var.py
SymbolVAR.to_function
def to_function(var_instance, lineno=None): """ Converts a var_instance to a function one """ assert isinstance(var_instance, SymbolVAR) from symbols import FUNCTION var_instance.__class__ = FUNCTION var_instance.class_ = CLASS.function var_instance.reset(lineno=l...
python
def to_function(var_instance, lineno=None): """ Converts a var_instance to a function one """ assert isinstance(var_instance, SymbolVAR) from symbols import FUNCTION var_instance.__class__ = FUNCTION var_instance.class_ = CLASS.function var_instance.reset(lineno=l...
[ "def", "to_function", "(", "var_instance", ",", "lineno", "=", "None", ")", ":", "assert", "isinstance", "(", "var_instance", ",", "SymbolVAR", ")", "from", "symbols", "import", "FUNCTION", "var_instance", ".", "__class__", "=", "FUNCTION", "var_instance", ".", ...
Converts a var_instance to a function one
[ "Converts", "a", "var_instance", "to", "a", "function", "one" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/var.py#L142-L150
boriel/zxbasic
symbols/var.py
SymbolVAR.to_vararray
def to_vararray(var_instance, bounds): """ Converts a var_instance to a var array one """ assert isinstance(var_instance, SymbolVAR) from symbols import BOUNDLIST from symbols import VARARRAY assert isinstance(bounds, BOUNDLIST) var_instance.__class__ = VARARRAY ...
python
def to_vararray(var_instance, bounds): """ Converts a var_instance to a var array one """ assert isinstance(var_instance, SymbolVAR) from symbols import BOUNDLIST from symbols import VARARRAY assert isinstance(bounds, BOUNDLIST) var_instance.__class__ = VARARRAY ...
[ "def", "to_vararray", "(", "var_instance", ",", "bounds", ")", ":", "assert", "isinstance", "(", "var_instance", ",", "SymbolVAR", ")", "from", "symbols", "import", "BOUNDLIST", "from", "symbols", "import", "VARARRAY", "assert", "isinstance", "(", "bounds", ",",...
Converts a var_instance to a var array one
[ "Converts", "a", "var_instance", "to", "a", "var", "array", "one" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/var.py#L153-L163
boriel/zxbasic
arch/zx48k/backend/__pload.py
_paddr
def _paddr(ins): """ Returns code sequence which points to local variable or parameter (HL) """ output = [] oper = ins.quad[1] indirect = (oper[0] == '*') if indirect: oper = oper[1:] I = int(oper) if I >= 0: I += 4 # Return Address + "push IX" output.append('...
python
def _paddr(ins): """ Returns code sequence which points to local variable or parameter (HL) """ output = [] oper = ins.quad[1] indirect = (oper[0] == '*') if indirect: oper = oper[1:] I = int(oper) if I >= 0: I += 4 # Return Address + "push IX" output.append('...
[ "def", "_paddr", "(", "ins", ")", ":", "output", "=", "[", "]", "oper", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "(", "oper", "[", "0", "]", "==", "'*'", ")", "if", "indirect", ":", "oper", "=", "oper", "[", "1", ":", "]", "...
Returns code sequence which points to local variable or parameter (HL)
[ "Returns", "code", "sequence", "which", "points", "to", "local", "variable", "or", "parameter", "(", "HL", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L22-L49
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pload
def _pload(offset, size): """ Generic parameter loading. Emmits output code for setting IX at the right location. size = Number of bytes to load: 1 => 8 bit value 2 => 16 bit value / string 4 => 32 bit value / f16 value 5 => 40 bit value """ output = [] indirect ...
python
def _pload(offset, size): """ Generic parameter loading. Emmits output code for setting IX at the right location. size = Number of bytes to load: 1 => 8 bit value 2 => 16 bit value / string 4 => 32 bit value / f16 value 5 => 40 bit value """ output = [] indirect ...
[ "def", "_pload", "(", "offset", ",", "size", ")", ":", "output", "=", "[", "]", "indirect", "=", "offset", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "offset", "=", "offset", "[", "1", ":", "]", "I", "=", "int", "(", "offset", ")", "if"...
Generic parameter loading. Emmits output code for setting IX at the right location. size = Number of bytes to load: 1 => 8 bit value 2 => 16 bit value / string 4 => 32 bit value / f16 value 5 => 40 bit value
[ "Generic", "parameter", "loading", ".", "Emmits", "output", "code", "for", "setting", "IX", "at", "the", "right", "location", ".", "size", "=", "Number", "of", "bytes", "to", "load", ":", "1", "=", ">", "8", "bit", "value", "2", "=", ">", "16", "bit"...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L52-L120
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pload32
def _pload32(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. 2nd operand cannot be an immediate nor an address. """ output = _pload(ins.quad[2], 4) output.append('push de') output.append('push hl') return output
python
def _pload32(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. 2nd operand cannot be an immediate nor an address. """ output = _pload(ins.quad[2], 4) output.append('push de') output.append('push hl') return output
[ "def", "_pload32", "(", "ins", ")", ":", "output", "=", "_pload", "(", "ins", ".", "quad", "[", "2", "]", ",", "4", ")", "output", ".", "append", "(", "'push de'", ")", "output", ".", "append", "(", "'push hl'", ")", "return", "output" ]
Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. 2nd operand cannot be an immediate nor an address.
[ "Loads", "from", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "2st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L148-L158
boriel/zxbasic
arch/zx48k/backend/__pload.py
_ploadf
def _ploadf(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. """ output = _pload(ins.quad[2], 5) output.extend(_fpush()) return output
python
def _ploadf(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. """ output = _pload(ins.quad[2], 5) output.extend(_fpush()) return output
[ "def", "_ploadf", "(", "ins", ")", ":", "output", "=", "_pload", "(", "ins", ".", "quad", "[", "2", "]", ",", "5", ")", "output", ".", "extend", "(", "_fpush", "(", ")", ")", "return", "output" ]
Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer.
[ "Loads", "from", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "2st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L161-L169
boriel/zxbasic
arch/zx48k/backend/__pload.py
_ploadstr
def _ploadstr(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. 2nd operand cannot be an immediate nor an address. """ output = _pload(ins.quad[2], 2) if ins.quad[1][0] != '$': output.append('call __LOADSTR') REQUIRES.a...
python
def _ploadstr(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. 2nd operand cannot be an immediate nor an address. """ output = _pload(ins.quad[2], 2) if ins.quad[1][0] != '$': output.append('call __LOADSTR') REQUIRES.a...
[ "def", "_ploadstr", "(", "ins", ")", ":", "output", "=", "_pload", "(", "ins", ".", "quad", "[", "2", "]", ",", "2", ")", "if", "ins", ".", "quad", "[", "1", "]", "[", "0", "]", "!=", "'$'", ":", "output", ".", "append", "(", "'call __LOADSTR'"...
Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. 2nd operand cannot be an immediate nor an address.
[ "Loads", "from", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "2st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L172-L185
boriel/zxbasic
arch/zx48k/backend/__pload.py
_fploadstr
def _fploadstr(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. Unlike ploadstr, this version does not push the result back into the stack. """ output = _pload(ins.quad[2], 2) if ins.quad[1][0] != '$': output.append('call ...
python
def _fploadstr(ins): """ Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. Unlike ploadstr, this version does not push the result back into the stack. """ output = _pload(ins.quad[2], 2) if ins.quad[1][0] != '$': output.append('call ...
[ "def", "_fploadstr", "(", "ins", ")", ":", "output", "=", "_pload", "(", "ins", ".", "quad", "[", "2", "]", ",", "2", ")", "if", "ins", ".", "quad", "[", "1", "]", "[", "0", "]", "!=", "'$'", ":", "output", ".", "append", "(", "'call __LOADSTR'...
Loads from stack pointer (SP) + X, being X 2st parameter. 1st operand must be a SIGNED integer. Unlike ploadstr, this version does not push the result back into the stack.
[ "Loads", "from", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "2st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L188-L201
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pstore8
def _pstore8(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' size = 0 if indirect: offset = offset[1:] size = 1 I = in...
python
def _pstore8(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' size = 0 if indirect: offset = offset[1:] size = 1 I = in...
[ "def", "_pstore8", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "2", "]", "offset", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "offset", "[", "0", "]", "==", "'*'", "size", "=", "0", "if", "indirect", ":", "offset"...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L204-L267
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pstore16
def _pstore16(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' size = 1 if indirect: offset = offset[1:] I = int(offset) if...
python
def _pstore16(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' size = 1 if indirect: offset = offset[1:] I = int(offset) if...
[ "def", "_pstore16", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "2", "]", "offset", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "offset", "[", "0", "]", "==", "'*'", "size", "=", "1", "if", "indirect", ":", "offset...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L270-L333
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pstore32
def _pstore32(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' if indirect: offset = offset[1:] I = int(offset) if I >= 0: ...
python
def _pstore32(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' if indirect: offset = offset[1:] I = int(offset) if I >= 0: ...
[ "def", "_pstore32", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "2", "]", "offset", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "offset", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "offset", "=", "offset", ...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L336-L365
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pstoref16
def _pstoref16(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' if indirect: offset = offset[1:] I = int(offset) if I >= 0: ...
python
def _pstoref16(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' if indirect: offset = offset[1:] I = int(offset) if I >= 0: ...
[ "def", "_pstoref16", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "2", "]", "offset", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "offset", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "offset", "=", "offset", ...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L368-L397
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pstoref
def _pstoref(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' if indirect: offset = offset[1:] I = int(offset) if I >= 0: ...
python
def _pstoref(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. """ value = ins.quad[2] offset = ins.quad[1] indirect = offset[0] == '*' if indirect: offset = offset[1:] I = int(offset) if I >= 0: ...
[ "def", "_pstoref", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "2", "]", "offset", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "offset", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "offset", "=", "offset", "...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L400-L429
boriel/zxbasic
arch/zx48k/backend/__pload.py
_pstorestr
def _pstorestr(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. Note: This procedure proceeds as _pstore16, since STRINGS are 16bit pointers. """ output = [] temporal = False # 2nd operand first, because must go int...
python
def _pstorestr(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. Note: This procedure proceeds as _pstore16, since STRINGS are 16bit pointers. """ output = [] temporal = False # 2nd operand first, because must go int...
[ "def", "_pstorestr", "(", "ins", ")", ":", "output", "=", "[", "]", "temporal", "=", "False", "# 2nd operand first, because must go into the stack", "value", "=", "ins", ".", "quad", "[", "2", "]", "if", "value", "[", "0", "]", "==", "'*'", ":", "value", ...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. Note: This procedure proceeds as _pstore16, since STRINGS are 16bit pointers.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L432-L497
boriel/zxbasic
symbols/unary.py
SymbolUNARY.make_node
def make_node(cls, lineno, operator, operand, func=None, type_=None): """ Creates a node for a unary operation. E.g. -x or LEN(a$) Parameters: -func: lambda function used on constant folding when possible -type_: the resulting type (by default, the same as the argument). ...
python
def make_node(cls, lineno, operator, operand, func=None, type_=None): """ Creates a node for a unary operation. E.g. -x or LEN(a$) Parameters: -func: lambda function used on constant folding when possible -type_: the resulting type (by default, the same as the argument). ...
[ "def", "make_node", "(", "cls", ",", "lineno", ",", "operator", ",", "operand", ",", "func", "=", "None", ",", "type_", "=", "None", ")", ":", "assert", "type_", "is", "None", "or", "isinstance", "(", "type_", ",", "SymbolTYPE", ")", "if", "func", "i...
Creates a node for a unary operation. E.g. -x or LEN(a$) Parameters: -func: lambda function used on constant folding when possible -type_: the resulting type (by default, the same as the argument). For example, for LEN (str$), result type is 'u16' and arg...
[ "Creates", "a", "node", "for", "a", "unary", "operation", ".", "E", ".", "g", ".", "-", "x", "or", "LEN", "(", "a$", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/unary.py#L62-L89
boriel/zxbasic
api/constants.py
TYPE.to_signed
def to_signed(cls, type_): """ Return signed type or equivalent """ if type_ in cls.unsigned: return {TYPE.ubyte: TYPE.byte_, TYPE.uinteger: TYPE.integer, TYPE.ulong: TYPE.long_}[type_] if type_ in cls.decimals or type_ in cls.signed: ...
python
def to_signed(cls, type_): """ Return signed type or equivalent """ if type_ in cls.unsigned: return {TYPE.ubyte: TYPE.byte_, TYPE.uinteger: TYPE.integer, TYPE.ulong: TYPE.long_}[type_] if type_ in cls.decimals or type_ in cls.signed: ...
[ "def", "to_signed", "(", "cls", ",", "type_", ")", ":", "if", "type_", "in", "cls", ".", "unsigned", ":", "return", "{", "TYPE", ".", "ubyte", ":", "TYPE", ".", "byte_", ",", "TYPE", ".", "uinteger", ":", "TYPE", ".", "integer", ",", "TYPE", ".", ...
Return signed type or equivalent
[ "Return", "signed", "type", "or", "equivalent" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/api/constants.py#L148-L157
boriel/zxbasic
api/constants.py
TYPE.to_type
def to_type(cls, typename): """ Converts a type ID to name. On error returns None """ NAME_TYPES = {cls.TYPE_NAMES[x]: x for x in cls.TYPE_NAMES} return NAME_TYPES.get(typename, None)
python
def to_type(cls, typename): """ Converts a type ID to name. On error returns None """ NAME_TYPES = {cls.TYPE_NAMES[x]: x for x in cls.TYPE_NAMES} return NAME_TYPES.get(typename, None)
[ "def", "to_type", "(", "cls", ",", "typename", ")", ":", "NAME_TYPES", "=", "{", "cls", ".", "TYPE_NAMES", "[", "x", "]", ":", "x", "for", "x", "in", "cls", ".", "TYPE_NAMES", "}", "return", "NAME_TYPES", ".", "get", "(", "typename", ",", "None", "...
Converts a type ID to name. On error returns None
[ "Converts", "a", "type", "ID", "to", "name", ".", "On", "error", "returns", "None" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/api/constants.py#L166-L170
boriel/zxbasic
arch/zx48k/backend/__f16.py
f16
def f16(op): """ Returns a floating point operand converted to 32 bits unsigned int. Negative numbers are returned in 2 complement. The result is returned in a tuple (DE, HL) => High16 (Int part), Low16 (Decimal part) """ op = float(op) negative = op < 0 if negative: op = -op ...
python
def f16(op): """ Returns a floating point operand converted to 32 bits unsigned int. Negative numbers are returned in 2 complement. The result is returned in a tuple (DE, HL) => High16 (Int part), Low16 (Decimal part) """ op = float(op) negative = op < 0 if negative: op = -op ...
[ "def", "f16", "(", "op", ")", ":", "op", "=", "float", "(", "op", ")", "negative", "=", "op", "<", "0", "if", "negative", ":", "op", "=", "-", "op", "DE", "=", "int", "(", "op", ")", "HL", "=", "int", "(", "(", "op", "-", "DE", ")", "*", ...
Returns a floating point operand converted to 32 bits unsigned int. Negative numbers are returned in 2 complement. The result is returned in a tuple (DE, HL) => High16 (Int part), Low16 (Decimal part)
[ "Returns", "a", "floating", "point", "operand", "converted", "to", "32", "bits", "unsigned", "int", ".", "Negative", "numbers", "are", "returned", "in", "2", "complement", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__f16.py#L21-L45
boriel/zxbasic
arch/zx48k/backend/__f16.py
_f16_oper
def _f16_oper(op1, op2=None, useBC=False, reversed=False): """ Returns pop sequence for 32 bits operands 1st operand in HLDE, 2nd operand remains in the stack Now it does support operands inversion calling __SWAP32. However, if 1st operand is integer (immediate) or indirect, the stack will be rear...
python
def _f16_oper(op1, op2=None, useBC=False, reversed=False): """ Returns pop sequence for 32 bits operands 1st operand in HLDE, 2nd operand remains in the stack Now it does support operands inversion calling __SWAP32. However, if 1st operand is integer (immediate) or indirect, the stack will be rear...
[ "def", "_f16_oper", "(", "op1", ",", "op2", "=", "None", ",", "useBC", "=", "False", ",", "reversed", "=", "False", ")", ":", "output", "=", "[", "]", "if", "op1", "is", "not", "None", ":", "op1", "=", "str", "(", "op1", ")", "if", "op2", "is",...
Returns pop sequence for 32 bits operands 1st operand in HLDE, 2nd operand remains in the stack Now it does support operands inversion calling __SWAP32. However, if 1st operand is integer (immediate) or indirect, the stack will be rearranged, so it contains a 32 bit pushed parameter value for the ...
[ "Returns", "pop", "sequence", "for", "32", "bits", "operands", "1st", "operand", "in", "HLDE", "2nd", "operand", "remains", "in", "the", "stack" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__f16.py#L48-L196
boriel/zxbasic
arch/zx48k/backend/__f16.py
_f16_to_32bit
def _f16_to_32bit(ins): """ If any of the operands within the ins(truction) are numeric, convert them to its 32bit representation, otherwise leave them as they are. """ ins.quad = [x for x in ins.quad] for i in range(2, len(ins.quad)): if is_float(ins.quad[i]): de, hl = f16(i...
python
def _f16_to_32bit(ins): """ If any of the operands within the ins(truction) are numeric, convert them to its 32bit representation, otherwise leave them as they are. """ ins.quad = [x for x in ins.quad] for i in range(2, len(ins.quad)): if is_float(ins.quad[i]): de, hl = f16(i...
[ "def", "_f16_to_32bit", "(", "ins", ")", ":", "ins", ".", "quad", "=", "[", "x", "for", "x", "in", "ins", ".", "quad", "]", "for", "i", "in", "range", "(", "2", ",", "len", "(", "ins", ".", "quad", ")", ")", ":", "if", "is_float", "(", "ins",...
If any of the operands within the ins(truction) are numeric, convert them to its 32bit representation, otherwise leave them as they are.
[ "If", "any", "of", "the", "operands", "within", "the", "ins", "(", "truction", ")", "are", "numeric", "convert", "them", "to", "its", "32bit", "representation", "otherwise", "leave", "them", "as", "they", "are", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__f16.py#L199-L211
boriel/zxbasic
arch/zx48k/backend/__f16.py
_mulf16
def _mulf16(ins): """ Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack. """ op1, op2 = tuple(ins.quad[2:]) if _f_ops(op1, op2) is not None: op1, op2 = _f_ops(op1, op2) if op2 == 1: # A * 1 => A output = _f16_oper(op1) output.a...
python
def _mulf16(ins): """ Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack. """ op1, op2 = tuple(ins.quad[2:]) if _f_ops(op1, op2) is not None: op1, op2 = _f_ops(op1, op2) if op2 == 1: # A * 1 => A output = _f16_oper(op1) output.a...
[ "def", "_mulf16", "(", "ins", ")", ":", "op1", ",", "op2", "=", "tuple", "(", "ins", ".", "quad", "[", "2", ":", "]", ")", "if", "_f_ops", "(", "op1", ",", "op2", ")", "is", "not", "None", ":", "op1", ",", "op2", "=", "_f_ops", "(", "op1", ...
Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack.
[ "Multiplies", "2", "32bit", "(", "16", ".", "16", ")", "fixed", "point", "numbers", ".", "The", "result", "is", "pushed", "onto", "the", "stack", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__f16.py#L235-L266
boriel/zxbasic
arch/zx48k/backend/__f16.py
_divf16
def _divf16(ins): """ Divides 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack. Optimizations: * If 2nd operand is 1, do nothing * If 2nd operand is -1, do NEG32 """ op1, op2 = tuple(ins.quad[2:]) if is_float(op2): if float(op2) == 1: ...
python
def _divf16(ins): """ Divides 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack. Optimizations: * If 2nd operand is 1, do nothing * If 2nd operand is -1, do NEG32 """ op1, op2 = tuple(ins.quad[2:]) if is_float(op2): if float(op2) == 1: ...
[ "def", "_divf16", "(", "ins", ")", ":", "op1", ",", "op2", "=", "tuple", "(", "ins", ".", "quad", "[", "2", ":", "]", ")", "if", "is_float", "(", "op2", ")", ":", "if", "float", "(", "op2", ")", "==", "1", ":", "output", "=", "_f16_oper", "("...
Divides 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack. Optimizations: * If 2nd operand is 1, do nothing * If 2nd operand is -1, do NEG32
[ "Divides", "2", "32bit", "(", "16", ".", "16", ")", "fixed", "point", "numbers", ".", "The", "result", "is", "pushed", "onto", "the", "stack", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__f16.py#L269-L296
boriel/zxbasic
arch/zx48k/backend/errors.py
throw_invalid_quad_params
def throw_invalid_quad_params(quad, QUADS, nparams): """ Exception raised when an invalid number of params in the quad code has been emmitted. """ raise InvalidICError(str(quad), "Invalid quad code params for '%s' (expected %i, but got %i)" % (quad, ...
python
def throw_invalid_quad_params(quad, QUADS, nparams): """ Exception raised when an invalid number of params in the quad code has been emmitted. """ raise InvalidICError(str(quad), "Invalid quad code params for '%s' (expected %i, but got %i)" % (quad, ...
[ "def", "throw_invalid_quad_params", "(", "quad", ",", "QUADS", ",", "nparams", ")", ":", "raise", "InvalidICError", "(", "str", "(", "quad", ")", ",", "\"Invalid quad code params for '%s' (expected %i, but got %i)\"", "%", "(", "quad", ",", "QUADS", "[", "quad", "...
Exception raised when an invalid number of params in the quad code has been emmitted.
[ "Exception", "raised", "when", "an", "invalid", "number", "of", "params", "in", "the", "quad", "code", "has", "been", "emmitted", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/errors.py#L72-L79
boriel/zxbasic
api/fp.py
fp
def fp(x): """ Returns a floating point number as EXP+128, Mantissa """ def bin32(f): """ Returns ASCII representation for a 32 bit integer value """ result = '' a = int(f) & 0xFFFFFFFF # ensures int 32 for i in range(32): result = str(a % 2) + result ...
python
def fp(x): """ Returns a floating point number as EXP+128, Mantissa """ def bin32(f): """ Returns ASCII representation for a 32 bit integer value """ result = '' a = int(f) & 0xFFFFFFFF # ensures int 32 for i in range(32): result = str(a % 2) + result ...
[ "def", "fp", "(", "x", ")", ":", "def", "bin32", "(", "f", ")", ":", "\"\"\" Returns ASCII representation for a 32 bit integer value\n \"\"\"", "result", "=", "''", "a", "=", "int", "(", "f", ")", "&", "0xFFFFFFFF", "# ensures int 32", "for", "i", "in", ...
Returns a floating point number as EXP+128, Mantissa
[ "Returns", "a", "floating", "point", "number", "as", "EXP", "+", "128", "Mantissa" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/api/fp.py#L7-L59
boriel/zxbasic
api/fp.py
immediate_float
def immediate_float(x): """ Returns C DE HL as values for loading and immediate floating point. """ def bin2hex(y): return "%02X" % int(y, 2) M, E = fp(x) C = '0' + bin2hex(E) + 'h' ED = '0' + bin2hex(M[8:16]) + bin2hex(M[:8]) + 'h' LH = '0' + bin2hex(M[24:]) + bin2hex(M[16:24]...
python
def immediate_float(x): """ Returns C DE HL as values for loading and immediate floating point. """ def bin2hex(y): return "%02X" % int(y, 2) M, E = fp(x) C = '0' + bin2hex(E) + 'h' ED = '0' + bin2hex(M[8:16]) + bin2hex(M[:8]) + 'h' LH = '0' + bin2hex(M[24:]) + bin2hex(M[16:24]...
[ "def", "immediate_float", "(", "x", ")", ":", "def", "bin2hex", "(", "y", ")", ":", "return", "\"%02X\"", "%", "int", "(", "y", ",", "2", ")", "M", ",", "E", "=", "fp", "(", "x", ")", "C", "=", "'0'", "+", "bin2hex", "(", "E", ")", "+", "'h...
Returns C DE HL as values for loading and immediate floating point.
[ "Returns", "C", "DE", "HL", "as", "values", "for", "loading", "and", "immediate", "floating", "point", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/api/fp.py#L62-L75
boriel/zxbasic
ast_/tree.py
Tree.inorder
def inorder(self, funct, stopOn=None): """ Iterates in order, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false. """ if stopOn is None: for i in self.children: i.inorder(funct) else: ...
python
def inorder(self, funct, stopOn=None): """ Iterates in order, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false. """ if stopOn is None: for i in self.children: i.inorder(funct) else: ...
[ "def", "inorder", "(", "self", ",", "funct", ",", "stopOn", "=", "None", ")", ":", "if", "stopOn", "is", "None", ":", "for", "i", "in", "self", ".", "children", ":", "i", ".", "inorder", "(", "funct", ")", "else", ":", "for", "i", "in", "self", ...
Iterates in order, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false.
[ "Iterates", "in", "order", "calling", "the", "function", "with", "the", "current", "node", ".", "If", "stopOn", "is", "set", "to", "True", "or", "False", "it", "will", "stop", "on", "true", "or", "false", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/ast_/tree.py#L101-L113
boriel/zxbasic
ast_/tree.py
Tree.preorder
def preorder(self, funct, stopOn=None): """ Iterates in preorder, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false. """ if funct(self.symbol) == stopOn and stopOn is not None: return stopOn if stopOn is ...
python
def preorder(self, funct, stopOn=None): """ Iterates in preorder, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false. """ if funct(self.symbol) == stopOn and stopOn is not None: return stopOn if stopOn is ...
[ "def", "preorder", "(", "self", ",", "funct", ",", "stopOn", "=", "None", ")", ":", "if", "funct", "(", "self", ".", "symbol", ")", "==", "stopOn", "and", "stopOn", "is", "not", "None", ":", "return", "stopOn", "if", "stopOn", "is", "None", ":", "f...
Iterates in preorder, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false.
[ "Iterates", "in", "preorder", "calling", "the", "function", "with", "the", "current", "node", ".", "If", "stopOn", "is", "set", "to", "True", "or", "False", "it", "will", "stop", "on", "true", "or", "false", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/ast_/tree.py#L115-L128
boriel/zxbasic
ast_/tree.py
Tree.postorder
def postorder(self, funct, stopOn=None): """ Iterates in postorder, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false. """ if stopOn is None: for i in range(len(self.children) - 1, -1, -1): self.childr...
python
def postorder(self, funct, stopOn=None): """ Iterates in postorder, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false. """ if stopOn is None: for i in range(len(self.children) - 1, -1, -1): self.childr...
[ "def", "postorder", "(", "self", ",", "funct", ",", "stopOn", "=", "None", ")", ":", "if", "stopOn", "is", "None", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "children", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":"...
Iterates in postorder, calling the function with the current node. If stopOn is set to True or False, it will stop on true or false.
[ "Iterates", "in", "postorder", "calling", "the", "function", "with", "the", "current", "node", ".", "If", "stopOn", "is", "set", "to", "True", "or", "False", "it", "will", "stop", "on", "true", "or", "false", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/ast_/tree.py#L130-L141
boriel/zxbasic
ast_/tree.py
Tree.makenode
def makenode(clss, symbol, *nexts): """ Stores the symbol in an AST instance, and left and right to the given ones """ result = clss(symbol) for i in nexts: if i is None: continue if not isinstance(i, clss): raise NotAnAstEr...
python
def makenode(clss, symbol, *nexts): """ Stores the symbol in an AST instance, and left and right to the given ones """ result = clss(symbol) for i in nexts: if i is None: continue if not isinstance(i, clss): raise NotAnAstEr...
[ "def", "makenode", "(", "clss", ",", "symbol", ",", "*", "nexts", ")", ":", "result", "=", "clss", "(", "symbol", ")", "for", "i", "in", "nexts", ":", "if", "i", "is", "None", ":", "continue", "if", "not", "isinstance", "(", "i", ",", "clss", ")"...
Stores the symbol in an AST instance, and left and right to the given ones
[ "Stores", "the", "symbol", "in", "an", "AST", "instance", "and", "left", "and", "right", "to", "the", "given", "ones" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/ast_/tree.py#L154-L166
boriel/zxbasic
zxbpp.py
init
def init(): """ Initializes the preprocessor """ global OUTPUT global INCLUDED global CURRENT_DIR global ENABLED global INCLUDEPATH global IFDEFS global ID_TABLE global CURRENT_FILE global_.FILENAME = '(stdin)' OUTPUT = '' INCLUDED = {} CURRENT_DIR = '' pwd =...
python
def init(): """ Initializes the preprocessor """ global OUTPUT global INCLUDED global CURRENT_DIR global ENABLED global INCLUDEPATH global IFDEFS global ID_TABLE global CURRENT_FILE global_.FILENAME = '(stdin)' OUTPUT = '' INCLUDED = {} CURRENT_DIR = '' pwd =...
[ "def", "init", "(", ")", ":", "global", "OUTPUT", "global", "INCLUDED", "global", "CURRENT_DIR", "global", "ENABLED", "global", "INCLUDEPATH", "global", "IFDEFS", "global", "ID_TABLE", "global", "CURRENT_FILE", "global_", ".", "FILENAME", "=", "'(stdin)'", "OUTPUT...
Initializes the preprocessor
[ "Initializes", "the", "preprocessor" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L62-L86
boriel/zxbasic
zxbpp.py
get_include_path
def get_include_path(): """ Default include path using a tricky sys calls. """ f1 = os.path.basename(sys.argv[0]).lower() # script filename f2 = os.path.basename(sys.executable).lower() # Executable filename # If executable filename and script name are the same, we are if f1 == f2 or f2 =...
python
def get_include_path(): """ Default include path using a tricky sys calls. """ f1 = os.path.basename(sys.argv[0]).lower() # script filename f2 = os.path.basename(sys.executable).lower() # Executable filename # If executable filename and script name are the same, we are if f1 == f2 or f2 =...
[ "def", "get_include_path", "(", ")", ":", "f1", "=", "os", ".", "path", ".", "basename", "(", "sys", ".", "argv", "[", "0", "]", ")", ".", "lower", "(", ")", "# script filename", "f2", "=", "os", ".", "path", ".", "basename", "(", "sys", ".", "ex...
Default include path using a tricky sys calls.
[ "Default", "include", "path", "using", "a", "tricky", "sys", "calls", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L89-L102
boriel/zxbasic
zxbpp.py
search_filename
def search_filename(fname, lineno, local_first): """ Search a filename into the list of the include path. If local_first is true, it will try first in the current directory of the file being analyzed. """ fname = api.utils.sanitize_filename(fname) i_path = [CURRENT_DIR] + INCLUDEPATH if local_fi...
python
def search_filename(fname, lineno, local_first): """ Search a filename into the list of the include path. If local_first is true, it will try first in the current directory of the file being analyzed. """ fname = api.utils.sanitize_filename(fname) i_path = [CURRENT_DIR] + INCLUDEPATH if local_fi...
[ "def", "search_filename", "(", "fname", ",", "lineno", ",", "local_first", ")", ":", "fname", "=", "api", ".", "utils", ".", "sanitize_filename", "(", "fname", ")", "i_path", "=", "[", "CURRENT_DIR", "]", "+", "INCLUDEPATH", "if", "local_first", "else", "l...
Search a filename into the list of the include path. If local_first is true, it will try first in the current directory of the file being analyzed.
[ "Search", "a", "filename", "into", "the", "list", "of", "the", "include", "path", ".", "If", "local_first", "is", "true", "it", "will", "try", "first", "in", "the", "current", "directory", "of", "the", "file", "being", "analyzed", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L118-L136
boriel/zxbasic
zxbpp.py
include_file
def include_file(filename, lineno, local_first): """ Performs a file inclusion (#include) in the preprocessor. Writes down that "filename" was included at the current file, at line <lineno>. If local_first is True, then it will first search the file in the local path before looking for it in the in...
python
def include_file(filename, lineno, local_first): """ Performs a file inclusion (#include) in the preprocessor. Writes down that "filename" was included at the current file, at line <lineno>. If local_first is True, then it will first search the file in the local path before looking for it in the in...
[ "def", "include_file", "(", "filename", ",", "lineno", ",", "local_first", ")", ":", "global", "CURRENT_DIR", "filename", "=", "search_filename", "(", "filename", ",", "lineno", ",", "local_first", ")", "if", "filename", "not", "in", "INCLUDED", ".", "keys", ...
Performs a file inclusion (#include) in the preprocessor. Writes down that "filename" was included at the current file, at line <lineno>. If local_first is True, then it will first search the file in the local path before looking for it in the include path chain. This is used when doing a #include ...
[ "Performs", "a", "file", "inclusion", "(", "#include", ")", "in", "the", "preprocessor", ".", "Writes", "down", "that", "filename", "was", "included", "at", "the", "current", "file", "at", "line", "<lineno", ">", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L139-L158
boriel/zxbasic
zxbpp.py
include_once
def include_once(filename, lineno, local_first): """ Performs a file inclusion (#include) in the preprocessor. Writes down that "filename" was included at the current file, at line <lineno>. The file is ignored if it was previuosly included (a warning will be emitted though). If local_first is...
python
def include_once(filename, lineno, local_first): """ Performs a file inclusion (#include) in the preprocessor. Writes down that "filename" was included at the current file, at line <lineno>. The file is ignored if it was previuosly included (a warning will be emitted though). If local_first is...
[ "def", "include_once", "(", "filename", ",", "lineno", ",", "local_first", ")", ":", "filename", "=", "search_filename", "(", "filename", ",", "lineno", ",", "local_first", ")", "if", "filename", "not", "in", "INCLUDED", ".", "keys", "(", ")", ":", "# If n...
Performs a file inclusion (#include) in the preprocessor. Writes down that "filename" was included at the current file, at line <lineno>. The file is ignored if it was previuosly included (a warning will be emitted though). If local_first is True, then it will first search the file in the loca...
[ "Performs", "a", "file", "inclusion", "(", "#include", ")", "in", "the", "preprocessor", ".", "Writes", "down", "that", "filename", "was", "included", "at", "the", "current", "file", "at", "line", "<lineno", ">", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L161-L185
boriel/zxbasic
zxbpp.py
p_program_tokenstring
def p_program_tokenstring(p): """ program : defs NEWLINE """ try: tmp = [str(x()) if isinstance(x, MacroCall) else x for x in p[1]] except PreprocError as v: error(v.lineno, v.message) tmp.append(p[2]) p[0] = tmp
python
def p_program_tokenstring(p): """ program : defs NEWLINE """ try: tmp = [str(x()) if isinstance(x, MacroCall) else x for x in p[1]] except PreprocError as v: error(v.lineno, v.message) tmp.append(p[2]) p[0] = tmp
[ "def", "p_program_tokenstring", "(", "p", ")", ":", "try", ":", "tmp", "=", "[", "str", "(", "x", "(", ")", ")", "if", "isinstance", "(", "x", ",", "MacroCall", ")", "else", "x", "for", "x", "in", "p", "[", "1", "]", "]", "except", "PreprocError"...
program : defs NEWLINE
[ "program", ":", "defs", "NEWLINE" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L211-L220
boriel/zxbasic
zxbpp.py
p_include_file
def p_include_file(p): """ include_file : include NEWLINE program _ENDFILE_ """ global CURRENT_DIR p[0] = [p[1] + p[2]] + p[3] + [p[4]] CURRENT_FILE.pop() # Remove top of the stack CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
python
def p_include_file(p): """ include_file : include NEWLINE program _ENDFILE_ """ global CURRENT_DIR p[0] = [p[1] + p[2]] + p[3] + [p[4]] CURRENT_FILE.pop() # Remove top of the stack CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
[ "def", "p_include_file", "(", "p", ")", ":", "global", "CURRENT_DIR", "p", "[", "0", "]", "=", "[", "p", "[", "1", "]", "+", "p", "[", "2", "]", "]", "+", "p", "[", "3", "]", "+", "[", "p", "[", "4", "]", "]", "CURRENT_FILE", ".", "pop", ...
include_file : include NEWLINE program _ENDFILE_
[ "include_file", ":", "include", "NEWLINE", "program", "_ENDFILE_" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L274-L280
boriel/zxbasic
zxbpp.py
p_include_once_ok
def p_include_once_ok(p): """ include_file : include_once NEWLINE program _ENDFILE_ """ global CURRENT_DIR p[0] = [p[1] + p[2]] + p[3] + [p[4]] CURRENT_FILE.pop() # Remove top of the stack CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
python
def p_include_once_ok(p): """ include_file : include_once NEWLINE program _ENDFILE_ """ global CURRENT_DIR p[0] = [p[1] + p[2]] + p[3] + [p[4]] CURRENT_FILE.pop() # Remove top of the stack CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
[ "def", "p_include_once_ok", "(", "p", ")", ":", "global", "CURRENT_DIR", "p", "[", "0", "]", "=", "[", "p", "[", "1", "]", "+", "p", "[", "2", "]", "]", "+", "p", "[", "3", "]", "+", "[", "p", "[", "4", "]", "]", "CURRENT_FILE", ".", "pop",...
include_file : include_once NEWLINE program _ENDFILE_
[ "include_file", ":", "include_once", "NEWLINE", "program", "_ENDFILE_" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L295-L301
boriel/zxbasic
zxbpp.py
p_include
def p_include(p): """ include : INCLUDE STRING """ if ENABLED: p[0] = include_file(p[2], p.lineno(2), local_first=True) else: p[0] = [] p.lexer.next_token = '_ENDFILE_'
python
def p_include(p): """ include : INCLUDE STRING """ if ENABLED: p[0] = include_file(p[2], p.lineno(2), local_first=True) else: p[0] = [] p.lexer.next_token = '_ENDFILE_'
[ "def", "p_include", "(", "p", ")", ":", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "include_file", "(", "p", "[", "2", "]", ",", "p", ".", "lineno", "(", "2", ")", ",", "local_first", "=", "True", ")", "else", ":", "p", "[", "0", "]", "...
include : INCLUDE STRING
[ "include", ":", "INCLUDE", "STRING" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L304-L311
boriel/zxbasic
zxbpp.py
p_include_fname
def p_include_fname(p): """ include : INCLUDE FILENAME """ if ENABLED: p[0] = include_file(p[2], p.lineno(2), local_first=False) else: p[0] = [] p.lexer.next_token = '_ENDFILE_'
python
def p_include_fname(p): """ include : INCLUDE FILENAME """ if ENABLED: p[0] = include_file(p[2], p.lineno(2), local_first=False) else: p[0] = [] p.lexer.next_token = '_ENDFILE_'
[ "def", "p_include_fname", "(", "p", ")", ":", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "include_file", "(", "p", "[", "2", "]", ",", "p", ".", "lineno", "(", "2", ")", ",", "local_first", "=", "False", ")", "else", ":", "p", "[", "0", "...
include : INCLUDE FILENAME
[ "include", ":", "INCLUDE", "FILENAME" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L314-L321
boriel/zxbasic
zxbpp.py
p_include_once
def p_include_once(p): """ include_once : INCLUDE ONCE STRING """ if ENABLED: p[0] = include_once(p[3], p.lineno(3), local_first=True) else: p[0] = [] if not p[0]: p.lexer.next_token = '_ENDFILE_'
python
def p_include_once(p): """ include_once : INCLUDE ONCE STRING """ if ENABLED: p[0] = include_once(p[3], p.lineno(3), local_first=True) else: p[0] = [] if not p[0]: p.lexer.next_token = '_ENDFILE_'
[ "def", "p_include_once", "(", "p", ")", ":", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "include_once", "(", "p", "[", "3", "]", ",", "p", ".", "lineno", "(", "3", ")", ",", "local_first", "=", "True", ")", "else", ":", "p", "[", "0", "]"...
include_once : INCLUDE ONCE STRING
[ "include_once", ":", "INCLUDE", "ONCE", "STRING" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L324-L333
boriel/zxbasic
zxbpp.py
p_include_once_fname
def p_include_once_fname(p): """ include_once : INCLUDE ONCE FILENAME """ p[0] = [] if ENABLED: p[0] = include_once(p[3], p.lineno(3), local_first=False) else: p[0] = [] if not p[0]: p.lexer.next_token = '_ENDFILE_'
python
def p_include_once_fname(p): """ include_once : INCLUDE ONCE FILENAME """ p[0] = [] if ENABLED: p[0] = include_once(p[3], p.lineno(3), local_first=False) else: p[0] = [] if not p[0]: p.lexer.next_token = '_ENDFILE_'
[ "def", "p_include_once_fname", "(", "p", ")", ":", "p", "[", "0", "]", "=", "[", "]", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "include_once", "(", "p", "[", "3", "]", ",", "p", ".", "lineno", "(", "3", ")", ",", "local_first", "=", "Fa...
include_once : INCLUDE ONCE FILENAME
[ "include_once", ":", "INCLUDE", "ONCE", "FILENAME" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L336-L347
boriel/zxbasic
zxbpp.py
p_define
def p_define(p): """ define : DEFINE ID params defs """ if ENABLED: if p[4]: if SPACES.match(p[4][0]): p[4][0] = p[4][0][1:] else: warning(p.lineno(1), "missing whitespace after the macro name") ID_TABLE.define(p[2], args=p[3], value=p...
python
def p_define(p): """ define : DEFINE ID params defs """ if ENABLED: if p[4]: if SPACES.match(p[4][0]): p[4][0] = p[4][0][1:] else: warning(p.lineno(1), "missing whitespace after the macro name") ID_TABLE.define(p[2], args=p[3], value=p...
[ "def", "p_define", "(", "p", ")", ":", "if", "ENABLED", ":", "if", "p", "[", "4", "]", ":", "if", "SPACES", ".", "match", "(", "p", "[", "4", "]", "[", "0", "]", ")", ":", "p", "[", "4", "]", "[", "0", "]", "=", "p", "[", "4", "]", "[...
define : DEFINE ID params defs
[ "define", ":", "DEFINE", "ID", "params", "defs" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L406-L418
boriel/zxbasic
zxbpp.py
p_define_params_empty
def p_define_params_empty(p): """ params : LP RP """ # Defines the 'epsilon' parameter p[0] = [ID('', value='', args=None, lineno=p.lineno(1), fname=CURRENT_FILE[-1])]
python
def p_define_params_empty(p): """ params : LP RP """ # Defines the 'epsilon' parameter p[0] = [ID('', value='', args=None, lineno=p.lineno(1), fname=CURRENT_FILE[-1])]
[ "def", "p_define_params_empty", "(", "p", ")", ":", "# Defines the 'epsilon' parameter", "p", "[", "0", "]", "=", "[", "ID", "(", "''", ",", "value", "=", "''", ",", "args", "=", "None", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ",", "...
params : LP RP
[ "params", ":", "LP", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L427-L432
boriel/zxbasic
zxbpp.py
p_define_params_paramlist
def p_define_params_paramlist(p): """ params : LP paramlist RP """ for i in p[2]: if not isinstance(i, ID): error(p.lineno(3), '"%s" might not appear in a macro parameter list' % str(i)) p[0] = None return names = [x.name for x in p[2]] ...
python
def p_define_params_paramlist(p): """ params : LP paramlist RP """ for i in p[2]: if not isinstance(i, ID): error(p.lineno(3), '"%s" might not appear in a macro parameter list' % str(i)) p[0] = None return names = [x.name for x in p[2]] ...
[ "def", "p_define_params_paramlist", "(", "p", ")", ":", "for", "i", "in", "p", "[", "2", "]", ":", "if", "not", "isinstance", "(", "i", ",", "ID", ")", ":", "error", "(", "p", ".", "lineno", "(", "3", ")", ",", "'\"%s\" might not appear in a macro para...
params : LP paramlist RP
[ "params", ":", "LP", "paramlist", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L435-L453
boriel/zxbasic
zxbpp.py
p_paramlist_single
def p_paramlist_single(p): """ paramlist : ID """ p[0] = [ID(p[1], value='', args=None, lineno=p.lineno(1), fname=CURRENT_FILE[-1])]
python
def p_paramlist_single(p): """ paramlist : ID """ p[0] = [ID(p[1], value='', args=None, lineno=p.lineno(1), fname=CURRENT_FILE[-1])]
[ "def", "p_paramlist_single", "(", "p", ")", ":", "p", "[", "0", "]", "=", "[", "ID", "(", "p", "[", "1", "]", ",", "value", "=", "''", ",", "args", "=", "None", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ",", "fname", "=", "CURR...
paramlist : ID
[ "paramlist", ":", "ID" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L456-L460
boriel/zxbasic
zxbpp.py
p_paramlist_paramlist
def p_paramlist_paramlist(p): """ paramlist : paramlist COMMA ID """ p[0] = p[1] + [ID(p[3], value='', args=None, lineno=p.lineno(1), fname=CURRENT_FILE[-1])]
python
def p_paramlist_paramlist(p): """ paramlist : paramlist COMMA ID """ p[0] = p[1] + [ID(p[3], value='', args=None, lineno=p.lineno(1), fname=CURRENT_FILE[-1])]
[ "def", "p_paramlist_paramlist", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "+", "[", "ID", "(", "p", "[", "3", "]", ",", "value", "=", "''", ",", "args", "=", "None", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ...
paramlist : paramlist COMMA ID
[ "paramlist", ":", "paramlist", "COMMA", "ID" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L463-L467
boriel/zxbasic
zxbpp.py
p_ifdef
def p_ifdef(p): """ ifdef : if_header NEWLINE program ENDIF """ global ENABLED if ENABLED: p[0] = [p[2]] + p[3] p[0] += ['#line %i "%s"' % (p.lineno(4) + 1, CURRENT_FILE[-1])] else: p[0] = ['#line %i "%s"' % (p.lineno(4) + 1, CURRENT_FILE[-1])] ENABLED = IFDEFS[-1][0] ...
python
def p_ifdef(p): """ ifdef : if_header NEWLINE program ENDIF """ global ENABLED if ENABLED: p[0] = [p[2]] + p[3] p[0] += ['#line %i "%s"' % (p.lineno(4) + 1, CURRENT_FILE[-1])] else: p[0] = ['#line %i "%s"' % (p.lineno(4) + 1, CURRENT_FILE[-1])] ENABLED = IFDEFS[-1][0] ...
[ "def", "p_ifdef", "(", "p", ")", ":", "global", "ENABLED", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "[", "p", "[", "2", "]", "]", "+", "p", "[", "3", "]", "p", "[", "0", "]", "+=", "[", "'#line %i \"%s\"'", "%", "(", "p", ".", "lineno...
ifdef : if_header NEWLINE program ENDIF
[ "ifdef", ":", "if_header", "NEWLINE", "program", "ENDIF" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L491-L503
boriel/zxbasic
zxbpp.py
p_ifdef_else
def p_ifdef_else(p): """ ifdef : ifdefelsea ifdefelseb ENDIF """ global ENABLED p[0] = p[1] + p[2] p[0] += ['#line %i "%s"' % (p.lineno(3) + 1, CURRENT_FILE[-1])] ENABLED = IFDEFS[-1][0] IFDEFS.pop()
python
def p_ifdef_else(p): """ ifdef : ifdefelsea ifdefelseb ENDIF """ global ENABLED p[0] = p[1] + p[2] p[0] += ['#line %i "%s"' % (p.lineno(3) + 1, CURRENT_FILE[-1])] ENABLED = IFDEFS[-1][0] IFDEFS.pop()
[ "def", "p_ifdef_else", "(", "p", ")", ":", "global", "ENABLED", "p", "[", "0", "]", "=", "p", "[", "1", "]", "+", "p", "[", "2", "]", "p", "[", "0", "]", "+=", "[", "'#line %i \"%s\"'", "%", "(", "p", ".", "lineno", "(", "3", ")", "+", "1",...
ifdef : ifdefelsea ifdefelseb ENDIF
[ "ifdef", ":", "ifdefelsea", "ifdefelseb", "ENDIF" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L506-L514
boriel/zxbasic
zxbpp.py
p_ifdef_else_a
def p_ifdef_else_a(p): """ ifdefelsea : if_header NEWLINE program """ global ENABLED if ENABLED: p[0] = [p[2]] + p[3] else: p[0] = [] ENABLED = not ENABLED
python
def p_ifdef_else_a(p): """ ifdefelsea : if_header NEWLINE program """ global ENABLED if ENABLED: p[0] = [p[2]] + p[3] else: p[0] = [] ENABLED = not ENABLED
[ "def", "p_ifdef_else_a", "(", "p", ")", ":", "global", "ENABLED", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "[", "p", "[", "2", "]", "]", "+", "p", "[", "3", "]", "else", ":", "p", "[", "0", "]", "=", "[", "]", "ENABLED", "=", "not", ...
ifdefelsea : if_header NEWLINE program
[ "ifdefelsea", ":", "if_header", "NEWLINE", "program" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L517-L527
boriel/zxbasic
zxbpp.py
p_ifdef_else_b
def p_ifdef_else_b(p): """ ifdefelseb : ELSE NEWLINE program """ global ENABLED if ENABLED: p[0] = ['#line %i "%s"%s' % (p.lineno(1) + 1, CURRENT_FILE[-1], p[2])] p[0] += p[3] else: p[0] = []
python
def p_ifdef_else_b(p): """ ifdefelseb : ELSE NEWLINE program """ global ENABLED if ENABLED: p[0] = ['#line %i "%s"%s' % (p.lineno(1) + 1, CURRENT_FILE[-1], p[2])] p[0] += p[3] else: p[0] = []
[ "def", "p_ifdef_else_b", "(", "p", ")", ":", "global", "ENABLED", "if", "ENABLED", ":", "p", "[", "0", "]", "=", "[", "'#line %i \"%s\"%s'", "%", "(", "p", ".", "lineno", "(", "1", ")", "+", "1", ",", "CURRENT_FILE", "[", "-", "1", "]", ",", "p",...
ifdefelseb : ELSE NEWLINE program
[ "ifdefelseb", ":", "ELSE", "NEWLINE", "program" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L530-L539
boriel/zxbasic
zxbpp.py
p_if_header
def p_if_header(p): """ if_header : IFDEF ID """ global ENABLED IFDEFS.append((ENABLED, p.lineno(2))) ENABLED = ID_TABLE.defined(p[2])
python
def p_if_header(p): """ if_header : IFDEF ID """ global ENABLED IFDEFS.append((ENABLED, p.lineno(2))) ENABLED = ID_TABLE.defined(p[2])
[ "def", "p_if_header", "(", "p", ")", ":", "global", "ENABLED", "IFDEFS", ".", "append", "(", "(", "ENABLED", ",", "p", ".", "lineno", "(", "2", ")", ")", ")", "ENABLED", "=", "ID_TABLE", ".", "defined", "(", "p", "[", "2", "]", ")" ]
if_header : IFDEF ID
[ "if_header", ":", "IFDEF", "ID" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L542-L548
boriel/zxbasic
zxbpp.py
p_ifn_header
def p_ifn_header(p): """ if_header : IFNDEF ID """ global ENABLED IFDEFS.append((ENABLED, p.lineno(2))) ENABLED = not ID_TABLE.defined(p[2])
python
def p_ifn_header(p): """ if_header : IFNDEF ID """ global ENABLED IFDEFS.append((ENABLED, p.lineno(2))) ENABLED = not ID_TABLE.defined(p[2])
[ "def", "p_ifn_header", "(", "p", ")", ":", "global", "ENABLED", "IFDEFS", ".", "append", "(", "(", "ENABLED", ",", "p", ".", "lineno", "(", "2", ")", ")", ")", "ENABLED", "=", "not", "ID_TABLE", ".", "defined", "(", "p", "[", "2", "]", ")" ]
if_header : IFNDEF ID
[ "if_header", ":", "IFNDEF", "ID" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L551-L557
boriel/zxbasic
zxbpp.py
p_if_expr_header
def p_if_expr_header(p): """ if_header : IF expr """ global ENABLED IFDEFS.append((ENABLED, p.lineno(1))) ENABLED = bool(int(p[2])) if p[2].isdigit() else ID_TABLE.defined(p[2])
python
def p_if_expr_header(p): """ if_header : IF expr """ global ENABLED IFDEFS.append((ENABLED, p.lineno(1))) ENABLED = bool(int(p[2])) if p[2].isdigit() else ID_TABLE.defined(p[2])
[ "def", "p_if_expr_header", "(", "p", ")", ":", "global", "ENABLED", "IFDEFS", ".", "append", "(", "(", "ENABLED", ",", "p", ".", "lineno", "(", "1", ")", ")", ")", "ENABLED", "=", "bool", "(", "int", "(", "p", "[", "2", "]", ")", ")", "if", "p"...
if_header : IF expr
[ "if_header", ":", "IF", "expr" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L560-L566
boriel/zxbasic
zxbpp.py
p_exprlt
def p_exprlt(p): """ expr : expr LT expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a < b else '0'
python
def p_exprlt(p): """ expr : expr LT expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a < b else '0'
[ "def", "p_exprlt", "(", "p", ")", ":", "a", "=", "int", "(", "p", "[", "1", "]", ")", "if", "p", "[", "1", "]", ".", "isdigit", "(", ")", "else", "0", "b", "=", "int", "(", "p", "[", "3", "]", ")", "if", "p", "[", "3", "]", ".", "isdi...
expr : expr LT expr
[ "expr", ":", "expr", "LT", "expr" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L587-L593
boriel/zxbasic
zxbpp.py
p_exprle
def p_exprle(p): """ expr : expr LE expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a <= b else '0'
python
def p_exprle(p): """ expr : expr LE expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a <= b else '0'
[ "def", "p_exprle", "(", "p", ")", ":", "a", "=", "int", "(", "p", "[", "1", "]", ")", "if", "p", "[", "1", "]", ".", "isdigit", "(", ")", "else", "0", "b", "=", "int", "(", "p", "[", "3", "]", ")", "if", "p", "[", "3", "]", ".", "isdi...
expr : expr LE expr
[ "expr", ":", "expr", "LE", "expr" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L596-L602
boriel/zxbasic
zxbpp.py
p_exprgt
def p_exprgt(p): """ expr : expr GT expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a > b else '0'
python
def p_exprgt(p): """ expr : expr GT expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a > b else '0'
[ "def", "p_exprgt", "(", "p", ")", ":", "a", "=", "int", "(", "p", "[", "1", "]", ")", "if", "p", "[", "1", "]", ".", "isdigit", "(", ")", "else", "0", "b", "=", "int", "(", "p", "[", "3", "]", ")", "if", "p", "[", "3", "]", ".", "isdi...
expr : expr GT expr
[ "expr", ":", "expr", "GT", "expr" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L605-L611
boriel/zxbasic
zxbpp.py
p_exprge
def p_exprge(p): """ expr : expr GE expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a >= b else '0'
python
def p_exprge(p): """ expr : expr GE expr """ a = int(p[1]) if p[1].isdigit() else 0 b = int(p[3]) if p[3].isdigit() else 0 p[0] = '1' if a >= b else '0'
[ "def", "p_exprge", "(", "p", ")", ":", "a", "=", "int", "(", "p", "[", "1", "]", ")", "if", "p", "[", "1", "]", ".", "isdigit", "(", ")", "else", "0", "b", "=", "int", "(", "p", "[", "3", "]", ")", "if", "p", "[", "3", "]", ".", "isdi...
expr : expr GE expr
[ "expr", ":", "expr", "GE", "expr" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L614-L620
boriel/zxbasic
zxbpp.py
filter_
def filter_(input_, filename='<internal>', state='INITIAL'): """ Filter the input string thought the preprocessor. result is appended to OUTPUT global str """ global CURRENT_DIR prev_dir = CURRENT_DIR CURRENT_FILE.append(filename) CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1]) LEXER.in...
python
def filter_(input_, filename='<internal>', state='INITIAL'): """ Filter the input string thought the preprocessor. result is appended to OUTPUT global str """ global CURRENT_DIR prev_dir = CURRENT_DIR CURRENT_FILE.append(filename) CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1]) LEXER.in...
[ "def", "filter_", "(", "input_", ",", "filename", "=", "'<internal>'", ",", "state", "=", "'INITIAL'", ")", ":", "global", "CURRENT_DIR", "prev_dir", "=", "CURRENT_DIR", "CURRENT_FILE", ".", "append", "(", "filename", ")", "CURRENT_DIR", "=", "os", ".", "pat...
Filter the input string thought the preprocessor. result is appended to OUTPUT global str
[ "Filter", "the", "input", "string", "thought", "the", "preprocessor", ".", "result", "is", "appended", "to", "OUTPUT", "global", "str" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpp.py#L736-L749
MAVENSDC/PyTplot
pytplot/del_data.py
del_data
def del_data(name=None): """ This function will delete tplot variables that are already stored in memory. Parameters: name : str Name of the tplot variable to be deleted. If no name is provided, then all tplot variables will be deleted. Returns: ...
python
def del_data(name=None): """ This function will delete tplot variables that are already stored in memory. Parameters: name : str Name of the tplot variable to be deleted. If no name is provided, then all tplot variables will be deleted. Returns: ...
[ "def", "del_data", "(", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "tplot_names", "=", "list", "(", "data_quants", ".", "keys", "(", ")", ")", "for", "i", "in", "tplot_names", ":", "del", "data_quants", "[", "i", "]", "return", ...
This function will delete tplot variables that are already stored in memory. Parameters: name : str Name of the tplot variable to be deleted. If no name is provided, then all tplot variables will be deleted. Returns: None Examples: ...
[ "This", "function", "will", "delete", "tplot", "variables", "that", "are", "already", "stored", "in", "memory", ".", "Parameters", ":", "name", ":", "str", "Name", "of", "the", "tplot", "variable", "to", "be", "deleted", ".", "If", "no", "name", "is", "p...
train
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/del_data.py#L9-L60
MAVENSDC/PyTplot
pytplot/xlim.py
xlim
def xlim(min, max): """ This function will set the x axis range for all time series plots Parameters: min : flt The time to start all time series plots. Can be given in seconds since epoch, or as a string in the format "YYYY-MM-DD HH:MM:SS" max : flt ...
python
def xlim(min, max): """ This function will set the x axis range for all time series plots Parameters: min : flt The time to start all time series plots. Can be given in seconds since epoch, or as a string in the format "YYYY-MM-DD HH:MM:SS" max : flt ...
[ "def", "xlim", "(", "min", ",", "max", ")", ":", "if", "not", "isinstance", "(", "min", ",", "(", "int", ",", "float", ",", "complex", ")", ")", ":", "min", "=", "tplot_utilities", ".", "str_to_int", "(", "min", ")", "if", "not", "isinstance", "(",...
This function will set the x axis range for all time series plots Parameters: min : flt The time to start all time series plots. Can be given in seconds since epoch, or as a string in the format "YYYY-MM-DD HH:MM:SS" max : flt The time to end all time series...
[ "This", "function", "will", "set", "the", "x", "axis", "range", "for", "all", "time", "series", "plots", "Parameters", ":", "min", ":", "flt", "The", "time", "to", "start", "all", "time", "series", "plots", ".", "Can", "be", "given", "in", "seconds", "...
train
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/xlim.py#L10-L44
MAVENSDC/PyTplot
pytplot/zlim.py
zlim
def zlim(name, min, max): """ This function will set the z axis range displayed for a specific tplot variable. This is only used for spec plots, where the z axis represents the magnitude of the values in each bin. Parameters: name : str The name of the tplot variable that ...
python
def zlim(name, min, max): """ This function will set the z axis range displayed for a specific tplot variable. This is only used for spec plots, where the z axis represents the magnitude of the values in each bin. Parameters: name : str The name of the tplot variable that ...
[ "def", "zlim", "(", "name", ",", "min", ",", "max", ")", ":", "if", "name", "not", "in", "data_quants", ".", "keys", "(", ")", ":", "print", "(", "\"That name is currently not in pytplot.\"", ")", "return", "temp_data_quant", "=", "data_quants", "[", "name",...
This function will set the z axis range displayed for a specific tplot variable. This is only used for spec plots, where the z axis represents the magnitude of the values in each bin. Parameters: name : str The name of the tplot variable that you wish to set z limits for. ...
[ "This", "function", "will", "set", "the", "z", "axis", "range", "displayed", "for", "a", "specific", "tplot", "variable", ".", "This", "is", "only", "used", "for", "spec", "plots", "where", "the", "z", "axis", "represents", "the", "magnitude", "of", "the",...
train
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/zlim.py#L8-L42
MAVENSDC/PyTplot
pytplot/ylim.py
ylim
def ylim(name, min, max): """ This function will set the y axis range displayed for a specific tplot variable. Parameters: name : str The name of the tplot variable that you wish to set y limits for. min : flt The start of the y axis. max : flt ...
python
def ylim(name, min, max): """ This function will set the y axis range displayed for a specific tplot variable. Parameters: name : str The name of the tplot variable that you wish to set y limits for. min : flt The start of the y axis. max : flt ...
[ "def", "ylim", "(", "name", ",", "min", ",", "max", ")", ":", "if", "name", "not", "in", "data_quants", ".", "keys", "(", ")", ":", "print", "(", "\"That name is currently not in pytplot.\"", ")", "return", "temp_data_quant", "=", "data_quants", "[", "name",...
This function will set the y axis range displayed for a specific tplot variable. Parameters: name : str The name of the tplot variable that you wish to set y limits for. min : flt The start of the y axis. max : flt The end of the y axis. ...
[ "This", "function", "will", "set", "the", "y", "axis", "range", "displayed", "for", "a", "specific", "tplot", "variable", ".", "Parameters", ":", "name", ":", "str", "The", "name", "of", "the", "tplot", "variable", "that", "you", "wish", "to", "set", "y"...
train
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/ylim.py#L8-L39