Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed spelling: "exponant" -> "exponent". #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions baron/grammator.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ def testlist1(pack):
@pg.production("atom : HEXA")
@pg.production("atom : BINARY")
@pg.production("atom : FLOAT")
@pg.production("atom : FLOAT_EXPONANT")
@pg.production("atom : FLOAT_EXPONANT_COMPLEX")
@pg.production("atom : FLOAT_EXPONENT")
@pg.production("atom : FLOAT_EXPONENT_COMPLEX")
@pg.production("atom : COMPLEX")
def int(pack):
(int_,) = pack
Expand Down
4 changes: 2 additions & 2 deletions baron/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ def child_by_key(node, key):
"space": [("string", "value", True)],
"binary": [("string", "value", True)],
"complex": [("string", "value", True)],
"float_exponant": [("string", "value", True)],
"float_exponent": [("string", "value", True)],
"left_parenthesis": [("string", "value", True)],
"right_parenthesis": [("string", "value", True)],
"float_exponant_complex": [("string", "value", True)],
"float_exponent_complex": [("string", "value", True)],

"break": [("string", "type", True)],
"continue": [("string", "type", True)],
Expand Down
12 changes: 6 additions & 6 deletions baron/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class UnknowItem(BaronError):
TOKENS = (
(r'[a-zA-Z_]\w*', 'NAME'),
(r'0', 'INT'),
(r'[-+]?\d+[eE][-+]?\d+[jJ]', 'FLOAT_EXPONANT_COMPLEX'),
(r'[-+]?\d+.\d?[eE][-+]?\d+[jJ]', 'FLOAT_EXPONANT_COMPLEX'),
(r'[-+]?\d?.\d+[eE][-+]?\d+[jJ]', 'FLOAT_EXPONANT_COMPLEX'),
(r'\d+[eE][-+]?\d*', 'FLOAT_EXPONANT'),
(r'\d+\.\d*[eE][-+]?\d*', 'FLOAT_EXPONANT'),
(r'\.\d+[eE][-+]?\d*', 'FLOAT_EXPONANT'),
(r'[-+]?\d+[eE][-+]?\d+[jJ]', 'FLOAT_EXPONENT_COMPLEX'),
(r'[-+]?\d+.\d?[eE][-+]?\d+[jJ]', 'FLOAT_EXPONENT_COMPLEX'),
(r'[-+]?\d?.\d+[eE][-+]?\d+[jJ]', 'FLOAT_EXPONENT_COMPLEX'),
(r'\d+[eE][-+]?\d*', 'FLOAT_EXPONENT'),
(r'\d+\.\d*[eE][-+]?\d*', 'FLOAT_EXPONENT'),
(r'\.\d+[eE][-+]?\d*', 'FLOAT_EXPONENT'),
(r'\d*\.\d+[jJ]', 'COMPLEX'),
(r'\d+\.[jJ]', 'COMPLEX'),
(r'\d+[jJ]', 'COMPLEX'),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def test_complex():
check_dumps("10j")


def test_float_exponant():
def test_float_exponent():
check_dumps("1e9")


Expand Down
4 changes: 2 additions & 2 deletions tests/test_grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_unicode_raw_string():
grouper_test("UR'pouet'", ["UR", "'pouet'"], ["UR'pouet'"])


def test_exponant():
def test_exponent():
grouper_test("1e+123", ['1e', '+', '123'], ['1e+123'])
grouper_test("1e-123", ['1e', '-', '123'], ['1e-123'])
grouper_test("1.1e+123", ['1', '.', '1e', '+', '123'], ['1.1e+123'])
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_complex():
grouper_test("1e1j", ['1e1j'], ['1e1j'])


def test_float_exponant():
def test_float_exponent():
grouper_test("1E1", ['1E1'], ['1E1'])
grouper_test("1E-2", ['1E', '-', '2'], ['1E-2'])
grouper_test("1E+2", ['1E', '+', '2'], ['1E+2'])
Expand Down
230 changes: 115 additions & 115 deletions tests/test_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ def test_octa():
match('0O1235L', 'OCTA')


def test_float_exponant():
match('1234e10', 'FLOAT_EXPONANT')
match('1234E10', 'FLOAT_EXPONANT')
match('1234e+10', 'FLOAT_EXPONANT')
match('1234e-10', 'FLOAT_EXPONANT')
match('1234E+10', 'FLOAT_EXPONANT')
match('1234E-10', 'FLOAT_EXPONANT')
match('1234.5678e10', 'FLOAT_EXPONANT')
match('1234.5678E10', 'FLOAT_EXPONANT')
match('1234.5678e+10', 'FLOAT_EXPONANT')
match('1234.5678e-10', 'FLOAT_EXPONANT')
match('1234.5678E+10', 'FLOAT_EXPONANT')
match('1234.5678E-10', 'FLOAT_EXPONANT')
match('.5678e10', 'FLOAT_EXPONANT')
match('.5678E10', 'FLOAT_EXPONANT')
match('.5678e+10', 'FLOAT_EXPONANT')
match('.5678e-10', 'FLOAT_EXPONANT')
match('.5678E+10', 'FLOAT_EXPONANT')
match('.5678E-10', 'FLOAT_EXPONANT')
def test_float_exponent():
match('1234e10', 'FLOAT_EXPONENT')
match('1234E10', 'FLOAT_EXPONENT')
match('1234e+10', 'FLOAT_EXPONENT')
match('1234e-10', 'FLOAT_EXPONENT')
match('1234E+10', 'FLOAT_EXPONENT')
match('1234E-10', 'FLOAT_EXPONENT')
match('1234.5678e10', 'FLOAT_EXPONENT')
match('1234.5678E10', 'FLOAT_EXPONENT')
match('1234.5678e+10', 'FLOAT_EXPONENT')
match('1234.5678e-10', 'FLOAT_EXPONENT')
match('1234.5678E+10', 'FLOAT_EXPONENT')
match('1234.5678E-10', 'FLOAT_EXPONENT')
match('.5678e10', 'FLOAT_EXPONENT')
match('.5678E10', 'FLOAT_EXPONENT')
match('.5678e+10', 'FLOAT_EXPONENT')
match('.5678e-10', 'FLOAT_EXPONENT')
match('.5678E+10', 'FLOAT_EXPONENT')
match('.5678E-10', 'FLOAT_EXPONENT')


def test_left_parenthesis():
Expand Down Expand Up @@ -366,17 +366,17 @@ def test_zero():
match("0", "INT")


def test_float_exponant_advanced():
match("1E1", "FLOAT_EXPONANT")
match("1E-2", "FLOAT_EXPONANT")
match("1E+2", "FLOAT_EXPONANT")
match("1.E1", "FLOAT_EXPONANT")
match(".1E1", "FLOAT_EXPONANT")
match("1e1", "FLOAT_EXPONANT")
match("1e-2", "FLOAT_EXPONANT")
match("1e+2", "FLOAT_EXPONANT")
match("1.e1", "FLOAT_EXPONANT")
match(".1e1", "FLOAT_EXPONANT")
def test_float_exponent_advanced():
match("1E1", "FLOAT_EXPONENT")
match("1E-2", "FLOAT_EXPONENT")
match("1E+2", "FLOAT_EXPONENT")
match("1.E1", "FLOAT_EXPONENT")
match(".1E1", "FLOAT_EXPONENT")
match("1e1", "FLOAT_EXPONENT")
match("1e-2", "FLOAT_EXPONENT")
match("1e+2", "FLOAT_EXPONENT")
match("1.e1", "FLOAT_EXPONENT")
match(".1e1", "FLOAT_EXPONENT")


def test_complex():
Expand All @@ -396,90 +396,90 @@ def test_float_advanced():
match("1.1", "FLOAT")


def test_exponant_complex():
match("1e1j", "FLOAT_EXPONANT_COMPLEX")
match("1.e1j", "FLOAT_EXPONANT_COMPLEX")
match("1.1e1j", "FLOAT_EXPONANT_COMPLEX")
match(".1e1j", "FLOAT_EXPONANT_COMPLEX")
match("-1.e1j", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e1j", "FLOAT_EXPONANT_COMPLEX")
match("-.1e1j", "FLOAT_EXPONANT_COMPLEX")
match("1e-1j", "FLOAT_EXPONANT_COMPLEX")
match("1.e-1j", "FLOAT_EXPONANT_COMPLEX")
match("1.1e-1j", "FLOAT_EXPONANT_COMPLEX")
match(".1e-1j", "FLOAT_EXPONANT_COMPLEX")
match("-1.e-1j", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e-1j", "FLOAT_EXPONANT_COMPLEX")
match("-.1e-1j", "FLOAT_EXPONANT_COMPLEX")
match("1e+1j", "FLOAT_EXPONANT_COMPLEX")
match("1.e+1j", "FLOAT_EXPONANT_COMPLEX")
match("1.1e+1j", "FLOAT_EXPONANT_COMPLEX")
match(".1e+1j", "FLOAT_EXPONANT_COMPLEX")
match("-1.e+1j", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e+1j", "FLOAT_EXPONANT_COMPLEX")
match("-.1e+1j", "FLOAT_EXPONANT_COMPLEX")
match("1e1J", "FLOAT_EXPONANT_COMPLEX")
match("1.e1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1e1J", "FLOAT_EXPONANT_COMPLEX")
match(".1e1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.e1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1e1J", "FLOAT_EXPONANT_COMPLEX")
match("1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("1.e-1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1e-1J", "FLOAT_EXPONANT_COMPLEX")
match(".1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.e-1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("1.e+1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1e+1J", "FLOAT_EXPONANT_COMPLEX")
match(".1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.e+1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("1e1J", "FLOAT_EXPONANT_COMPLEX")
match("1.e1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1e1J", "FLOAT_EXPONANT_COMPLEX")
match(".1e1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.e1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1e1J", "FLOAT_EXPONANT_COMPLEX")
match("1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("1.e-1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1e-1J", "FLOAT_EXPONANT_COMPLEX")
match(".1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.e-1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1e-1J", "FLOAT_EXPONANT_COMPLEX")
match("1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("1.e+1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1e+1J", "FLOAT_EXPONANT_COMPLEX")
match(".1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.e+1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1e+1J", "FLOAT_EXPONANT_COMPLEX")
match("1E1J", "FLOAT_EXPONANT_COMPLEX")
match("1.E1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1E1J", "FLOAT_EXPONANT_COMPLEX")
match(".1E1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.E1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1E1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1E1J", "FLOAT_EXPONANT_COMPLEX")
match("1E-1J", "FLOAT_EXPONANT_COMPLEX")
match("1.E-1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1E-1J", "FLOAT_EXPONANT_COMPLEX")
match(".1E-1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.E-1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1E-1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1E-1J", "FLOAT_EXPONANT_COMPLEX")
match("1E+1J", "FLOAT_EXPONANT_COMPLEX")
match("1.E+1J", "FLOAT_EXPONANT_COMPLEX")
match("1.1E+1J", "FLOAT_EXPONANT_COMPLEX")
match(".1E+1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.E+1J", "FLOAT_EXPONANT_COMPLEX")
match("-1.1E+1J", "FLOAT_EXPONANT_COMPLEX")
match("-.1E+1J", "FLOAT_EXPONANT_COMPLEX")
def test_exponent_complex():
match("1e1j", "FLOAT_EXPONENT_COMPLEX")
match("1.e1j", "FLOAT_EXPONENT_COMPLEX")
match("1.1e1j", "FLOAT_EXPONENT_COMPLEX")
match(".1e1j", "FLOAT_EXPONENT_COMPLEX")
match("-1.e1j", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e1j", "FLOAT_EXPONENT_COMPLEX")
match("-.1e1j", "FLOAT_EXPONENT_COMPLEX")
match("1e-1j", "FLOAT_EXPONENT_COMPLEX")
match("1.e-1j", "FLOAT_EXPONENT_COMPLEX")
match("1.1e-1j", "FLOAT_EXPONENT_COMPLEX")
match(".1e-1j", "FLOAT_EXPONENT_COMPLEX")
match("-1.e-1j", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e-1j", "FLOAT_EXPONENT_COMPLEX")
match("-.1e-1j", "FLOAT_EXPONENT_COMPLEX")
match("1e+1j", "FLOAT_EXPONENT_COMPLEX")
match("1.e+1j", "FLOAT_EXPONENT_COMPLEX")
match("1.1e+1j", "FLOAT_EXPONENT_COMPLEX")
match(".1e+1j", "FLOAT_EXPONENT_COMPLEX")
match("-1.e+1j", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e+1j", "FLOAT_EXPONENT_COMPLEX")
match("-.1e+1j", "FLOAT_EXPONENT_COMPLEX")
match("1e1J", "FLOAT_EXPONENT_COMPLEX")
match("1.e1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1e1J", "FLOAT_EXPONENT_COMPLEX")
match(".1e1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.e1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1e1J", "FLOAT_EXPONENT_COMPLEX")
match("1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("1.e-1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1e-1J", "FLOAT_EXPONENT_COMPLEX")
match(".1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.e-1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("1.e+1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1e+1J", "FLOAT_EXPONENT_COMPLEX")
match(".1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.e+1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("1e1J", "FLOAT_EXPONENT_COMPLEX")
match("1.e1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1e1J", "FLOAT_EXPONENT_COMPLEX")
match(".1e1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.e1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1e1J", "FLOAT_EXPONENT_COMPLEX")
match("1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("1.e-1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1e-1J", "FLOAT_EXPONENT_COMPLEX")
match(".1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.e-1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1e-1J", "FLOAT_EXPONENT_COMPLEX")
match("1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("1.e+1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1e+1J", "FLOAT_EXPONENT_COMPLEX")
match(".1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.e+1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1e+1J", "FLOAT_EXPONENT_COMPLEX")
match("1E1J", "FLOAT_EXPONENT_COMPLEX")
match("1.E1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1E1J", "FLOAT_EXPONENT_COMPLEX")
match(".1E1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.E1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1E1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1E1J", "FLOAT_EXPONENT_COMPLEX")
match("1E-1J", "FLOAT_EXPONENT_COMPLEX")
match("1.E-1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1E-1J", "FLOAT_EXPONENT_COMPLEX")
match(".1E-1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.E-1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1E-1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1E-1J", "FLOAT_EXPONENT_COMPLEX")
match("1E+1J", "FLOAT_EXPONENT_COMPLEX")
match("1.E+1J", "FLOAT_EXPONENT_COMPLEX")
match("1.1E+1J", "FLOAT_EXPONENT_COMPLEX")
match(".1E+1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.E+1J", "FLOAT_EXPONENT_COMPLEX")
match("-1.1E+1J", "FLOAT_EXPONENT_COMPLEX")
match("-.1E+1J", "FLOAT_EXPONENT_COMPLEX")

# TODO 1.1e1j