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
arch/zx48k/backend/__init__.py
_varx
def _varx(ins): """ Defines a memory space with a default CONSTANT expression 1st parameter is the var name 2nd parameter is the type-size (u8 or i8 for byte, u16 or i16 for word, etc) 3rd parameter is the list of expressions. All of them will be converted to the type required. """ outpu...
python
def _varx(ins): """ Defines a memory space with a default CONSTANT expression 1st parameter is the var name 2nd parameter is the type-size (u8 or i8 for byte, u16 or i16 for word, etc) 3rd parameter is the list of expressions. All of them will be converted to the type required. """ outpu...
[ "def", "_varx", "(", "ins", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "'%s:'", "%", "ins", ".", "quad", "[", "1", "]", ")", "q", "=", "eval", "(", "ins", ".", "quad", "[", "3", "]", ")", "if", "ins", ".", "quad", "[",...
Defines a memory space with a default CONSTANT expression 1st parameter is the var name 2nd parameter is the type-size (u8 or i8 for byte, u16 or i16 for word, etc) 3rd parameter is the list of expressions. All of them will be converted to the type required.
[ "Defines", "a", "memory", "space", "with", "a", "default", "CONSTANT", "expression", "1st", "parameter", "is", "the", "var", "name", "2nd", "parameter", "is", "the", "type", "-", "size", "(", "u8", "or", "i8", "for", "byte", "u16", "or", "i16", "for", ...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L497-L524
boriel/zxbasic
arch/zx48k/backend/__init__.py
_vard
def _vard(ins): """ Defines a memory space with a default set of bytes/words in hexadecimal (starting with a number) or literals (starting with #). Numeric values with more than 2 digits represents a WORD (2 bytes) value. E.g. '01' => 0, '001' => 1, 0 bytes Literal values starts with # (1 byte) or #...
python
def _vard(ins): """ Defines a memory space with a default set of bytes/words in hexadecimal (starting with a number) or literals (starting with #). Numeric values with more than 2 digits represents a WORD (2 bytes) value. E.g. '01' => 0, '001' => 1, 0 bytes Literal values starts with # (1 byte) or #...
[ "def", "_vard", "(", "ins", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "'%s:'", "%", "ins", ".", "quad", "[", "1", "]", ")", "q", "=", "eval", "(", "ins", ".", "quad", "[", "2", "]", ")", "for", "x", "in", "q", ":", ...
Defines a memory space with a default set of bytes/words in hexadecimal (starting with a number) or literals (starting with #). Numeric values with more than 2 digits represents a WORD (2 bytes) value. E.g. '01' => 0, '001' => 1, 0 bytes Literal values starts with # (1 byte) or ## (2 bytes) E.g. '#l...
[ "Defines", "a", "memory", "space", "with", "a", "default", "set", "of", "bytes", "/", "words", "in", "hexadecimal", "(", "starting", "with", "a", "number", ")", "or", "literals", "(", "starting", "with", "#", ")", ".", "Numeric", "values", "with", "more"...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L527-L555
boriel/zxbasic
arch/zx48k/backend/__init__.py
_lvarx
def _lvarx(ins): """ Defines a local variable. 1st param is offset of the local variable. 2nd param is the type a list of bytes in hexadecimal. """ output = [] l = eval(ins.quad[3]) # List of bytes to push label = tmp_label() offset = int(ins.quad[1]) tmp = list(ins.quad) tmp[1] = ...
python
def _lvarx(ins): """ Defines a local variable. 1st param is offset of the local variable. 2nd param is the type a list of bytes in hexadecimal. """ output = [] l = eval(ins.quad[3]) # List of bytes to push label = tmp_label() offset = int(ins.quad[1]) tmp = list(ins.quad) tmp[1] = ...
[ "def", "_lvarx", "(", "ins", ")", ":", "output", "=", "[", "]", "l", "=", "eval", "(", "ins", ".", "quad", "[", "3", "]", ")", "# List of bytes to push", "label", "=", "tmp_label", "(", ")", "offset", "=", "int", "(", "ins", ".", "quad", "[", "1"...
Defines a local variable. 1st param is offset of the local variable. 2nd param is the type a list of bytes in hexadecimal.
[ "Defines", "a", "local", "variable", ".", "1st", "param", "is", "offset", "of", "the", "local", "variable", ".", "2nd", "param", "is", "the", "type", "a", "list", "of", "bytes", "in", "hexadecimal", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L558-L581
boriel/zxbasic
arch/zx48k/backend/__init__.py
_lvard
def _lvard(ins): """ Defines a local variable. 1st param is offset of the local variable. 2nd param is a list of bytes in hexadecimal. """ output = [] l = eval(ins.quad[2]) # List of bytes to push label = tmp_label() offset = int(ins.quad[1]) tmp = list(ins.quad) tmp[1] = label ...
python
def _lvard(ins): """ Defines a local variable. 1st param is offset of the local variable. 2nd param is a list of bytes in hexadecimal. """ output = [] l = eval(ins.quad[2]) # List of bytes to push label = tmp_label() offset = int(ins.quad[1]) tmp = list(ins.quad) tmp[1] = label ...
[ "def", "_lvard", "(", "ins", ")", ":", "output", "=", "[", "]", "l", "=", "eval", "(", "ins", ".", "quad", "[", "2", "]", ")", "# List of bytes to push", "label", "=", "tmp_label", "(", ")", "offset", "=", "int", "(", "ins", ".", "quad", "[", "1"...
Defines a local variable. 1st param is offset of the local variable. 2nd param is a list of bytes in hexadecimal.
[ "Defines", "a", "local", "variable", ".", "1st", "param", "is", "offset", "of", "the", "local", "variable", ".", "2nd", "param", "is", "a", "list", "of", "bytes", "in", "hexadecimal", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L584-L607
boriel/zxbasic
arch/zx48k/backend/__init__.py
_out
def _out(ins): """ Translates OUT to asm. """ output = _8bit_oper(ins.quad[2]) output.extend(_16bit_oper(ins.quad[1])) output.append('ld b, h') output.append('ld c, l') output.append('out (c), a') return output
python
def _out(ins): """ Translates OUT to asm. """ output = _8bit_oper(ins.quad[2]) output.extend(_16bit_oper(ins.quad[1])) output.append('ld b, h') output.append('ld c, l') output.append('out (c), a') return output
[ "def", "_out", "(", "ins", ")", ":", "output", "=", "_8bit_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "output", ".", "extend", "(", "_16bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", ")", "output", ".", "append", "(", "'ld b, h'...
Translates OUT to asm.
[ "Translates", "OUT", "to", "asm", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L610-L619
boriel/zxbasic
arch/zx48k/backend/__init__.py
_in
def _in(ins): """ Translates IN to asm. """ output = _16bit_oper(ins.quad[1]) output.append('ld b, h') output.append('ld c, l') output.append('in a, (c)') output.append('push af') return output
python
def _in(ins): """ Translates IN to asm. """ output = _16bit_oper(ins.quad[1]) output.append('ld b, h') output.append('ld c, l') output.append('in a, (c)') output.append('push af') return output
[ "def", "_in", "(", "ins", ")", ":", "output", "=", "_16bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'ld b, h'", ")", "output", ".", "append", "(", "'ld c, l'", ")", "output", ".", "append", "(", "'in a, (c)'"...
Translates IN to asm.
[ "Translates", "IN", "to", "asm", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L622-L631
boriel/zxbasic
arch/zx48k/backend/__init__.py
_load32
def _load32(ins): """ Load a 32 bit value from a memory address If 2nd arg. start with '*', it is always treated as an indirect value. """ output = _32bit_oper(ins.quad[2]) output.append('push de') output.append('push hl') return output
python
def _load32(ins): """ Load a 32 bit value from a memory address If 2nd arg. start with '*', it is always treated as an indirect value. """ output = _32bit_oper(ins.quad[2]) output.append('push de') output.append('push hl') return output
[ "def", "_load32", "(", "ins", ")", ":", "output", "=", "_32bit_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "output", ".", "append", "(", "'push de'", ")", "output", ".", "append", "(", "'push hl'", ")", "return", "output" ]
Load a 32 bit value from a memory address If 2nd arg. start with '*', it is always treated as an indirect value.
[ "Load", "a", "32", "bit", "value", "from", "a", "memory", "address", "If", "2nd", "arg", ".", "start", "with", "*", "it", "is", "always", "treated", "as", "an", "indirect", "value", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L654-L662
boriel/zxbasic
arch/zx48k/backend/__init__.py
_loadf16
def _loadf16(ins): """ Load a 32 bit (16.16) fixed point value from a memory address If 2nd arg. start with '*', it is always treated as an indirect value. """ output = _f16_oper(ins.quad[2]) output.append('push de') output.append('push hl') return output
python
def _loadf16(ins): """ Load a 32 bit (16.16) fixed point value from a memory address If 2nd arg. start with '*', it is always treated as an indirect value. """ output = _f16_oper(ins.quad[2]) output.append('push de') output.append('push hl') return output
[ "def", "_loadf16", "(", "ins", ")", ":", "output", "=", "_f16_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "output", ".", "append", "(", "'push de'", ")", "output", ".", "append", "(", "'push hl'", ")", "return", "output" ]
Load a 32 bit (16.16) fixed point value from a memory address If 2nd arg. start with '*', it is always treated as an indirect value.
[ "Load", "a", "32", "bit", "(", "16", ".", "16", ")", "fixed", "point", "value", "from", "a", "memory", "address", "If", "2nd", "arg", ".", "start", "with", "*", "it", "is", "always", "treated", "as", "an", "indirect", "value", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L665-L673
boriel/zxbasic
arch/zx48k/backend/__init__.py
_loadf
def _loadf(ins): """ Loads a floating point value from a memory address. If 2nd arg. start with '*', it is always treated as an indirect value. """ output = _float_oper(ins.quad[2]) output.extend(_fpush()) return output
python
def _loadf(ins): """ Loads a floating point value from a memory address. If 2nd arg. start with '*', it is always treated as an indirect value. """ output = _float_oper(ins.quad[2]) output.extend(_fpush()) return output
[ "def", "_loadf", "(", "ins", ")", ":", "output", "=", "_float_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "output", ".", "extend", "(", "_fpush", "(", ")", ")", "return", "output" ]
Loads a floating point value from a memory address. If 2nd arg. start with '*', it is always treated as an indirect value.
[ "Loads", "a", "floating", "point", "value", "from", "a", "memory", "address", ".", "If", "2nd", "arg", ".", "start", "with", "*", "it", "is", "always", "treated", "as", "an", "indirect", "value", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L676-L683
boriel/zxbasic
arch/zx48k/backend/__init__.py
_loadstr
def _loadstr(ins): """ Loads a string value from a memory address. """ temporal, output = _str_oper(ins.quad[2], no_exaf=True) if not temporal: output.append('call __LOADSTR') REQUIRES.add('loadstr.asm') output.append('push hl') return output
python
def _loadstr(ins): """ Loads a string value from a memory address. """ temporal, output = _str_oper(ins.quad[2], no_exaf=True) if not temporal: output.append('call __LOADSTR') REQUIRES.add('loadstr.asm') output.append('push hl') return output
[ "def", "_loadstr", "(", "ins", ")", ":", "temporal", ",", "output", "=", "_str_oper", "(", "ins", ".", "quad", "[", "2", "]", ",", "no_exaf", "=", "True", ")", "if", "not", "temporal", ":", "output", ".", "append", "(", "'call __LOADSTR'", ")", "REQU...
Loads a string value from a memory address.
[ "Loads", "a", "string", "value", "from", "a", "memory", "address", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L686-L696
boriel/zxbasic
arch/zx48k/backend/__init__.py
_store8
def _store8(ins): """ Stores 2nd operand content into address of 1st operand. store8 a, x => a = x Use '*' for indirect store on 1st operand. """ output = _8bit_oper(ins.quad[2]) op = ins.quad[1] indirect = op[0] == '*' if indirect: op = op[1:] immediate = op[0] == '#' ...
python
def _store8(ins): """ Stores 2nd operand content into address of 1st operand. store8 a, x => a = x Use '*' for indirect store on 1st operand. """ output = _8bit_oper(ins.quad[2]) op = ins.quad[1] indirect = op[0] == '*' if indirect: op = op[1:] immediate = op[0] == '#' ...
[ "def", "_store8", "(", "ins", ")", ":", "output", "=", "_8bit_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "op", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "op", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "op", "=...
Stores 2nd operand content into address of 1st operand. store8 a, x => a = x Use '*' for indirect store on 1st operand.
[ "Stores", "2nd", "operand", "content", "into", "address", "of", "1st", "operand", ".", "store8", "a", "x", "=", ">", "a", "=", "x", "Use", "*", "for", "indirect", "store", "on", "1st", "operand", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L699-L749
boriel/zxbasic
arch/zx48k/backend/__init__.py
_store16
def _store16(ins): """ Stores 2nd operand content into address of 1st operand. store16 a, x => *(&a) = x Use '*' for indirect store on 1st operand. """ output = [] output = _16bit_oper(ins.quad[2]) try: value = ins.quad[1] indirect = False if value[0] == '*': ...
python
def _store16(ins): """ Stores 2nd operand content into address of 1st operand. store16 a, x => *(&a) = x Use '*' for indirect store on 1st operand. """ output = [] output = _16bit_oper(ins.quad[2]) try: value = ins.quad[1] indirect = False if value[0] == '*': ...
[ "def", "_store16", "(", "ins", ")", ":", "output", "=", "[", "]", "output", "=", "_16bit_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "try", ":", "value", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "False", "if", "value", "...
Stores 2nd operand content into address of 1st operand. store16 a, x => *(&a) = x Use '*' for indirect store on 1st operand.
[ "Stores", "2nd", "operand", "content", "into", "address", "of", "1st", "operand", ".", "store16", "a", "x", "=", ">", "*", "(", "&a", ")", "=", "x", "Use", "*", "for", "indirect", "store", "on", "1st", "operand", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L752-L811
boriel/zxbasic
arch/zx48k/backend/__init__.py
_store32
def _store32(ins): """ Stores 2nd operand content into address of 1st operand. store16 a, x => *(&a) = x """ op = ins.quad[1] indirect = op[0] == '*' if indirect: op = op[1:] immediate = op[0] == '#' # Might make no sense here? if immediate: op = op[1:] if is_int...
python
def _store32(ins): """ Stores 2nd operand content into address of 1st operand. store16 a, x => *(&a) = x """ op = ins.quad[1] indirect = op[0] == '*' if indirect: op = op[1:] immediate = op[0] == '#' # Might make no sense here? if immediate: op = op[1:] if is_int...
[ "def", "_store32", "(", "ins", ")", ":", "op", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "op", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "op", "=", "op", "[", "1", ":", "]", "immediate", "=", "op", "[", "0", "]", "==...
Stores 2nd operand content into address of 1st operand. store16 a, x => *(&a) = x
[ "Stores", "2nd", "operand", "content", "into", "address", "of", "1st", "operand", ".", "store16", "a", "x", "=", ">", "*", "(", "&a", ")", "=", "x" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L814-L858
boriel/zxbasic
arch/zx48k/backend/__init__.py
_storef16
def _storef16(ins): """ Stores 2º operand content into address of 1st operand. store16 a, x => *(&a) = x """ value = ins.quad[2] if is_float(value): val = float(ins.quad[2]) # Immediate? (de, hl) = f16(val) q = list(ins.quad) q[2] = (de << 16) | hl ins.quad ...
python
def _storef16(ins): """ Stores 2º operand content into address of 1st operand. store16 a, x => *(&a) = x """ value = ins.quad[2] if is_float(value): val = float(ins.quad[2]) # Immediate? (de, hl) = f16(val) q = list(ins.quad) q[2] = (de << 16) | hl ins.quad ...
[ "def", "_storef16", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "2", "]", "if", "is_float", "(", "value", ")", ":", "val", "=", "float", "(", "ins", ".", "quad", "[", "2", "]", ")", "# Immediate?", "(", "de", ",", "hl", ")", ...
Stores 2º operand content into address of 1st operand. store16 a, x => *(&a) = x
[ "Stores", "2º", "operand", "content", "into", "address", "of", "1st", "operand", ".", "store16", "a", "x", "=", ">", "*", "(", "&a", ")", "=", "x" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L861-L873
boriel/zxbasic
arch/zx48k/backend/__init__.py
_storef
def _storef(ins): """ Stores a floating point value into a memory address. """ output = _float_oper(ins.quad[2]) op = ins.quad[1] indirect = op[0] == '*' if indirect: op = op[1:] immediate = op[0] == '#' # Might make no sense here? if immediate: op = op[1:] if is...
python
def _storef(ins): """ Stores a floating point value into a memory address. """ output = _float_oper(ins.quad[2]) op = ins.quad[1] indirect = op[0] == '*' if indirect: op = op[1:] immediate = op[0] == '#' # Might make no sense here? if immediate: op = op[1:] if is...
[ "def", "_storef", "(", "ins", ")", ":", "output", "=", "_float_oper", "(", "ins", ".", "quad", "[", "2", "]", ")", "op", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "op", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "op", "...
Stores a floating point value into a memory address.
[ "Stores", "a", "floating", "point", "value", "into", "a", "memory", "address", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L876-L910
boriel/zxbasic
arch/zx48k/backend/__init__.py
_storestr
def _storestr(ins): """ Stores a string value into a memory address. It copies content of 2nd operand (string), into 1st, reallocating dynamic memory for the 1st str. These instruction DOES ALLOW inmediate strings for the 2nd parameter, starting with '#'. Must prepend '#' (immediate sigil) to 1st o...
python
def _storestr(ins): """ Stores a string value into a memory address. It copies content of 2nd operand (string), into 1st, reallocating dynamic memory for the 1st str. These instruction DOES ALLOW inmediate strings for the 2nd parameter, starting with '#'. Must prepend '#' (immediate sigil) to 1st o...
[ "def", "_storestr", "(", "ins", ")", ":", "op1", "=", "ins", ".", "quad", "[", "1", "]", "indirect", "=", "op1", "[", "0", "]", "==", "'*'", "if", "indirect", ":", "op1", "=", "op1", "[", "1", ":", "]", "immediate", "=", "op1", "[", "0", "]",...
Stores a string value into a memory address. It copies content of 2nd operand (string), into 1st, reallocating dynamic memory for the 1st str. These instruction DOES ALLOW inmediate strings for the 2nd parameter, starting with '#'. Must prepend '#' (immediate sigil) to 1st operand, as we need the &...
[ "Stores", "a", "string", "value", "into", "a", "memory", "address", ".", "It", "copies", "content", "of", "2nd", "operand", "(", "string", ")", "into", "1st", "reallocating", "dynamic", "memory", "for", "the", "1st", "str", ".", "These", "instruction", "DO...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L913-L943
boriel/zxbasic
arch/zx48k/backend/__init__.py
_cast
def _cast(ins): """ Convert data from typeA to typeB (only numeric data types) """ # Signed and unsigned types are the same in the Z80 tA = ins.quad[2] # From TypeA tB = ins.quad[3] # To TypeB YY_TYPES[tA] # Type sizes xsB = sB = YY_TYPES[tB] # Type sizes output = [] if tA in (...
python
def _cast(ins): """ Convert data from typeA to typeB (only numeric data types) """ # Signed and unsigned types are the same in the Z80 tA = ins.quad[2] # From TypeA tB = ins.quad[3] # To TypeB YY_TYPES[tA] # Type sizes xsB = sB = YY_TYPES[tB] # Type sizes output = [] if tA in (...
[ "def", "_cast", "(", "ins", ")", ":", "# Signed and unsigned types are the same in the Z80", "tA", "=", "ins", ".", "quad", "[", "2", "]", "# From TypeA", "tB", "=", "ins", ".", "quad", "[", "3", "]", "# To TypeB", "YY_TYPES", "[", "tA", "]", "# Type sizes",...
Convert data from typeA to typeB (only numeric data types)
[ "Convert", "data", "from", "typeA", "to", "typeB", "(", "only", "numeric", "data", "types", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L946-L995
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jzerof
def _jzerof(ins): """ Jumps if top of the stack (40bit, float) is 0 to arg(1) """ value = ins.quad[1] if is_float(value): if float(value) == 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _float_oper(value) output.append('l...
python
def _jzerof(ins): """ Jumps if top of the stack (40bit, float) is 0 to arg(1) """ value = ins.quad[1] if is_float(value): if float(value) == 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _float_oper(value) output.append('l...
[ "def", "_jzerof", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "is_float", "(", "value", ")", ":", "if", "float", "(", "value", ")", "==", "0", ":", "return", "[", "'jp %s'", "%", "str", "(", "ins", ".", "quad", ...
Jumps if top of the stack (40bit, float) is 0 to arg(1)
[ "Jumps", "if", "top", "of", "the", "stack", "(", "40bit", "float", ")", "is", "0", "to", "arg", "(", "1", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1078-L1095
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jzerostr
def _jzerostr(ins): """ Jumps if top of the stack contains a NULL pointer or its len is Zero """ output = [] disposable = False # True if string must be freed from memory if ins.quad[1][0] == '_': # Variable? output.append('ld hl, (%s)' % ins.quad[1][0]) else: output.a...
python
def _jzerostr(ins): """ Jumps if top of the stack contains a NULL pointer or its len is Zero """ output = [] disposable = False # True if string must be freed from memory if ins.quad[1][0] == '_': # Variable? output.append('ld hl, (%s)' % ins.quad[1][0]) else: output.a...
[ "def", "_jzerostr", "(", "ins", ")", ":", "output", "=", "[", "]", "disposable", "=", "False", "# True if string must be freed from memory", "if", "ins", ".", "quad", "[", "1", "]", "[", "0", "]", "==", "'_'", ":", "# Variable?", "output", ".", "append", ...
Jumps if top of the stack contains a NULL pointer or its len is Zero
[ "Jumps", "if", "top", "of", "the", "stack", "contains", "a", "NULL", "pointer", "or", "its", "len", "is", "Zero" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1098-L1124
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jnzero16
def _jnzero16(ins): """ Jumps if top of the stack (16bit) is != 0 to arg(1) """ value = ins.quad[1] if is_int(value): if int(value) != 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _16bit_oper(value) output.append('ld a, h...
python
def _jnzero16(ins): """ Jumps if top of the stack (16bit) is != 0 to arg(1) """ value = ins.quad[1] if is_int(value): if int(value) != 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _16bit_oper(value) output.append('ld a, h...
[ "def", "_jnzero16", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "is_int", "(", "value", ")", ":", "if", "int", "(", "value", ")", "!=", "0", ":", "return", "[", "'jp %s'", "%", "str", "(", "ins", ".", "quad", ...
Jumps if top of the stack (16bit) is != 0 to arg(1)
[ "Jumps", "if", "top", "of", "the", "stack", "(", "16bit", ")", "is", "!", "=", "0", "to", "arg", "(", "1", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1143-L1157
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jnzero32
def _jnzero32(ins): """ Jumps if top of the stack (32bit) is !=0 to arg(1) """ value = ins.quad[1] if is_int(value): if int(value) != 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _32bit_oper(value) output.append('ld a, h'...
python
def _jnzero32(ins): """ Jumps if top of the stack (32bit) is !=0 to arg(1) """ value = ins.quad[1] if is_int(value): if int(value) != 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _32bit_oper(value) output.append('ld a, h'...
[ "def", "_jnzero32", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "is_int", "(", "value", ")", ":", "if", "int", "(", "value", ")", "!=", "0", ":", "return", "[", "'jp %s'", "%", "str", "(", "ins", ".", "quad", ...
Jumps if top of the stack (32bit) is !=0 to arg(1)
[ "Jumps", "if", "top", "of", "the", "stack", "(", "32bit", ")", "is", "!", "=", "0", "to", "arg", "(", "1", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1160-L1176
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jnzerof16
def _jnzerof16(ins): """ Jumps if top of the stack (32bit) is !=0 to arg(1) Fixed Point (16.16 bit) values. """ value = ins.quad[1] if is_float(value): if float(value) != 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _f16_...
python
def _jnzerof16(ins): """ Jumps if top of the stack (32bit) is !=0 to arg(1) Fixed Point (16.16 bit) values. """ value = ins.quad[1] if is_float(value): if float(value) != 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _f16_...
[ "def", "_jnzerof16", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "is_float", "(", "value", ")", ":", "if", "float", "(", "value", ")", "!=", "0", ":", "return", "[", "'jp %s'", "%", "str", "(", "ins", ".", "quad...
Jumps if top of the stack (32bit) is !=0 to arg(1) Fixed Point (16.16 bit) values.
[ "Jumps", "if", "top", "of", "the", "stack", "(", "32bit", ")", "is", "!", "=", "0", "to", "arg", "(", "1", ")", "Fixed", "Point", "(", "16", ".", "16", "bit", ")", "values", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1179-L1196
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jgezerou8
def _jgezerou8(ins): """ Jumps if top of the stack (8bit) is >= 0 to arg(1) Always TRUE for unsigned """ output = [] value = ins.quad[1] if not is_int(value): output = _8bit_oper(value) output.append('jp %s' % str(ins.quad[2])) return output
python
def _jgezerou8(ins): """ Jumps if top of the stack (8bit) is >= 0 to arg(1) Always TRUE for unsigned """ output = [] value = ins.quad[1] if not is_int(value): output = _8bit_oper(value) output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_jgezerou8", "(", "ins", ")", ":", "output", "=", "[", "]", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "not", "is_int", "(", "value", ")", ":", "output", "=", "_8bit_oper", "(", "value", ")", "output", ".", "append", "(", "'jp...
Jumps if top of the stack (8bit) is >= 0 to arg(1) Always TRUE for unsigned
[ "Jumps", "if", "top", "of", "the", "stack", "(", "8bit", ")", "is", ">", "=", "0", "to", "arg", "(", "1", ")", "Always", "TRUE", "for", "unsigned" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1250-L1260
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jgezeroi8
def _jgezeroi8(ins): """ Jumps if top of the stack (8bit) is >= 0 to arg(1) """ value = ins.quad[1] if is_int(value): if int(value) >= 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _8bit_oper(value) output.append('add a, a...
python
def _jgezeroi8(ins): """ Jumps if top of the stack (8bit) is >= 0 to arg(1) """ value = ins.quad[1] if is_int(value): if int(value) >= 0: return ['jp %s' % str(ins.quad[2])] # Always true else: return [] output = _8bit_oper(value) output.append('add a, a...
[ "def", "_jgezeroi8", "(", "ins", ")", ":", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "is_int", "(", "value", ")", ":", "if", "int", "(", "value", ")", ">=", "0", ":", "return", "[", "'jp %s'", "%", "str", "(", "ins", ".", "quad", ...
Jumps if top of the stack (8bit) is >= 0 to arg(1)
[ "Jumps", "if", "top", "of", "the", "stack", "(", "8bit", ")", "is", ">", "=", "0", "to", "arg", "(", "1", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1263-L1276
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jgezerou16
def _jgezerou16(ins): """ Jumps if top of the stack (16bit) is >= 0 to arg(1) Always TRUE for unsigned """ output = [] value = ins.quad[1] if not is_int(value): output = _16bit_oper(value) output.append('jp %s' % str(ins.quad[2])) return output
python
def _jgezerou16(ins): """ Jumps if top of the stack (16bit) is >= 0 to arg(1) Always TRUE for unsigned """ output = [] value = ins.quad[1] if not is_int(value): output = _16bit_oper(value) output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_jgezerou16", "(", "ins", ")", ":", "output", "=", "[", "]", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "not", "is_int", "(", "value", ")", ":", "output", "=", "_16bit_oper", "(", "value", ")", "output", ".", "append", "(", "'...
Jumps if top of the stack (16bit) is >= 0 to arg(1) Always TRUE for unsigned
[ "Jumps", "if", "top", "of", "the", "stack", "(", "16bit", ")", "is", ">", "=", "0", "to", "arg", "(", "1", ")", "Always", "TRUE", "for", "unsigned" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1279-L1289
boriel/zxbasic
arch/zx48k/backend/__init__.py
_jgezerou32
def _jgezerou32(ins): """ Jumps if top of the stack (23bit) is >= 0 to arg(1) Always TRUE for unsigned """ output = [] value = ins.quad[1] if not is_int(value): output = _32bit_oper(value) output.append('jp %s' % str(ins.quad[2])) return output
python
def _jgezerou32(ins): """ Jumps if top of the stack (23bit) is >= 0 to arg(1) Always TRUE for unsigned """ output = [] value = ins.quad[1] if not is_int(value): output = _32bit_oper(value) output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_jgezerou32", "(", "ins", ")", ":", "output", "=", "[", "]", "value", "=", "ins", ".", "quad", "[", "1", "]", "if", "not", "is_int", "(", "value", ")", ":", "output", "=", "_32bit_oper", "(", "value", ")", "output", ".", "append", "(", "'...
Jumps if top of the stack (23bit) is >= 0 to arg(1) Always TRUE for unsigned
[ "Jumps", "if", "top", "of", "the", "stack", "(", "23bit", ")", "is", ">", "=", "0", "to", "arg", "(", "1", ")", "Always", "TRUE", "for", "unsigned" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1308-L1318
boriel/zxbasic
arch/zx48k/backend/__init__.py
_ret8
def _ret8(ins): """ Returns from a procedure / function an 8bits value """ output = _8bit_oper(ins.quad[1]) output.append('#pragma opt require a') output.append('jp %s' % str(ins.quad[2])) return output
python
def _ret8(ins): """ Returns from a procedure / function an 8bits value """ output = _8bit_oper(ins.quad[1]) output.append('#pragma opt require a') output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_ret8", "(", "ins", ")", ":", "output", "=", "_8bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'#pragma opt require a'", ")", "output", ".", "append", "(", "'jp %s'", "%", "str", "(", "ins", ".", "quad"...
Returns from a procedure / function an 8bits value
[ "Returns", "from", "a", "procedure", "/", "function", "an", "8bits", "value" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1374-L1380
boriel/zxbasic
arch/zx48k/backend/__init__.py
_ret16
def _ret16(ins): """ Returns from a procedure / function a 16bits value """ output = _16bit_oper(ins.quad[1]) output.append('#pragma opt require hl') output.append('jp %s' % str(ins.quad[2])) return output
python
def _ret16(ins): """ Returns from a procedure / function a 16bits value """ output = _16bit_oper(ins.quad[1]) output.append('#pragma opt require hl') output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_ret16", "(", "ins", ")", ":", "output", "=", "_16bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'#pragma opt require hl'", ")", "output", ".", "append", "(", "'jp %s'", "%", "str", "(", "ins", ".", "qu...
Returns from a procedure / function a 16bits value
[ "Returns", "from", "a", "procedure", "/", "function", "a", "16bits", "value" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1383-L1389
boriel/zxbasic
arch/zx48k/backend/__init__.py
_ret32
def _ret32(ins): """ Returns from a procedure / function a 32bits value (even Fixed point) """ output = _32bit_oper(ins.quad[1]) output.append('#pragma opt require hl,de') output.append('jp %s' % str(ins.quad[2])) return output
python
def _ret32(ins): """ Returns from a procedure / function a 32bits value (even Fixed point) """ output = _32bit_oper(ins.quad[1]) output.append('#pragma opt require hl,de') output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_ret32", "(", "ins", ")", ":", "output", "=", "_32bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'#pragma opt require hl,de'", ")", "output", ".", "append", "(", "'jp %s'", "%", "str", "(", "ins", ".", ...
Returns from a procedure / function a 32bits value (even Fixed point)
[ "Returns", "from", "a", "procedure", "/", "function", "a", "32bits", "value", "(", "even", "Fixed", "point", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1392-L1398
boriel/zxbasic
arch/zx48k/backend/__init__.py
_retf16
def _retf16(ins): """ Returns from a procedure / function a Fixed Point (32bits) value """ output = _f16_oper(ins.quad[1]) output.append('#pragma opt require hl,de') output.append('jp %s' % str(ins.quad[2])) return output
python
def _retf16(ins): """ Returns from a procedure / function a Fixed Point (32bits) value """ output = _f16_oper(ins.quad[1]) output.append('#pragma opt require hl,de') output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_retf16", "(", "ins", ")", ":", "output", "=", "_f16_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'#pragma opt require hl,de'", ")", "output", ".", "append", "(", "'jp %s'", "%", "str", "(", "ins", ".", "...
Returns from a procedure / function a Fixed Point (32bits) value
[ "Returns", "from", "a", "procedure", "/", "function", "a", "Fixed", "Point", "(", "32bits", ")", "value" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1401-L1407
boriel/zxbasic
arch/zx48k/backend/__init__.py
_retf
def _retf(ins): """ Returns from a procedure / function a Floating Point (40bits) value """ output = _float_oper(ins.quad[1]) output.append('#pragma opt require a,bc,de') output.append('jp %s' % str(ins.quad[2])) return output
python
def _retf(ins): """ Returns from a procedure / function a Floating Point (40bits) value """ output = _float_oper(ins.quad[1]) output.append('#pragma opt require a,bc,de') output.append('jp %s' % str(ins.quad[2])) return output
[ "def", "_retf", "(", "ins", ")", ":", "output", "=", "_float_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'#pragma opt require a,bc,de'", ")", "output", ".", "append", "(", "'jp %s'", "%", "str", "(", "ins", ".", ...
Returns from a procedure / function a Floating Point (40bits) value
[ "Returns", "from", "a", "procedure", "/", "function", "a", "Floating", "Point", "(", "40bits", ")", "value" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1410-L1416
boriel/zxbasic
arch/zx48k/backend/__init__.py
_retstr
def _retstr(ins): """ Returns from a procedure / function a string pointer (16bits) value """ tmp, output = _str_oper(ins.quad[1], no_exaf=True) if not tmp: output.append('call __LOADSTR') REQUIRES.add('loadstr.asm') output.append('#pragma opt require hl') output.append('jp %s'...
python
def _retstr(ins): """ Returns from a procedure / function a string pointer (16bits) value """ tmp, output = _str_oper(ins.quad[1], no_exaf=True) if not tmp: output.append('call __LOADSTR') REQUIRES.add('loadstr.asm') output.append('#pragma opt require hl') output.append('jp %s'...
[ "def", "_retstr", "(", "ins", ")", ":", "tmp", ",", "output", "=", "_str_oper", "(", "ins", ".", "quad", "[", "1", "]", ",", "no_exaf", "=", "True", ")", "if", "not", "tmp", ":", "output", ".", "append", "(", "'call __LOADSTR'", ")", "REQUIRES", "....
Returns from a procedure / function a string pointer (16bits) value
[ "Returns", "from", "a", "procedure", "/", "function", "a", "string", "pointer", "(", "16bits", ")", "value" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1419-L1430
boriel/zxbasic
arch/zx48k/backend/__init__.py
_call
def _call(ins): """ Calls a function XXXX (or address XXXX) 2nd parameter contains size of the returning result if any, and will be pushed onto the stack. """ output = [] output.append('call %s' % str(ins.quad[1])) try: val = int(ins.quad[2]) if val == 1: output....
python
def _call(ins): """ Calls a function XXXX (or address XXXX) 2nd parameter contains size of the returning result if any, and will be pushed onto the stack. """ output = [] output.append('call %s' % str(ins.quad[1])) try: val = int(ins.quad[2]) if val == 1: output....
[ "def", "_call", "(", "ins", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "'call %s'", "%", "str", "(", "ins", ".", "quad", "[", "1", "]", ")", ")", "try", ":", "val", "=", "int", "(", "ins", ".", "quad", "[", "2", "]", "...
Calls a function XXXX (or address XXXX) 2nd parameter contains size of the returning result if any, and will be pushed onto the stack.
[ "Calls", "a", "function", "XXXX", "(", "or", "address", "XXXX", ")", "2nd", "parameter", "contains", "size", "of", "the", "returning", "result", "if", "any", "and", "will", "be", "pushed", "onto", "the", "stack", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1433-L1457
boriel/zxbasic
arch/zx48k/backend/__init__.py
_leave
def _leave(ins): """ Return from a function popping N bytes from the stack Use '__fastcall__' as 1st parameter, to just return """ global FLAG_use_function_exit output = [] if ins.quad[1] == '__fastcall__': output.append('ret') return output nbytes = int(ins.quad[1]) # Nu...
python
def _leave(ins): """ Return from a function popping N bytes from the stack Use '__fastcall__' as 1st parameter, to just return """ global FLAG_use_function_exit output = [] if ins.quad[1] == '__fastcall__': output.append('ret') return output nbytes = int(ins.quad[1]) # Nu...
[ "def", "_leave", "(", "ins", ")", ":", "global", "FLAG_use_function_exit", "output", "=", "[", "]", "if", "ins", ".", "quad", "[", "1", "]", "==", "'__fastcall__'", ":", "output", ".", "append", "(", "'ret'", ")", "return", "output", "nbytes", "=", "in...
Return from a function popping N bytes from the stack Use '__fastcall__' as 1st parameter, to just return
[ "Return", "from", "a", "function", "popping", "N", "bytes", "from", "the", "stack", "Use", "__fastcall__", "as", "1st", "parameter", "to", "just", "return" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1460-L1524
boriel/zxbasic
arch/zx48k/backend/__init__.py
_enter
def _enter(ins): """ Enter function sequence for doing a function start ins.quad[1] contains size (in bytes) of local variables Use '__fastcall__' as 1st parameter to prepare a fastcall function (no local variables). """ output = [] if ins.quad[1] == '__fastcall__': retu...
python
def _enter(ins): """ Enter function sequence for doing a function start ins.quad[1] contains size (in bytes) of local variables Use '__fastcall__' as 1st parameter to prepare a fastcall function (no local variables). """ output = [] if ins.quad[1] == '__fastcall__': retu...
[ "def", "_enter", "(", "ins", ")", ":", "output", "=", "[", "]", "if", "ins", ".", "quad", "[", "1", "]", "==", "'__fastcall__'", ":", "return", "output", "output", ".", "append", "(", "'push ix'", ")", "output", ".", "append", "(", "'ld ix, 0'", ")",...
Enter function sequence for doing a function start ins.quad[1] contains size (in bytes) of local variables Use '__fastcall__' as 1st parameter to prepare a fastcall function (no local variables).
[ "Enter", "function", "sequence", "for", "doing", "a", "function", "start", "ins", ".", "quad", "[", "1", "]", "contains", "size", "(", "in", "bytes", ")", "of", "local", "variables", "Use", "__fastcall__", "as", "1st", "parameter", "to", "prepare", "a", ...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1527-L1563
boriel/zxbasic
arch/zx48k/backend/__init__.py
_param32
def _param32(ins): """ Pushes 32bit param into the stack """ output = _32bit_oper(ins.quad[1]) output.append('push de') output.append('push hl') return output
python
def _param32(ins): """ Pushes 32bit param into the stack """ output = _32bit_oper(ins.quad[1]) output.append('push de') output.append('push hl') return output
[ "def", "_param32", "(", "ins", ")", ":", "output", "=", "_32bit_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'push de'", ")", "output", ".", "append", "(", "'push hl'", ")", "return", "output" ]
Pushes 32bit param into the stack
[ "Pushes", "32bit", "param", "into", "the", "stack" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1582-L1588
boriel/zxbasic
arch/zx48k/backend/__init__.py
_paramf16
def _paramf16(ins): """ Pushes 32bit fixed point param into the stack """ output = _f16_oper(ins.quad[1]) output.append('push de') output.append('push hl') return output
python
def _paramf16(ins): """ Pushes 32bit fixed point param into the stack """ output = _f16_oper(ins.quad[1]) output.append('push de') output.append('push hl') return output
[ "def", "_paramf16", "(", "ins", ")", ":", "output", "=", "_f16_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "append", "(", "'push de'", ")", "output", ".", "append", "(", "'push hl'", ")", "return", "output" ]
Pushes 32bit fixed point param into the stack
[ "Pushes", "32bit", "fixed", "point", "param", "into", "the", "stack" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1591-L1597
boriel/zxbasic
arch/zx48k/backend/__init__.py
_paramf
def _paramf(ins): """ Pushes 40bit (float) param into the stack """ output = _float_oper(ins.quad[1]) output.extend(_fpush()) return output
python
def _paramf(ins): """ Pushes 40bit (float) param into the stack """ output = _float_oper(ins.quad[1]) output.extend(_fpush()) return output
[ "def", "_paramf", "(", "ins", ")", ":", "output", "=", "_float_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "extend", "(", "_fpush", "(", ")", ")", "return", "output" ]
Pushes 40bit (float) param into the stack
[ "Pushes", "40bit", "(", "float", ")", "param", "into", "the", "stack" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1600-L1605
boriel/zxbasic
arch/zx48k/backend/__init__.py
_paramstr
def _paramstr(ins): """ Pushes an 16 bit unsigned value, which points to a string. For indirect values, it will push the pointer to the pointer :-) """ (tmp, output) = _str_oper(ins.quad[1]) output.pop() # Remove a register flag (useless here) tmp = ins.quad[1][0] in ('#', '_') # Determine...
python
def _paramstr(ins): """ Pushes an 16 bit unsigned value, which points to a string. For indirect values, it will push the pointer to the pointer :-) """ (tmp, output) = _str_oper(ins.quad[1]) output.pop() # Remove a register flag (useless here) tmp = ins.quad[1][0] in ('#', '_') # Determine...
[ "def", "_paramstr", "(", "ins", ")", ":", "(", "tmp", ",", "output", ")", "=", "_str_oper", "(", "ins", ".", "quad", "[", "1", "]", ")", "output", ".", "pop", "(", ")", "# Remove a register flag (useless here)", "tmp", "=", "ins", ".", "quad", "[", "...
Pushes an 16 bit unsigned value, which points to a string. For indirect values, it will push the pointer to the pointer :-)
[ "Pushes", "an", "16", "bit", "unsigned", "value", "which", "points", "to", "a", "string", ".", "For", "indirect", "values", "it", "will", "push", "the", "pointer", "to", "the", "pointer", ":", "-", ")" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1608-L1622
boriel/zxbasic
arch/zx48k/backend/__init__.py
_memcopy
def _memcopy(ins): """ Copies a block of memory from param 2 addr to param 1 addr. """ output = _16bit_oper(ins.quad[3]) output.append('ld b, h') output.append('ld c, l') output.extend(_16bit_oper(ins.quad[1], ins.quad[2], reversed=True)) output.append('ldir') # *** return output
python
def _memcopy(ins): """ Copies a block of memory from param 2 addr to param 1 addr. """ output = _16bit_oper(ins.quad[3]) output.append('ld b, h') output.append('ld c, l') output.extend(_16bit_oper(ins.quad[1], ins.quad[2], reversed=True)) output.append('ldir') # *** return output
[ "def", "_memcopy", "(", "ins", ")", ":", "output", "=", "_16bit_oper", "(", "ins", ".", "quad", "[", "3", "]", ")", "output", ".", "append", "(", "'ld b, h'", ")", "output", ".", "append", "(", "'ld c, l'", ")", "output", ".", "extend", "(", "_16bit_...
Copies a block of memory from param 2 addr to param 1 addr.
[ "Copies", "a", "block", "of", "memory", "from", "param", "2", "addr", "to", "param", "1", "addr", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1681-L1691
boriel/zxbasic
arch/zx48k/backend/__init__.py
_inline
def _inline(ins): """ Inline code """ tmp = [x.strip(' \t\r\n') for x in ins.quad[1].split('\n')] # Split lines i = 0 while i < len(tmp): if not tmp[i] or tmp[i][0] == ';': # a comment or empty string? tmp.pop(i) continue if tmp[i][0] == '#': # A preproce...
python
def _inline(ins): """ Inline code """ tmp = [x.strip(' \t\r\n') for x in ins.quad[1].split('\n')] # Split lines i = 0 while i < len(tmp): if not tmp[i] or tmp[i][0] == ';': # a comment or empty string? tmp.pop(i) continue if tmp[i][0] == '#': # A preproce...
[ "def", "_inline", "(", "ins", ")", ":", "tmp", "=", "[", "x", ".", "strip", "(", "' \\t\\r\\n'", ")", "for", "x", "in", "ins", ".", "quad", "[", "1", "]", ".", "split", "(", "'\\n'", ")", "]", "# Split lines", "i", "=", "0", "while", "i", "<", ...
Inline code
[ "Inline", "code" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L1694-L1733
boriel/zxbasic
arch/zx48k/backend/__init__.py
convertToBool
def convertToBool(): """ Convert a byte value to boolean (0 or 1) if the global flag strictBool is True """ if not OPTIONS.strictBool.value: return [] REQUIRES.add('strictbool.asm') result = [] result.append('pop af') result.append('call __NORMALIZE_BOOLEAN') result.append(...
python
def convertToBool(): """ Convert a byte value to boolean (0 or 1) if the global flag strictBool is True """ if not OPTIONS.strictBool.value: return [] REQUIRES.add('strictbool.asm') result = [] result.append('pop af') result.append('call __NORMALIZE_BOOLEAN') result.append(...
[ "def", "convertToBool", "(", ")", ":", "if", "not", "OPTIONS", ".", "strictBool", ".", "value", ":", "return", "[", "]", "REQUIRES", ".", "add", "(", "'strictbool.asm'", ")", "result", "=", "[", "]", "result", ".", "append", "(", "'pop af'", ")", "resu...
Convert a byte value to boolean (0 or 1) if the global flag strictBool is True
[ "Convert", "a", "byte", "value", "to", "boolean", "(", "0", "or", "1", ")", "if", "the", "global", "flag", "strictBool", "is", "True" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L2193-L2207
boriel/zxbasic
arch/zx48k/backend/__init__.py
emit_end
def emit_end(MEMORY=None): """ This special ending autoinitializes required inits (mainly alloc.asm) and changes the MEMORY initial address if it is ORG XXXX to ORG XXXX + heap size """ output = [] output.extend(AT_END) if REQUIRES.intersection(MEMINITS) or '__MEM_INIT' in INITS: ou...
python
def emit_end(MEMORY=None): """ This special ending autoinitializes required inits (mainly alloc.asm) and changes the MEMORY initial address if it is ORG XXXX to ORG XXXX + heap size """ output = [] output.extend(AT_END) if REQUIRES.intersection(MEMINITS) or '__MEM_INIT' in INITS: ou...
[ "def", "emit_end", "(", "MEMORY", "=", "None", ")", ":", "output", "=", "[", "]", "output", ".", "extend", "(", "AT_END", ")", "if", "REQUIRES", ".", "intersection", "(", "MEMINITS", ")", "or", "'__MEM_INIT'", "in", "INITS", ":", "output", ".", "append...
This special ending autoinitializes required inits (mainly alloc.asm) and changes the MEMORY initial address if it is ORG XXXX to ORG XXXX + heap size
[ "This", "special", "ending", "autoinitializes", "required", "inits", "(", "mainly", "alloc", ".", "asm", ")", "and", "changes", "the", "MEMORY", "initial", "address", "if", "it", "is", "ORG", "XXXX", "to", "ORG", "XXXX", "+", "heap", "size" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L2210-L2232
boriel/zxbasic
arch/zx48k/backend/__init__.py
emit
def emit(mem): """ Begin converting each quad instruction to asm by iterating over the "mem" array, and called its associated function. Each function returns an array of ASM instructions which will be appended to the 'output' array """ def output_join(output, new_chunk): """ Extends...
python
def emit(mem): """ Begin converting each quad instruction to asm by iterating over the "mem" array, and called its associated function. Each function returns an array of ASM instructions which will be appended to the 'output' array """ def output_join(output, new_chunk): """ Extends...
[ "def", "emit", "(", "mem", ")", ":", "def", "output_join", "(", "output", ",", "new_chunk", ")", ":", "\"\"\" Extends output instruction list\n performing a little peep-hole optimization\n \"\"\"", "changed", "=", "True", "and", "OPTIONS", ".", "optimization",...
Begin converting each quad instruction to asm by iterating over the "mem" array, and called its associated function. Each function returns an array of ASM instructions which will be appended to the 'output' array
[ "Begin", "converting", "each", "quad", "instruction", "to", "asm", "by", "iterating", "over", "the", "mem", "array", "and", "called", "its", "associated", "function", ".", "Each", "function", "returns", "an", "array", "of", "ASM", "instructions", "which", "wil...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__init__.py#L2351-L2779
boriel/zxbasic
zxbpplex.py
Lexer.t_asm_CONTINUE
def t_asm_CONTINUE(self, t): r'[\\_]\r?\n' t.lexer.lineno += 1 t.value = t.value[1:] return t
python
def t_asm_CONTINUE(self, t): r'[\\_]\r?\n' t.lexer.lineno += 1 t.value = t.value[1:] return t
[ "def", "t_asm_CONTINUE", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "value", "=", "t", ".", "value", "[", "1", ":", "]", "return", "t" ]
r'[\\_]\r?\n
[ "r", "[", "\\\\", "_", "]", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L89-L93
boriel/zxbasic
zxbpplex.py
Lexer.t_asmcomment_NEWLINE
def t_asmcomment_NEWLINE(self, t): r'\r?\n' # New line => remove whatever state in top of the stack and replace it with INITIAL t.lexer.lineno += 1 t.lexer.pop_state() return t
python
def t_asmcomment_NEWLINE(self, t): r'\r?\n' # New line => remove whatever state in top of the stack and replace it with INITIAL t.lexer.lineno += 1 t.lexer.pop_state() return t
[ "def", "t_asmcomment_NEWLINE", "(", "self", ",", "t", ")", ":", "# New line => remove whatever state in top of the stack and replace it with INITIAL", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "lexer", ".", "pop_state", "(", ")", "return", "t" ]
r'\r?\n
[ "r", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L102-L107
boriel/zxbasic
zxbpplex.py
Lexer.t_prepro_define_defargs_defargsopt_defexpr_pragma_if_NEWLINE
def t_prepro_define_defargs_defargsopt_defexpr_pragma_if_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_if_NEWLINE(self, t): r'\r?\n' t.lexer.lineno += 1 t.lexer.pop_state() return t
[ "def", "t_prepro_define_defargs_defargsopt_defexpr_pragma_if_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/zxbpplex.py#L137-L141
boriel/zxbasic
zxbpplex.py
Lexer.t_singlecomment_NEWLINE
def t_singlecomment_NEWLINE(self, t): r'\r?\n' t.lexer.pop_state() # Back to initial t.lexer.lineno += 1 return t
python
def t_singlecomment_NEWLINE(self, t): r'\r?\n' t.lexer.pop_state() # Back to initial t.lexer.lineno += 1 return t
[ "def", "t_singlecomment_NEWLINE", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "pop_state", "(", ")", "# Back to initial", "t", ".", "lexer", ".", "lineno", "+=", "1", "return", "t" ]
r'\r?\n
[ "r", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L152-L156
boriel/zxbasic
zxbpplex.py
Lexer.t_comment_endBlock
def t_comment_endBlock(self, t): r"'/" self.__COMMENT_LEVEL -= 1 if not self.__COMMENT_LEVEL: t.lexer.begin('INITIAL')
python
def t_comment_endBlock(self, t): r"'/" self.__COMMENT_LEVEL -= 1 if not self.__COMMENT_LEVEL: t.lexer.begin('INITIAL')
[ "def", "t_comment_endBlock", "(", "self", ",", "t", ")", ":", "self", ".", "__COMMENT_LEVEL", "-=", "1", "if", "not", "self", ".", "__COMMENT_LEVEL", ":", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")" ]
r"'/
[ "r", "/" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L173-L177
boriel/zxbasic
zxbpplex.py
Lexer.t_msg_STRING
def t_msg_STRING(self, t): r'.*\n' t.lexer.lineno += 1 t.lexer.begin('INITIAL') t.value = t.value.strip() # remove newline an spaces return t
python
def t_msg_STRING(self, t): r'.*\n' t.lexer.lineno += 1 t.lexer.begin('INITIAL') t.value = t.value.strip() # remove newline an spaces return t
[ "def", "t_msg_STRING", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")", "t", ".", "value", "=", "t", ".", "value", ".", "strip", "(", ")", "# remove newline an spa...
r'.*\n
[ "r", ".", "*", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L179-L184
boriel/zxbasic
zxbpplex.py
Lexer.t_defexpr_CONTINUE
def t_defexpr_CONTINUE(self, t): r'[\\_]\r?\n' t.lexer.lineno += 1 t.value = t.value[1:] return t
python
def t_defexpr_CONTINUE(self, t): r'[\\_]\r?\n' t.lexer.lineno += 1 t.value = t.value[1:] return t
[ "def", "t_defexpr_CONTINUE", "(", "self", ",", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "value", "=", "t", ".", "value", "[", "1", ":", "]", "return", "t" ]
r'[\\_]\r?\n
[ "r", "[", "\\\\", "_", "]", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L191-L195
boriel/zxbasic
zxbpplex.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') states_ = { 'DEFINE': 'define', 'PRAGMA': 'pragma', 'IF': 'if', 'ERROR': 'msg', 'WARNING': 'msg' ...
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') states_ = { 'DEFINE': 'define', 'PRAGMA': 'pragma', 'IF': 'if', 'ERROR': 'msg', 'WARNING': 'msg' ...
[ "def", "t_prepro_ID", "(", "self", ",", "t", ")", ":", "# preprocessor directives", "t", ".", "type", "=", "reserved_directives", ".", "get", "(", "t", ".", "value", ".", "lower", "(", ")", ",", "'ID'", ")", "states_", "=", "{", "'DEFINE'", ":", "'defi...
r'[_a-zA-Z][_a-zA-Z0-9]*
[ "r", "[", "_a", "-", "zA", "-", "Z", "]", "[", "_a", "-", "zA", "-", "Z0", "-", "9", "]", "*" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L224-L241
boriel/zxbasic
zxbpplex.py
Lexer.t_pragma_ID
def t_pragma_ID(self, t): r'[_a-zA-Z][_a-zA-Z0-9]*' # pragma directives if t.value.upper() in ('PUSH', 'POP'): t.type = t.value.upper() return t
python
def t_pragma_ID(self, t): r'[_a-zA-Z][_a-zA-Z0-9]*' # pragma directives if t.value.upper() in ('PUSH', 'POP'): t.type = t.value.upper() return t
[ "def", "t_pragma_ID", "(", "self", ",", "t", ")", ":", "# pragma directives", "if", "t", ".", "value", ".", "upper", "(", ")", "in", "(", "'PUSH'", ",", "'POP'", ")", ":", "t", ".", "type", "=", "t", ".", "value", ".", "upper", "(", ")", "return"...
r'[_a-zA-Z][_a-zA-Z0-9]*
[ "r", "[", "_a", "-", "zA", "-", "Z", "]", "[", "_a", "-", "zA", "-", "Z0", "-", "9", "]", "*" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L259-L263
boriel/zxbasic
zxbpplex.py
Lexer.t_INITIAL_asm_sharp
def t_INITIAL_asm_sharp(self, t): r'[ \t]*\#' # Only matches if at beginning of line and "#" if self.find_column(t) == 1: t.lexer.push_state('prepro') # Start preprocessor self.expectingDirective = True
python
def t_INITIAL_asm_sharp(self, t): r'[ \t]*\#' # Only matches if at beginning of line and "#" if self.find_column(t) == 1: t.lexer.push_state('prepro') # Start preprocessor self.expectingDirective = True
[ "def", "t_INITIAL_asm_sharp", "(", "self", ",", "t", ")", ":", "# Only matches if at beginning of line and \"#\"", "if", "self", ".", "find_column", "(", "t", ")", "==", "1", ":", "t", ".", "lexer", ".", "push_state", "(", "'prepro'", ")", "# Start preprocessor"...
r'[ \t]*\#
[ "r", "[", "\\", "t", "]", "*", "\\", "#" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L329-L333
boriel/zxbasic
zxbpplex.py
Lexer.put_current_line
def put_current_line(self, prefix='', suffix=''): """ Returns line and file for include / end of include sequences. """ return '%s#line %i "%s"%s' % (prefix, self.lex.lineno, self.filestack[-1][0], suffix)
python
def put_current_line(self, prefix='', suffix=''): """ Returns line and file for include / end of include sequences. """ return '%s#line %i "%s"%s' % (prefix, self.lex.lineno, self.filestack[-1][0], suffix)
[ "def", "put_current_line", "(", "self", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ")", ":", "return", "'%s#line %i \"%s\"%s'", "%", "(", "prefix", ",", "self", ".", "lex", ".", "lineno", ",", "self", ".", "filestack", "[", "-", "1", "]", "[...
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/zxbpplex.py#L385-L388
boriel/zxbasic
zxbpplex.py
Lexer.include_end
def include_end(self): """ Performs and end of include. """ self.lex = self.filestack[-1][2] self.input_data = self.filestack[-1][3] self.filestack.pop() if not self.filestack: # End of input? return self.filestack[-1][1] += 1 # Increment line coun...
python
def include_end(self): """ Performs and end of include. """ self.lex = self.filestack[-1][2] self.input_data = self.filestack[-1][3] self.filestack.pop() if not self.filestack: # End of input? return self.filestack[-1][1] += 1 # Increment line coun...
[ "def", "include_end", "(", "self", ")", ":", "self", ".", "lex", "=", "self", ".", "filestack", "[", "-", "1", "]", "[", "2", "]", "self", ".", "input_data", "=", "self", ".", "filestack", "[", "-", "1", "]", "[", "3", "]", "self", ".", "filest...
Performs and end of include.
[ "Performs", "and", "end", "of", "include", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L419-L437
boriel/zxbasic
zxbpplex.py
Lexer.input
def input(self, str, filename=''): """ Defines input string, removing current lexer. """ self.filestack.append([filename, 1, self.lex, self.input_data]) self.input_data = str self.lex = lex.lex(object=self) self.lex.input(self.input_data)
python
def input(self, str, filename=''): """ Defines input string, removing current lexer. """ self.filestack.append([filename, 1, self.lex, self.input_data]) self.input_data = str self.lex = lex.lex(object=self) self.lex.input(self.input_data)
[ "def", "input", "(", "self", ",", "str", ",", "filename", "=", "''", ")", ":", "self", ".", "filestack", ".", "append", "(", "[", "filename", ",", "1", ",", "self", ".", "lex", ",", "self", ".", "input_data", "]", ")", "self", ".", "input_data", ...
Defines input string, removing current lexer.
[ "Defines", "input", "string", "removing", "current", "lexer", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L439-L446
boriel/zxbasic
zxbpplex.py
Lexer.token
def token(self): """ Returns a token from the current input. If tok is None from the current input, it means we are at end of current input (e.g. at end of include file). If so, closes the current input and discards it; then pops the previous input and lexer from the input stack,...
python
def token(self): """ Returns a token from the current input. If tok is None from the current input, it means we are at end of current input (e.g. at end of include file). If so, closes the current input and discards it; then pops the previous input and lexer from the input stack,...
[ "def", "token", "(", "self", ")", ":", "tok", "=", "None", "if", "self", ".", "next_token", "is", "not", "None", ":", "tok", "=", "lex", ".", "LexToken", "(", ")", "tok", ".", "value", "=", "''", "tok", ".", "lineno", "=", "self", ".", "lex", "...
Returns a token from the current input. If tok is None from the current input, it means we are at end of current input (e.g. at end of include file). If so, closes the current input and discards it; then pops the previous input and lexer from the input stack, and gets another token. ...
[ "Returns", "a", "token", "from", "the", "current", "input", ".", "If", "tok", "is", "None", "from", "the", "current", "input", "it", "means", "we", "are", "at", "end", "of", "current", "input", "(", "e", ".", "g", ".", "at", "end", "of", "include", ...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L448-L476
boriel/zxbasic
zxbpplex.py
Lexer.find_column
def find_column(self, token): """ Compute column: - token is a token instance """ i = token.lexpos while i > 0: if self.input_data[i - 1] == '\n': break i -= 1 column = token.lexpos - i + 1 return column
python
def find_column(self, token): """ Compute column: - token is a token instance """ i = token.lexpos while i > 0: if self.input_data[i - 1] == '\n': break i -= 1 column = token.lexpos - i + 1 return column
[ "def", "find_column", "(", "self", ",", "token", ")", ":", "i", "=", "token", ".", "lexpos", "while", "i", ">", "0", ":", "if", "self", ".", "input_data", "[", "i", "-", "1", "]", "==", "'\\n'", ":", "break", "i", "-=", "1", "column", "=", "tok...
Compute column: - token is a token instance
[ "Compute", "column", ":", "-", "token", "is", "a", "token", "instance" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L478-L489
boriel/zxbasic
arch/zx48k/beep.py
getDEHL
def getDEHL(duration, pitch): """Converts duration,pitch to a pair of unsigned 16 bit integers, to be loaded in DE,HL, following the ROM listing. Returns a t-uple with the DE, HL values. """ intPitch = int(pitch) fractPitch = pitch - intPitch # Gets fractional part tmp = 1 + 0.0577622606 * ...
python
def getDEHL(duration, pitch): """Converts duration,pitch to a pair of unsigned 16 bit integers, to be loaded in DE,HL, following the ROM listing. Returns a t-uple with the DE, HL values. """ intPitch = int(pitch) fractPitch = pitch - intPitch # Gets fractional part tmp = 1 + 0.0577622606 * ...
[ "def", "getDEHL", "(", "duration", ",", "pitch", ")", ":", "intPitch", "=", "int", "(", "pitch", ")", "fractPitch", "=", "pitch", "-", "intPitch", "# Gets fractional part", "tmp", "=", "1", "+", "0.0577622606", "*", "fractPitch", "if", "not", "-", "60", ...
Converts duration,pitch to a pair of unsigned 16 bit integers, to be loaded in DE,HL, following the ROM listing. Returns a t-uple with the DE, HL values.
[ "Converts", "duration", "pitch", "to", "a", "pair", "of", "unsigned", "16", "bit", "integers", "to", "be", "loaded", "in", "DE", "HL", "following", "the", "ROM", "listing", ".", "Returns", "a", "t", "-", "uple", "with", "the", "DE", "HL", "values", "."...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/beep.py#L36-L60
boriel/zxbasic
symbols/block.py
SymbolBLOCK.make_node
def make_node(cls, *args): """ Creates a chain of code blocks. """ new_args = [] args = [x for x in args if not is_null(x)] for x in args: assert isinstance(x, Symbol) if x.token == 'BLOCK': new_args.extend(SymbolBLOCK.make_node(*x.childre...
python
def make_node(cls, *args): """ Creates a chain of code blocks. """ new_args = [] args = [x for x in args if not is_null(x)] for x in args: assert isinstance(x, Symbol) if x.token == 'BLOCK': new_args.extend(SymbolBLOCK.make_node(*x.childre...
[ "def", "make_node", "(", "cls", ",", "*", "args", ")", ":", "new_args", "=", "[", "]", "args", "=", "[", "x", "for", "x", "in", "args", "if", "not", "is_null", "(", "x", ")", "]", "for", "x", "in", "args", ":", "assert", "isinstance", "(", "x",...
Creates a chain of code blocks.
[ "Creates", "a", "chain", "of", "code", "blocks", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/block.py#L23-L37
boriel/zxbasic
zxblex.py
t_MACROS
def t_MACROS(t): r'__[a-zA-Z]+__' if t.value in macros: t.type = t.value return t syntax_error(t.lexer.lineno, "unknown macro '%s'" % t.value)
python
def t_MACROS(t): r'__[a-zA-Z]+__' if t.value in macros: t.type = t.value return t syntax_error(t.lexer.lineno, "unknown macro '%s'" % t.value)
[ "def", "t_MACROS", "(", "t", ")", ":", "if", "t", ".", "value", "in", "macros", ":", "t", ".", "type", "=", "t", ".", "value", "return", "t", "syntax_error", "(", "t", ".", "lexer", ".", "lineno", ",", "\"unknown macro '%s'\"", "%", "t", ".", "valu...
r'__[a-zA-Z]+__
[ "r", "__", "[", "a", "-", "zA", "-", "Z", "]", "+", "__" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L245-L252
boriel/zxbasic
zxblex.py
t_string_NGRAPH
def t_string_NGRAPH(t): r"\\[ '.:][ '.:]" global __STRING P = {' ': 0, "'": 2, '.': 8, ':': 10} N = {' ': 0, "'": 1, '.': 4, ':': 5} __STRING += chr(128 + P[t.value[1]] + N[t.value[2]])
python
def t_string_NGRAPH(t): r"\\[ '.:][ '.:]" global __STRING P = {' ': 0, "'": 2, '.': 8, ':': 10} N = {' ': 0, "'": 1, '.': 4, ':': 5} __STRING += chr(128 + P[t.value[1]] + N[t.value[2]])
[ "def", "t_string_NGRAPH", "(", "t", ")", ":", "global", "__STRING", "P", "=", "{", "' '", ":", "0", ",", "\"'\"", ":", "2", ",", "'.'", ":", "8", ",", "':'", ":", "10", "}", "N", "=", "{", "' '", ":", "0", ",", "\"'\"", ":", "1", ",", "'.'"...
r"\\[ '.:][ '.:]
[ "r", "\\\\", "[", ".", ":", "]", "[", ".", ":", "]" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L274-L281
boriel/zxbasic
zxblex.py
t_string_STRC
def t_string_STRC(t): r'"' global __STRING t.lexer.begin('INITIAL') t.value = __STRING __STRING = '' return t
python
def t_string_STRC(t): r'"' global __STRING t.lexer.begin('INITIAL') t.value = __STRING __STRING = '' return t
[ "def", "t_string_STRC", "(", "t", ")", ":", "global", "__STRING", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")", "t", ".", "value", "=", "__STRING", "__STRING", "=", "''", "return", "t" ]
r'"
[ "r" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L363-L371
boriel/zxbasic
zxblex.py
t_asm
def t_asm(t): r'\b[aA][sS][mM]\b' global ASM, ASMLINENO, IN_STATE t.lexer.begin('asm') ASM = '' ASMLINENO = t.lexer.lineno IN_STATE = True
python
def t_asm(t): r'\b[aA][sS][mM]\b' global ASM, ASMLINENO, IN_STATE t.lexer.begin('asm') ASM = '' ASMLINENO = t.lexer.lineno IN_STATE = True
[ "def", "t_asm", "(", "t", ")", ":", "global", "ASM", ",", "ASMLINENO", ",", "IN_STATE", "t", ".", "lexer", ".", "begin", "(", "'asm'", ")", "ASM", "=", "''", "ASMLINENO", "=", "t", ".", "lexer", ".", "lineno", "IN_STATE", "=", "True" ]
r'\b[aA][sS][mM]\b
[ "r", "\\", "b", "[", "aA", "]", "[", "sS", "]", "[", "mM", "]", "\\", "b" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L381-L389
boriel/zxbasic
zxblex.py
t_asm_ASM
def t_asm_ASM(t): r'\b[eE][nN][dD][ \t]+[aA][sS][mM]\b' global IN_STATE t.lexer.begin('INITIAL') t.value = ASM t.lineno = ASMLINENO - 1 IN_STATE = False return t
python
def t_asm_ASM(t): r'\b[eE][nN][dD][ \t]+[aA][sS][mM]\b' global IN_STATE t.lexer.begin('INITIAL') t.value = ASM t.lineno = ASMLINENO - 1 IN_STATE = False return t
[ "def", "t_asm_ASM", "(", "t", ")", ":", "global", "IN_STATE", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")", "t", ".", "value", "=", "ASM", "t", ".", "lineno", "=", "ASMLINENO", "-", "1", "IN_STATE", "=", "False", "return", "t" ]
r'\b[eE][nN][dD][ \t]+[aA][sS][mM]\b
[ "r", "\\", "b", "[", "eE", "]", "[", "nN", "]", "[", "dD", "]", "[", "\\", "t", "]", "+", "[", "aA", "]", "[", "sS", "]", "[", "mM", "]", "\\", "b" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L392-L402
boriel/zxbasic
zxblex.py
t_EmptyRem
def t_EmptyRem(t): r"([']|[Rr][Ee][Mm])\r?\n" t.lexer.begin('INITIAL') t.lexer.lineno += 1 t.value = '\n' t.type = 'NEWLINE' return t
python
def t_EmptyRem(t): r"([']|[Rr][Ee][Mm])\r?\n" t.lexer.begin('INITIAL') t.lexer.lineno += 1 t.value = '\n' t.type = 'NEWLINE' return t
[ "def", "t_EmptyRem", "(", "t", ")", ":", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "value", "=", "'\\n'", "t", ".", "type", "=", "'NEWLINE'", "return", "t" ]
r"([']|[Rr][Ee][Mm])\r?\n
[ "r", "(", "[", "]", "|", "[", "Rr", "]", "[", "Ee", "]", "[", "Mm", "]", ")", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L437-L445
boriel/zxbasic
zxblex.py
t_preproc_ID
def t_preproc_ID(t): r'[_A-Za-z]+' t.value = t.value.strip() t.type = preprocessor.get(t.value.lower(), 'ID') return t
python
def t_preproc_ID(t): r'[_A-Za-z]+' t.value = t.value.strip() t.type = preprocessor.get(t.value.lower(), 'ID') return t
[ "def", "t_preproc_ID", "(", "t", ")", ":", "t", ".", "value", "=", "t", ".", "value", ".", "strip", "(", ")", "t", ".", "type", "=", "preprocessor", ".", "get", "(", "t", ".", "value", ".", "lower", "(", ")", ",", "'ID'", ")", "return", "t" ]
r'[_A-Za-z]+
[ "r", "[", "_A", "-", "Za", "-", "z", "]", "+" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L448-L453
boriel/zxbasic
zxblex.py
t_ID
def t_ID(t): r'[a-zA-Z][a-zA-Z0-9]*[$%]?' t.type = reserved.get(t.value.lower(), 'ID') callables = { api.constants.CLASS.array: 'ARRAY_ID', } if t.type != 'ID': t.value = t.type else: entry = api.global_.SYMBOL_TABLE.get_entry(t.value) if api.global_.SYMBOL_TABLE is not ...
python
def t_ID(t): r'[a-zA-Z][a-zA-Z0-9]*[$%]?' t.type = reserved.get(t.value.lower(), 'ID') callables = { api.constants.CLASS.array: 'ARRAY_ID', } if t.type != 'ID': t.value = t.type else: entry = api.global_.SYMBOL_TABLE.get_entry(t.value) if api.global_.SYMBOL_TABLE is not ...
[ "def", "t_ID", "(", "t", ")", ":", "t", ".", "type", "=", "reserved", ".", "get", "(", "t", ".", "value", ".", "lower", "(", ")", ",", "'ID'", ")", "callables", "=", "{", "api", ".", "constants", ".", "CLASS", ".", "array", ":", "'ARRAY_ID'", "...
r'[a-zA-Z][a-zA-Z0-9]*[$%]?
[ "r", "[", "a", "-", "zA", "-", "Z", "]", "[", "a", "-", "zA", "-", "Z0", "-", "9", "]", "*", "[", "$%", "]", "?" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L495-L513
boriel/zxbasic
zxblex.py
t_HEXA
def t_HEXA(t): r'([0-9][0-9a-fA-F]*[hH])|(\$[0-9a-fA-F]+)|(0x[0-9a-fA-F]+)' if t.value[0] == '$': t.value = t.value[1:] # Remove initial '$' elif t.value[:2] == '0x': t.value = t.value[2:] # Remove initial '0x' else: t.value = t.value[:-1] # Remove last 'h' t.value = int(...
python
def t_HEXA(t): r'([0-9][0-9a-fA-F]*[hH])|(\$[0-9a-fA-F]+)|(0x[0-9a-fA-F]+)' if t.value[0] == '$': t.value = t.value[1:] # Remove initial '$' elif t.value[:2] == '0x': t.value = t.value[2:] # Remove initial '0x' else: t.value = t.value[:-1] # Remove last 'h' t.value = int(...
[ "def", "t_HEXA", "(", "t", ")", ":", "if", "t", ".", "value", "[", "0", "]", "==", "'$'", ":", "t", ".", "value", "=", "t", ".", "value", "[", "1", ":", "]", "# Remove initial '$'", "elif", "t", ".", "value", "[", ":", "2", "]", "==", "'0x'",...
r'([0-9][0-9a-fA-F]*[hH])|(\$[0-9a-fA-F]+)|(0x[0-9a-fA-F]+)
[ "r", "(", "[", "0", "-", "9", "]", "[", "0", "-", "9a", "-", "fA", "-", "F", "]", "*", "[", "hH", "]", ")", "|", "(", "\\", "$", "[", "0", "-", "9a", "-", "fA", "-", "F", "]", "+", ")", "|", "(", "0x", "[", "0", "-", "9a", "-", ...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L516-L528
boriel/zxbasic
zxblex.py
t_OCTAL
def t_OCTAL(t): r'[0-7]+[oO]' t.value = t.value[:-1] t.type = 'NUMBER' t.value = int(t.value, 8) return t
python
def t_OCTAL(t): r'[0-7]+[oO]' t.value = t.value[:-1] t.type = 'NUMBER' t.value = int(t.value, 8) return t
[ "def", "t_OCTAL", "(", "t", ")", ":", "t", ".", "value", "=", "t", ".", "value", "[", ":", "-", "1", "]", "t", ".", "type", "=", "'NUMBER'", "t", ".", "value", "=", "int", "(", "t", ".", "value", ",", "8", ")", "return", "t" ]
r'[0-7]+[oO]
[ "r", "[", "0", "-", "7", "]", "+", "[", "oO", "]" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L531-L537
boriel/zxbasic
zxblex.py
t_bin_NUMBER
def t_bin_NUMBER(t): r'[01]+' # A binary integer t.value = int(t.value, 2) t.lexer.begin('INITIAL') return t
python
def t_bin_NUMBER(t): r'[01]+' # A binary integer t.value = int(t.value, 2) t.lexer.begin('INITIAL') return t
[ "def", "t_bin_NUMBER", "(", "t", ")", ":", "# A binary integer", "t", ".", "value", "=", "int", "(", "t", ".", "value", ",", "2", ")", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")", "return", "t" ]
r'[01]+
[ "r", "[", "01", "]", "+" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L557-L562
boriel/zxbasic
zxblex.py
t_NUMBER
def t_NUMBER(t): # This pattern must come AFTER t_HEXA and t_BIN r'(([0-9]+(\.[0-9]+)?)|(\.[0-9]+))([eE][-+]?[0-9]+)?' t.text = t.value t.value = float(t.value) if t.value == int(t.value) and is_label(t): t.value = int(t.value) t.type = 'LABEL' return t
python
def t_NUMBER(t): # This pattern must come AFTER t_HEXA and t_BIN r'(([0-9]+(\.[0-9]+)?)|(\.[0-9]+))([eE][-+]?[0-9]+)?' t.text = t.value t.value = float(t.value) if t.value == int(t.value) and is_label(t): t.value = int(t.value) t.type = 'LABEL' return t
[ "def", "t_NUMBER", "(", "t", ")", ":", "# This pattern must come AFTER t_HEXA and t_BIN", "t", ".", "text", "=", "t", ".", "value", "t", ".", "value", "=", "float", "(", "t", ".", "value", ")", "if", "t", ".", "value", "==", "int", "(", "t", ".", "va...
r'(([0-9]+(\.[0-9]+)?)|(\.[0-9]+))([eE][-+]?[0-9]+)?
[ "r", "((", "[", "0", "-", "9", "]", "+", "(", "\\", ".", "[", "0", "-", "9", "]", "+", ")", "?", ")", "|", "(", "\\", ".", "[", "0", "-", "9", "]", "+", "))", "(", "[", "eE", "]", "[", "-", "+", "]", "?", "[", "0", "-", "9", "]"...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L565-L575
boriel/zxbasic
zxblex.py
t_bin_ZERO
def t_bin_ZERO(t): r'[^01]' t.lexer.begin('INITIAL') t.type = 'NUMBER' t.value = 0 t.lexer.lexpos -= 1 return t
python
def t_bin_ZERO(t): r'[^01]' t.lexer.begin('INITIAL') t.type = 'NUMBER' t.value = 0 t.lexer.lexpos -= 1 return t
[ "def", "t_bin_ZERO", "(", "t", ")", ":", "t", ".", "lexer", ".", "begin", "(", "'INITIAL'", ")", "t", ".", "type", "=", "'NUMBER'", "t", ".", "value", "=", "0", "t", ".", "lexer", ".", "lexpos", "-=", "1", "return", "t" ]
r'[^01]
[ "r", "[", "^01", "]" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L592-L598
boriel/zxbasic
zxblex.py
t_INITIAL_bin_NEWLINE
def t_INITIAL_bin_NEWLINE(t): r'\r?\n' global LABELS_ALLOWED t.lexer.lineno += 1 t.value = '\n' LABELS_ALLOWED = True return t
python
def t_INITIAL_bin_NEWLINE(t): r'\r?\n' global LABELS_ALLOWED t.lexer.lineno += 1 t.value = '\n' LABELS_ALLOWED = True return t
[ "def", "t_INITIAL_bin_NEWLINE", "(", "t", ")", ":", "global", "LABELS_ALLOWED", "t", ".", "lexer", ".", "lineno", "+=", "1", "t", ".", "value", "=", "'\\n'", "LABELS_ALLOWED", "=", "True", "return", "t" ]
r'\r?\n
[ "r", "\\", "r?", "\\", "n" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L602-L609
boriel/zxbasic
zxblex.py
find_column
def find_column(token): """ Compute column: input is the input text string token is a token instance """ i = token.lexpos input = token.lexer.lexdata while i > 0: if input[i - 1] == '\n': break i -= 1 column = token.lexpos - i + 1 return...
python
def find_column(token): """ Compute column: input is the input text string token is a token instance """ i = token.lexpos input = token.lexer.lexdata while i > 0: if input[i - 1] == '\n': break i -= 1 column = token.lexpos - i + 1 return...
[ "def", "find_column", "(", "token", ")", ":", "i", "=", "token", ".", "lexpos", "input", "=", "token", ".", "lexer", ".", "lexdata", "while", "i", ">", "0", ":", "if", "input", "[", "i", "-", "1", "]", "==", "'\\n'", ":", "break", "i", "-=", "1...
Compute column: input is the input text string token is a token instance
[ "Compute", "column", ":", "input", "is", "the", "input", "text", "string", "token", "is", "a", "token", "instance" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L625-L640
boriel/zxbasic
zxblex.py
is_label
def is_label(token): """ Return whether the token is a label (an integer number or id at the beginning of a line. To do so, we compute find_column() and moves back to the beginning of the line if previous chars are spaces or tabs. If column 0 is reached, it's a label. """ if not LABELS_ALLO...
python
def is_label(token): """ Return whether the token is a label (an integer number or id at the beginning of a line. To do so, we compute find_column() and moves back to the beginning of the line if previous chars are spaces or tabs. If column 0 is reached, it's a label. """ if not LABELS_ALLO...
[ "def", "is_label", "(", "token", ")", ":", "if", "not", "LABELS_ALLOWED", ":", "return", "False", "c", "=", "i", "=", "token", ".", "lexpos", "input", "=", "token", ".", "lexer", ".", "lexdata", "c", "-=", "1", "while", "c", ">", "0", "and", "input...
Return whether the token is a label (an integer number or id at the beginning of a line. To do so, we compute find_column() and moves back to the beginning of the line if previous chars are spaces or tabs. If column 0 is reached, it's a label.
[ "Return", "whether", "the", "token", "is", "a", "label", "(", "an", "integer", "number", "or", "id", "at", "the", "beginning", "of", "a", "line", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxblex.py#L643-L670
boriel/zxbasic
symbols/number.py
_get_val
def _get_val(other): """ Given a Number, a Numeric Constant or a python number return its value """ assert isinstance(other, (numbers.Number, SymbolNUMBER, SymbolCONST)) if isinstance(other, SymbolNUMBER): return other.value if isinstance(other, SymbolCONST): return other.expr.value...
python
def _get_val(other): """ Given a Number, a Numeric Constant or a python number return its value """ assert isinstance(other, (numbers.Number, SymbolNUMBER, SymbolCONST)) if isinstance(other, SymbolNUMBER): return other.value if isinstance(other, SymbolCONST): return other.expr.value...
[ "def", "_get_val", "(", "other", ")", ":", "assert", "isinstance", "(", "other", ",", "(", "numbers", ".", "Number", ",", "SymbolNUMBER", ",", "SymbolCONST", ")", ")", "if", "isinstance", "(", "other", ",", "SymbolNUMBER", ")", ":", "return", "other", "....
Given a Number, a Numeric Constant or a python number return its value
[ "Given", "a", "Number", "a", "Numeric", "Constant", "or", "a", "python", "number", "return", "its", "value" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/number.py#L21-L31
boriel/zxbasic
prepro/id_.py
ID.__dumptable
def __dumptable(self, table): """ Dumps table on screen for debugging purposes """ for x in table.table.keys(): sys.stdout.write("{0}\t<--- {1} {2}".format(x, table[x], type(table[x]))) if isinstance(table[x], ID): sys.stdout(" {0}".format(table[x]...
python
def __dumptable(self, table): """ Dumps table on screen for debugging purposes """ for x in table.table.keys(): sys.stdout.write("{0}\t<--- {1} {2}".format(x, table[x], type(table[x]))) if isinstance(table[x], ID): sys.stdout(" {0}".format(table[x]...
[ "def", "__dumptable", "(", "self", ",", "table", ")", ":", "for", "x", "in", "table", ".", "table", ".", "keys", "(", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\"{0}\\t<--- {1} {2}\"", ".", "format", "(", "x", ",", "table", "[", "x", "]",...
Dumps table on screen for debugging purposes
[ "Dumps", "table", "on", "screen", "for", "debugging", "purposes" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/prepro/id_.py#L44-L52
boriel/zxbasic
api/optimize.py
OptimizerVisitor.visit_RETURN
def visit_RETURN(self, node): """ Visits only children[1], since children[0] points to the current function being returned from (if any), and might cause infinite recursion. """ if len(node.children) == 2: node.children[1] = (yield ToVisit(node.children[1])) y...
python
def visit_RETURN(self, node): """ Visits only children[1], since children[0] points to the current function being returned from (if any), and might cause infinite recursion. """ if len(node.children) == 2: node.children[1] = (yield ToVisit(node.children[1])) y...
[ "def", "visit_RETURN", "(", "self", ",", "node", ")", ":", "if", "len", "(", "node", ".", "children", ")", "==", "2", ":", "node", ".", "children", "[", "1", "]", "=", "(", "yield", "ToVisit", "(", "node", ".", "children", "[", "1", "]", ")", "...
Visits only children[1], since children[0] points to the current function being returned from (if any), and might cause infinite recursion.
[ "Visits", "only", "children", "[", "1", "]", "since", "children", "[", "0", "]", "points", "to", "the", "current", "function", "being", "returned", "from", "(", "if", "any", ")", "and", "might", "cause", "infinite", "recursion", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/api/optimize.py#L160-L167
boriel/zxbasic
symbols/vararray.py
SymbolVARARRAY.count
def count(self): """ Total number of array cells """ return functools.reduce(lambda x, y: x * y, (x.count for x in self.bounds))
python
def count(self): """ Total number of array cells """ return functools.reduce(lambda x, y: x * y, (x.count for x in self.bounds))
[ "def", "count", "(", "self", ")", ":", "return", "functools", ".", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "*", "y", ",", "(", "x", ".", "count", "for", "x", "in", "self", ".", "bounds", ")", ")" ]
Total number of array cells
[ "Total", "number", "of", "array", "cells" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/vararray.py#L38-L41
boriel/zxbasic
symbols/vararray.py
SymbolVARARRAY.memsize
def memsize(self): """ Total array cell + indexes size """ return self.size + 1 + TYPE.size(gl.BOUND_TYPE) * len(self.bounds)
python
def memsize(self): """ Total array cell + indexes size """ return self.size + 1 + TYPE.size(gl.BOUND_TYPE) * len(self.bounds)
[ "def", "memsize", "(", "self", ")", ":", "return", "self", ".", "size", "+", "1", "+", "TYPE", ".", "size", "(", "gl", ".", "BOUND_TYPE", ")", "*", "len", "(", "self", ".", "bounds", ")" ]
Total array cell + indexes size
[ "Total", "array", "cell", "+", "indexes", "size" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/vararray.py#L48-L51
boriel/zxbasic
symbols/typecast.py
SymbolTYPECAST.make_node
def make_node(cls, new_type, node, lineno): """ Creates a node containing the type cast of the given one. If new_type == node.type, then nothing is done, and the same node is returned. Returns None on failure (and calls syntax_error) """ assert isinstance(new_typ...
python
def make_node(cls, new_type, node, lineno): """ Creates a node containing the type cast of the given one. If new_type == node.type, then nothing is done, and the same node is returned. Returns None on failure (and calls syntax_error) """ assert isinstance(new_typ...
[ "def", "make_node", "(", "cls", ",", "new_type", ",", "node", ",", "lineno", ")", ":", "assert", "isinstance", "(", "new_type", ",", "SymbolTYPE", ")", "# None (null) means the given AST node is empty (usually an error)", "if", "node", "is", "None", ":", "return", ...
Creates a node containing the type cast of the given one. If new_type == node.type, then nothing is done, and the same node is returned. Returns None on failure (and calls syntax_error)
[ "Creates", "a", "node", "containing", "the", "type", "cast", "of", "the", "given", "one", ".", "If", "new_type", "==", "node", ".", "type", "then", "nothing", "is", "done", "and", "the", "same", "node", "is", "returned", "." ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/typecast.py#L44-L102
boriel/zxbasic
asmparse.py
normalize_namespace
def normalize_namespace(namespace): """ Given a namespace (e.g. '.' or 'mynamespace'), returns it in normalized form. That is: - always prefixed with a dot - no trailing dots - any double dots are converted to single dot (..my..namespace => .my.namespace) - one or more dots (e.g....
python
def normalize_namespace(namespace): """ Given a namespace (e.g. '.' or 'mynamespace'), returns it in normalized form. That is: - always prefixed with a dot - no trailing dots - any double dots are converted to single dot (..my..namespace => .my.namespace) - one or more dots (e.g....
[ "def", "normalize_namespace", "(", "namespace", ")", ":", "namespace", "=", "(", "DOT", "+", "DOT", ".", "join", "(", "RE_DOTS", ".", "split", "(", "namespace", ")", ")", ")", ".", "rstrip", "(", "DOT", ")", "+", "DOT", "return", "namespace" ]
Given a namespace (e.g. '.' or 'mynamespace'), returns it in normalized form. That is: - always prefixed with a dot - no trailing dots - any double dots are converted to single dot (..my..namespace => .my.namespace) - one or more dots (e.g. '.', '..', '...') are converted to '.' (Glo...
[ "Given", "a", "namespace", "(", "e", ".", "g", ".", ".", "or", "mynamespace", ")", "returns", "it", "in", "normalized", "form", ".", "That", "is", ":", "-", "always", "prefixed", "with", "a", "dot", "-", "no", "trailing", "dots", "-", "any", "double"...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L55-L64
boriel/zxbasic
asmparse.py
init
def init(): """ Initializes this module """ global ORG global LEXER global MEMORY global INITS global AUTORUN_ADDR global NAMESPACE ORG = 0 # Origin of CODE INITS = [] MEMORY = None # Memory for instructions (Will be initialized with a Memory() instance) AUTORUN_ADDR =...
python
def init(): """ Initializes this module """ global ORG global LEXER global MEMORY global INITS global AUTORUN_ADDR global NAMESPACE ORG = 0 # Origin of CODE INITS = [] MEMORY = None # Memory for instructions (Will be initialized with a Memory() instance) AUTORUN_ADDR =...
[ "def", "init", "(", ")", ":", "global", "ORG", "global", "LEXER", "global", "MEMORY", "global", "INITS", "global", "AUTORUN_ADDR", "global", "NAMESPACE", "ORG", "=", "0", "# Origin of CODE", "INITS", "=", "[", "]", "MEMORY", "=", "None", "# Memory for instruct...
Initializes this module
[ "Initializes", "this", "module" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L67-L83
boriel/zxbasic
asmparse.py
p_program
def p_program(p): """ program : line """ if p[1] is not None: [MEMORY.add_instruction(x) for x in p[1] if isinstance(x, Asm)]
python
def p_program(p): """ program : line """ if p[1] is not None: [MEMORY.add_instruction(x) for x in p[1] if isinstance(x, Asm)]
[ "def", "p_program", "(", "p", ")", ":", "if", "p", "[", "1", "]", "is", "not", "None", ":", "[", "MEMORY", ".", "add_instruction", "(", "x", ")", "for", "x", "in", "p", "[", "1", "]", "if", "isinstance", "(", "x", ",", "Asm", ")", "]" ]
program : line
[ "program", ":", "line" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L601-L605
boriel/zxbasic
asmparse.py
p_program_line
def p_program_line(p): """ program : program line """ if p[2] is not None: [MEMORY.add_instruction(x) for x in p[2] if isinstance(x, Asm)]
python
def p_program_line(p): """ program : program line """ if p[2] is not None: [MEMORY.add_instruction(x) for x in p[2] if isinstance(x, Asm)]
[ "def", "p_program_line", "(", "p", ")", ":", "if", "p", "[", "2", "]", "is", "not", "None", ":", "[", "MEMORY", ".", "add_instruction", "(", "x", ")", "for", "x", "in", "p", "[", "2", "]", "if", "isinstance", "(", "x", ",", "Asm", ")", "]" ]
program : program line
[ "program", ":", "program", "line" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L608-L612
boriel/zxbasic
asmparse.py
p_def_label
def p_def_label(p): """ line : ID EQU expr NEWLINE | ID EQU pexpr NEWLINE """ p[0] = None __DEBUG__("Declaring '%s%s' in %i" % (NAMESPACE, p[1], p.lineno(1))) MEMORY.declare_label(p[1], p.lineno(1), p[3])
python
def p_def_label(p): """ line : ID EQU expr NEWLINE | ID EQU pexpr NEWLINE """ p[0] = None __DEBUG__("Declaring '%s%s' in %i" % (NAMESPACE, p[1], p.lineno(1))) MEMORY.declare_label(p[1], p.lineno(1), p[3])
[ "def", "p_def_label", "(", "p", ")", ":", "p", "[", "0", "]", "=", "None", "__DEBUG__", "(", "\"Declaring '%s%s' in %i\"", "%", "(", "NAMESPACE", ",", "p", "[", "1", "]", ",", "p", ".", "lineno", "(", "1", ")", ")", ")", "MEMORY", ".", "declare_lab...
line : ID EQU expr NEWLINE | ID EQU pexpr NEWLINE
[ "line", ":", "ID", "EQU", "expr", "NEWLINE", "|", "ID", "EQU", "pexpr", "NEWLINE" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L615-L621
boriel/zxbasic
asmparse.py
p_line_label_asm
def p_line_label_asm(p): """ line : LABEL asms NEWLINE """ p[0] = p[2] __DEBUG__("Declaring '%s%s' (value %04Xh) in %i" % (NAMESPACE, p[1], MEMORY.org, p.lineno(1))) MEMORY.declare_label(p[1], p.lineno(1))
python
def p_line_label_asm(p): """ line : LABEL asms NEWLINE """ p[0] = p[2] __DEBUG__("Declaring '%s%s' (value %04Xh) in %i" % (NAMESPACE, p[1], MEMORY.org, p.lineno(1))) MEMORY.declare_label(p[1], p.lineno(1))
[ "def", "p_line_label_asm", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "2", "]", "__DEBUG__", "(", "\"Declaring '%s%s' (value %04Xh) in %i\"", "%", "(", "NAMESPACE", ",", "p", "[", "1", "]", ",", "MEMORY", ".", "org", ",", "p", ".", "linen...
line : LABEL asms NEWLINE
[ "line", ":", "LABEL", "asms", "NEWLINE" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L624-L629
boriel/zxbasic
asmparse.py
p_asm_ld8
def p_asm_ld8(p): """ asm : LD reg8 COMMA reg8_hl | LD reg8_hl COMMA reg8 | LD reg8 COMMA reg8 | LD SP COMMA HL | LD SP COMMA reg16i | LD A COMMA reg8 | LD reg8 COMMA A | LD reg8_hl COMMA A | LD A COMMA reg8_hl ...
python
def p_asm_ld8(p): """ asm : LD reg8 COMMA reg8_hl | LD reg8_hl COMMA reg8 | LD reg8 COMMA reg8 | LD SP COMMA HL | LD SP COMMA reg16i | LD A COMMA reg8 | LD reg8 COMMA A | LD reg8_hl COMMA A | LD A COMMA reg8_hl ...
[ "def", "p_asm_ld8", "(", "p", ")", ":", "if", "p", "[", "2", "]", "in", "(", "'H'", ",", "'L'", ")", "and", "p", "[", "4", "]", "in", "(", "'IXH'", ",", "'IXL'", ",", "'IYH'", ",", "'IYL'", ")", ":", "p", "[", "0", "]", "=", "None", "erro...
asm : LD reg8 COMMA reg8_hl | LD reg8_hl COMMA reg8 | LD reg8 COMMA reg8 | LD SP COMMA HL | LD SP COMMA reg16i | LD A COMMA reg8 | LD reg8 COMMA A | LD reg8_hl COMMA A | LD A COMMA reg8_hl | LD A COMMA A ...
[ "asm", ":", "LD", "reg8", "COMMA", "reg8_hl", "|", "LD", "reg8_hl", "COMMA", "reg8", "|", "LD", "reg8", "COMMA", "reg8", "|", "LD", "SP", "COMMA", "HL", "|", "LD", "SP", "COMMA", "reg16i", "|", "LD", "A", "COMMA", "reg8", "|", "LD", "reg8", "COMMA"...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L657-L682
boriel/zxbasic
asmparse.py
p_LOCAL
def p_LOCAL(p): """ asm : LOCAL id_list """ p[0] = None for label, line in p[2]: __DEBUG__("Setting label '%s' as local at line %i" % (label, line)) MEMORY.set_label(label, line, local=True)
python
def p_LOCAL(p): """ asm : LOCAL id_list """ p[0] = None for label, line in p[2]: __DEBUG__("Setting label '%s' as local at line %i" % (label, line)) MEMORY.set_label(label, line, local=True)
[ "def", "p_LOCAL", "(", "p", ")", ":", "p", "[", "0", "]", "=", "None", "for", "label", ",", "line", "in", "p", "[", "2", "]", ":", "__DEBUG__", "(", "\"Setting label '%s' as local at line %i\"", "%", "(", "label", ",", "line", ")", ")", "MEMORY", "."...
asm : LOCAL id_list
[ "asm", ":", "LOCAL", "id_list" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L708-L715
boriel/zxbasic
asmparse.py
p_DEFS
def p_DEFS(p): # Define bytes """ asm : DEFS number_list """ if len(p[2]) > 2: error(p.lineno(1), "too many arguments for DEFS") if len(p[2]) < 2: num = Expr.makenode(Container(0, p.lineno(1))) # Defaults to 0 p[2] = p[2] + (num,) p[0] = Asm(p.lineno(1), 'DEFS', p[2])
python
def p_DEFS(p): # Define bytes """ asm : DEFS number_list """ if len(p[2]) > 2: error(p.lineno(1), "too many arguments for DEFS") if len(p[2]) < 2: num = Expr.makenode(Container(0, p.lineno(1))) # Defaults to 0 p[2] = p[2] + (num,) p[0] = Asm(p.lineno(1), 'DEFS', p[2])
[ "def", "p_DEFS", "(", "p", ")", ":", "# Define bytes", "if", "len", "(", "p", "[", "2", "]", ")", ">", "2", ":", "error", "(", "p", ".", "lineno", "(", "1", ")", ",", "\"too many arguments for DEFS\"", ")", "if", "len", "(", "p", "[", "2", "]", ...
asm : DEFS number_list
[ "asm", ":", "DEFS", "number_list" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L737-L747
boriel/zxbasic
asmparse.py
p_ind8_I
def p_ind8_I(p): """ reg8_I : LP IX PLUS expr RP | LP IX MINUS expr RP | LP IY PLUS expr RP | LP IY MINUS expr RP | LP IX PLUS pexpr RP | LP IX MINUS pexpr RP | LP IY PLUS pexpr RP | LP IY MINUS pexpr RP ...
python
def p_ind8_I(p): """ reg8_I : LP IX PLUS expr RP | LP IX MINUS expr RP | LP IY PLUS expr RP | LP IY MINUS expr RP | LP IX PLUS pexpr RP | LP IX MINUS pexpr RP | LP IY PLUS pexpr RP | LP IY MINUS pexpr RP ...
[ "def", "p_ind8_I", "(", "p", ")", ":", "expr", "=", "p", "[", "4", "]", "if", "p", "[", "3", "]", "==", "'-'", ":", "expr", "=", "Expr", ".", "makenode", "(", "Container", "(", "'-'", ",", "p", ".", "lineno", "(", "3", ")", ")", ",", "expr"...
reg8_I : LP IX PLUS expr RP | LP IX MINUS expr RP | LP IY PLUS expr RP | LP IY MINUS expr RP | LP IX PLUS pexpr RP | LP IX MINUS pexpr RP | LP IY PLUS pexpr RP | LP IY MINUS pexpr RP
[ "reg8_I", ":", "LP", "IX", "PLUS", "expr", "RP", "|", "LP", "IX", "MINUS", "expr", "RP", "|", "LP", "IY", "PLUS", "expr", "RP", "|", "LP", "IY", "MINUS", "expr", "RP", "|", "LP", "IX", "PLUS", "pexpr", "RP", "|", "LP", "IX", "MINUS", "pexpr", "...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L790-L804
boriel/zxbasic
asmparse.py
p_namespace
def p_namespace(p): """ asm : NAMESPACE ID """ global NAMESPACE NAMESPACE = normalize_namespace(p[2]) __DEBUG__('Setting namespace to ' + (NAMESPACE.rstrip(DOT) or DOT), level=1)
python
def p_namespace(p): """ asm : NAMESPACE ID """ global NAMESPACE NAMESPACE = normalize_namespace(p[2]) __DEBUG__('Setting namespace to ' + (NAMESPACE.rstrip(DOT) or DOT), level=1)
[ "def", "p_namespace", "(", "p", ")", ":", "global", "NAMESPACE", "NAMESPACE", "=", "normalize_namespace", "(", "p", "[", "2", "]", ")", "__DEBUG__", "(", "'Setting namespace to '", "+", "(", "NAMESPACE", ".", "rstrip", "(", "DOT", ")", "or", "DOT", ")", ...
asm : NAMESPACE ID
[ "asm", ":", "NAMESPACE", "ID" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L826-L832
boriel/zxbasic
asmparse.py
p_align
def p_align(p): """ asm : ALIGN expr | ALIGN pexpr """ align = p[2].eval() if align < 2: error(p.lineno(1), "ALIGN value must be greater than 1") return MEMORY.set_org(MEMORY.org + (align - MEMORY.org % align) % align, p.lineno(1))
python
def p_align(p): """ asm : ALIGN expr | ALIGN pexpr """ align = p[2].eval() if align < 2: error(p.lineno(1), "ALIGN value must be greater than 1") return MEMORY.set_org(MEMORY.org + (align - MEMORY.org % align) % align, p.lineno(1))
[ "def", "p_align", "(", "p", ")", ":", "align", "=", "p", "[", "2", "]", ".", "eval", "(", ")", "if", "align", "<", "2", ":", "error", "(", "p", ".", "lineno", "(", "1", ")", ",", "\"ALIGN value must be greater than 1\"", ")", "return", "MEMORY", "....
asm : ALIGN expr | ALIGN pexpr
[ "asm", ":", "ALIGN", "expr", "|", "ALIGN", "pexpr" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L835-L844
boriel/zxbasic
asmparse.py
p_incbin
def p_incbin(p): """ asm : INCBIN STRING """ try: fname = zxbpp.search_filename(p[2], p.lineno(2), local_first=True) if not fname: p[0] = None return with api.utils.open_file(fname, 'rb') as f: filecontent = f.read() except IOError: err...
python
def p_incbin(p): """ asm : INCBIN STRING """ try: fname = zxbpp.search_filename(p[2], p.lineno(2), local_first=True) if not fname: p[0] = None return with api.utils.open_file(fname, 'rb') as f: filecontent = f.read() except IOError: err...
[ "def", "p_incbin", "(", "p", ")", ":", "try", ":", "fname", "=", "zxbpp", ".", "search_filename", "(", "p", "[", "2", "]", ",", "p", ".", "lineno", "(", "2", ")", ",", "local_first", "=", "True", ")", "if", "not", "fname", ":", "p", "[", "0", ...
asm : INCBIN STRING
[ "asm", ":", "INCBIN", "STRING" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L847-L862
boriel/zxbasic
asmparse.py
p_LD_reg_val
def p_LD_reg_val(p): """ asm : LD reg8 COMMA expr | LD reg8 COMMA pexpr | LD reg16 COMMA expr | LD reg8_hl COMMA expr | LD A COMMA expr | LD SP COMMA expr | LD reg8i COMMA expr """ s = 'LD %s,N' % p[2] if p[2] in REGS16: s +...
python
def p_LD_reg_val(p): """ asm : LD reg8 COMMA expr | LD reg8 COMMA pexpr | LD reg16 COMMA expr | LD reg8_hl COMMA expr | LD A COMMA expr | LD SP COMMA expr | LD reg8i COMMA expr """ s = 'LD %s,N' % p[2] if p[2] in REGS16: s +...
[ "def", "p_LD_reg_val", "(", "p", ")", ":", "s", "=", "'LD %s,N'", "%", "p", "[", "2", "]", "if", "p", "[", "2", "]", "in", "REGS16", ":", "s", "+=", "'N'", "p", "[", "0", "]", "=", "Asm", "(", "p", ".", "lineno", "(", "1", ")", ",", "s", ...
asm : LD reg8 COMMA expr | LD reg8 COMMA pexpr | LD reg16 COMMA expr | LD reg8_hl COMMA expr | LD A COMMA expr | LD SP COMMA expr | LD reg8i COMMA expr
[ "asm", ":", "LD", "reg8", "COMMA", "expr", "|", "LD", "reg8", "COMMA", "pexpr", "|", "LD", "reg16", "COMMA", "expr", "|", "LD", "reg8_hl", "COMMA", "expr", "|", "LD", "A", "COMMA", "expr", "|", "LD", "SP", "COMMA", "expr", "|", "LD", "reg8i", "COMM...
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L886-L899
boriel/zxbasic
asmparse.py
p_JP_hl
def p_JP_hl(p): """ asm : JP reg8_hl | JP LP reg16i RP """ s = 'JP ' if p[2] == '(HL)': s += p[2] else: s += '(%s)' % p[3] p[0] = Asm(p.lineno(1), s)
python
def p_JP_hl(p): """ asm : JP reg8_hl | JP LP reg16i RP """ s = 'JP ' if p[2] == '(HL)': s += p[2] else: s += '(%s)' % p[3] p[0] = Asm(p.lineno(1), s)
[ "def", "p_JP_hl", "(", "p", ")", ":", "s", "=", "'JP '", "if", "p", "[", "2", "]", "==", "'(HL)'", ":", "s", "+=", "p", "[", "2", "]", "else", ":", "s", "+=", "'(%s)'", "%", "p", "[", "3", "]", "p", "[", "0", "]", "=", "Asm", "(", "p", ...
asm : JP reg8_hl | JP LP reg16i RP
[ "asm", ":", "JP", "reg8_hl", "|", "JP", "LP", "reg16i", "RP" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L908-L918
boriel/zxbasic
asmparse.py
p_BIT
def p_BIT(p): """ asm : bitop expr COMMA A | bitop pexpr COMMA A | bitop expr COMMA reg8 | bitop pexpr COMMA reg8 | bitop expr COMMA reg8_hl | bitop pexpr COMMA reg8_hl """ bit = p[2].eval() if bit < 0 or bit > 7: error(p.lineno(3), 'In...
python
def p_BIT(p): """ asm : bitop expr COMMA A | bitop pexpr COMMA A | bitop expr COMMA reg8 | bitop pexpr COMMA reg8 | bitop expr COMMA reg8_hl | bitop pexpr COMMA reg8_hl """ bit = p[2].eval() if bit < 0 or bit > 7: error(p.lineno(3), 'In...
[ "def", "p_BIT", "(", "p", ")", ":", "bit", "=", "p", "[", "2", "]", ".", "eval", "(", ")", "if", "bit", "<", "0", "or", "bit", ">", "7", ":", "error", "(", "p", ".", "lineno", "(", "3", ")", ",", "'Invalid bit position %i. Must be in [0..7]'", "%...
asm : bitop expr COMMA A | bitop pexpr COMMA A | bitop expr COMMA reg8 | bitop pexpr COMMA reg8 | bitop expr COMMA reg8_hl | bitop pexpr COMMA reg8_hl
[ "asm", ":", "bitop", "expr", "COMMA", "A", "|", "bitop", "pexpr", "COMMA", "A", "|", "bitop", "expr", "COMMA", "reg8", "|", "bitop", "pexpr", "COMMA", "reg8", "|", "bitop", "expr", "COMMA", "reg8_hl", "|", "bitop", "pexpr", "COMMA", "reg8_hl" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L1045-L1059
boriel/zxbasic
asmparse.py
p_BIT_ix
def p_BIT_ix(p): """ asm : bitop expr COMMA reg8_I | bitop pexpr COMMA reg8_I """ bit = p[2].eval() if bit < 0 or bit > 7: error(p.lineno(3), 'Invalid bit position %i. Must be in [0..7]' % bit) p[0] = None return p[0] = Asm(p.lineno(3), '%s %i,%s' % (p[1], bit, p...
python
def p_BIT_ix(p): """ asm : bitop expr COMMA reg8_I | bitop pexpr COMMA reg8_I """ bit = p[2].eval() if bit < 0 or bit > 7: error(p.lineno(3), 'Invalid bit position %i. Must be in [0..7]' % bit) p[0] = None return p[0] = Asm(p.lineno(3), '%s %i,%s' % (p[1], bit, p...
[ "def", "p_BIT_ix", "(", "p", ")", ":", "bit", "=", "p", "[", "2", "]", ".", "eval", "(", ")", "if", "bit", "<", "0", "or", "bit", ">", "7", ":", "error", "(", "p", ".", "lineno", "(", "3", ")", ",", "'Invalid bit position %i. Must be in [0..7]'", ...
asm : bitop expr COMMA reg8_I | bitop pexpr COMMA reg8_I
[ "asm", ":", "bitop", "expr", "COMMA", "reg8_I", "|", "bitop", "pexpr", "COMMA", "reg8_I" ]
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L1062-L1072