Damien George
2b000474d9
py/lexer: Properly classify floats that look like hex numbers.
...
Eg 0e0 almost looks like a hex number but in fact is a float.
2015-09-07 17:33:44 +01:00
Damien George
0be3c70cd8
py/lexer: Raise SyntaxError when unicode char point out of range.
2015-09-07 17:19:17 +01:00
Damien George
081f9325f5
py/lexer: Raise NotImplError for unicode name escape, instead of assert.
2015-09-07 17:08:49 +01:00
Damien George
d241c2a592
py/lexer: Raise SyntaxError when str hex escape sequence is malformed.
...
Addresses issue #1390 .
2015-07-23 23:20:37 +01:00
Damien George
7f19a39a3b
py: Cast argument for printf to int, to be compatible with more ports.
...
This allows stmhal to be compiled with MICROPY_DEBUG_PRINTERS.
2015-06-22 17:40:12 +01:00
Damien George
7ed58cb663
py: Support unicode (utf-8 encoded) identifiers in Python source.
...
Enabled simply by making the identifier lexing code 8-bit clean.
2015-06-09 10:58:07 +00:00
Dave Hylands
3ad94d6072
extmod: Add ubinascii.unhexlify
...
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
2015-05-20 09:29:22 +01:00
Damien George
2e2e404ff7
py: Allow to compile with extra warnings (sign-compare, unused-param).
2015-03-19 00:25:33 +00:00
Damien George
7d414a1b52
py: Parse big-int/float/imag constants directly in parser.
...
Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed. This is wasteful in RAM and not efficient. Now,
these constants are parsed straight away in the parser and turned into
objects. This allows constants with large numbers of digits (so
addresses issue #1103 ) and takes us a step closer to #722 .
2015-02-08 01:57:40 +00:00
Damien George
32bade19d9
py: Convert CR to LF and CR LF to LF in lexer.
...
Only noticeable difference is how newlines are encoded in triple-quoted
strings. The behaviour now matches CPython3.
2015-01-30 00:27:46 +00:00
Damien George
16677ce311
py: Be more precise about unicode type and disabled unicode behaviour.
2015-01-28 14:07:11 +00:00
Damien George
963a5a3e82
py, unix: Allow to compile with -Wsign-compare.
...
See issue #699 .
2015-01-16 17:47:07 +00:00
Damien George
b4b10fd350
py: Put all global state together in state structures.
...
This patch consolidates all global variables in py/ core into one place,
in a global structure. Root pointers are all located together to make
GC tracing easier and more efficient.
2015-01-07 20:33:00 +00:00
Damien George
51dfcb4bb7
py: Move to guarded includes, everywhere in py/ core.
...
Addresses issue #1022 .
2015-01-01 20:32:09 +00:00
Damien George
451a087075
py: Fix printing of size_t entity; fix qemu-arm for changes to lexer.
2014-12-05 22:50:16 +00:00
Damien George
a4c52c5a3d
py: Optimise lexer by exposing lexer type.
...
mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer
functions (like checking current token kind) are now inlined.
This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460
bytes on bare-arm. It also saves a tiny bit of RAM since mp_lexer_t
is a bit smaller. Also will run a bit more efficiently.
2014-12-05 19:35:18 +00:00
Damien George
9bf5f2857d
py: Add further checks for failed malloc in lexer init functions.
2014-10-09 16:53:37 +01:00
Damien George
94fbe9711a
py: Change lexer stream API to return bytes not chars.
...
Lexer is now 8-bit clean inside strings.
2014-07-30 11:46:05 +01:00
Damien George
54eb4e723e
lexer: Convert type (u)int to mp_(u)int_t.
2014-07-03 13:47:47 +01:00
Chris Angelico
2ba2299d28
lexer, vstr: Add unicode support.
2014-06-27 00:04:18 +03:00
Paul Sokolovsky
59c675a64c
py: Include mpconfig.h before all other includes.
...
It defines types used by all other headers.
Fixes #691 .
2014-06-21 22:43:22 +03:00
Emmanuel Blot
f6932d6506
Prefix ARRAY_SIZE with micropython prefix MP_
2014-06-19 18:54:34 +02:00
Paul Sokolovsky
b0bb458810
unicode: String API is const byte*.
...
We still have that char vs byte dichotomy, but majority of string operations
now use byte.
2014-06-14 06:22:11 +03:00
Paul Sokolovsky
d3439d0c60
py: Instead of having "debug on" var, have "optimization level" var.
...
This allows to have multiple "optimization" levels (CPython has two
(-OO removes docstrings), we can have more).
2014-06-03 12:32:59 +03:00
Paul Sokolovsky
b325d25e46
lexer: Add another comment for somewhat obscure way __debug__ is handled.
2014-06-02 16:35:57 +03:00