aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-05-24 22:21:40 +0300
committerGitHub <noreply@github.com>2018-05-24 22:21:40 +0300
commit41ab5166e42e1793419ba44e6fb060f7dbf7cd4c (patch)
tree6d5866ae11ed04e4ed147893f069bb49c6c232d6 /mesonbuild
parent160da30732fb3f24f61028b8728830e27cf4ebea (diff)
parentfa04e5c8fb24632869cff316ae4765996821287a (diff)
downloadmeson-41ab5166e42e1793419ba44e6fb060f7dbf7cd4c.zip
meson-41ab5166e42e1793419ba44e6fb060f7dbf7cd4c.tar.gz
meson-41ab5166e42e1793419ba44e6fb060f7dbf7cd4c.tar.bz2
Merge pull request #3476 from filbranden/intbase1
Add support for octal and binary int literals
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/mparser.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py
index 78683be..72cf143 100644
--- a/mesonbuild/mparser.py
+++ b/mesonbuild/mparser.py
@@ -94,8 +94,7 @@ class Lexer:
# Need to be sorted longest to shortest.
('ignore', re.compile(r'[ \t]')),
('id', re.compile('[_a-zA-Z][_0-9a-zA-Z]*')),
- ('hexnumber', re.compile('0[xX][0-9a-fA-F]+')),
- ('number', re.compile(r'\d+')),
+ ('number', re.compile(r'0[bB][01]+|0[oO][0-7]+|0[xX][0-9a-fA-F]+|0|[1-9]\d*')),
('eol_cont', re.compile(r'\\\n')),
('eol', re.compile(r'\n')),
('multiline_string', re.compile(r"'''(.|\n)*?'''", re.M)),
@@ -187,10 +186,7 @@ This will become a hard error in a future Meson release.""", self.getline(line_s
lineno += len(lines) - 1
line_start = mo.end() - len(lines[-1])
elif tid == 'number':
- value = int(match_text)
- elif tid == 'hexnumber':
- tid = 'number'
- value = int(match_text, base=16)
+ value = int(match_text, base=0)
elif tid == 'eol' or tid == 'eol_cont':
lineno += 1
line_start = loc