summaryrefslogtreecommitdiff
path: root/src/pyparsing.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2016-05-18 14:08:34 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2016-05-18 14:08:34 +0000
commitdbdb18942dba44d321f1c648a684b8bbd48671b3 (patch)
tree4da8c6d8eca6c84ea45647314e9d27bf7738c7e7 /src/pyparsing.py
parent19199513b3cd832d4d73904bc8af3f1120fd5629 (diff)
downloadpyparsing-git-dbdb18942dba44d321f1c648a684b8bbd48671b3.tar.gz
Add hex_integer to pyparsing_common
Diffstat (limited to 'src/pyparsing.py')
-rw-r--r--src/pyparsing.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py
index be90545..2fb471e 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -3917,6 +3917,9 @@ class pyparsing_common:
integer = Word(nums).setName("integer").setParseAction(convertToInteger)
"""expression that parses an unsigned integer and returns an int"""
+ hex_integer = Word(hexnums).setName("hex integer").setParseAction(lambda t: int(t[0], 16))
+ """expression that parses a hexadecimal integer and returns an int"""
+
signedInteger = Regex(r'[+-]?\d+').setName("signed integer").setParseAction(convertToInteger)
"""expression that parses an integer with optional leading sign and returns an int"""