Skip to content
Snippets Groups Projects
Commit 523e8c71 authored by Laurent Peuch's avatar Laurent Peuch Committed by GitHub
Browse files

Merge pull request #107 from boxed/incorrect-exponent-parser

Fixed incorrect tokenization case "d*e-1". Fixes #85
parents 88b0c2b7 bf098503
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -96,7 +96,7 @@ def group_generator(sequence):
if re.match(r'^\d+\.?[eE]$', current) and match_on_next(r'^\d+$', iterator):
current += next(iterator)
 
if re.match(r'^\d*\.?\d*[eE]$', current) and match_on_next(r'^[-+]$', iterator) and iterator.show_next(2) and re.match(r'^\d+$', iterator.show_next(2)):
if re.match(r'^\d*\.?\d*[eE]$', current) and not re.match('[eE]', current) and match_on_next(r'^[-+]$', iterator) and iterator.show_next(2) and re.match(r'^\d+$', iterator.show_next(2)):
current += next(iterator)
current += next(iterator)
 
Loading
Loading
Loading
Loading
@@ -534,3 +534,7 @@ def test_try_import_after_colon():
 
def test_single_object():
assert baron.dumps({"type": "name", "value": "a"}) == "a"
def test_crash_issue_85():
check_dumps('d*e-1\n')
\ No newline at end of file
Loading
Loading
@@ -80,6 +80,22 @@ def test_float_exponant():
match('.5678E-10', 'FLOAT_EXPONANT')
 
 
def test_floating_point_parser_bug_85():
from baron import parse
assert parse('d*e-1') == [
{'first': {'first': {'type': 'name', 'value': 'd'},
'first_formatting': [],
'second': {'type': 'name', 'value': 'e'},
'second_formatting': [],
'type': 'binary_operator',
'value': '*'},
'first_formatting': [],
'second': {'section': 'number', 'type': 'int', 'value': '1'},
'second_formatting': [],
'type': 'binary_operator',
'value': '-'}]
def test_left_parenthesis():
match('(', 'LEFT_PARENTHESIS')
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment