pulseenergy / vacation

Handy little app to help you keep track of your accumulated and remaining vacation days.
GNU General Public License v2.0
5 stars 2 forks source link

Don't crash on 'take Dec 8,10' (No space between comma) #13

Open supermitch opened 8 years ago

supermitch commented 8 years ago

Fails, e.g.

(venv) ➜  vacation git:(master) ./run.py take Dec 9,10
Traceback (most recent call last):
  File "/Users/mitch/Dev/python/vacation/vacation/lexer.py", line 89, in getDay
    return int(arg)
ValueError: invalid literal for int() with base 10: '9,10'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./run.py", line 9, in <module>
    main()
  File "./run.py", line 5, in main
    vacation.main()
  File "/Users/mitch/Dev/python/vacation/vacation/vacation.py", line 18, in main
    tokens = lexer.lex(args.input)
  File "/Users/mitch/Dev/python/vacation/vacation/lexer.py", line 32, in lex
    return tokenizeTake(args[1:])
  File "/Users/mitch/Dev/python/vacation/vacation/lexer.py", line 60, in tokenizeTake
    ret = [(TAKE, date) for date in lexDate(args)]
  File "/Users/mitch/Dev/python/vacation/vacation/lexer.py", line 81, in lexDate
    day = getDay(arg)
  File "/Users/mitch/Dev/python/vacation/vacation/lexer.py", line 91, in getDay
    raise ValueError('Invalid day: {}'.format(arg))
ValueError: Invalid day: 9,10