Changeset a974c95774ce7e58a8a5e5dce39fc1955ebfa1a5


Ignore:
Timestamp:
26.07.2013 01:09:41 (8 years ago)
Author:
Stanislaw Klekot <dozzie@…>
Branches:
b66903eafbcb1d49112014abc82c8bf683413db0
Children:
be33118f34e49391c6b920a907e50b739a34e949
Parents:
5c202f4c5c3f09bda0b9a74fa95eebed398edc49
git-author:
Stanislaw Klekot <dozzie@…> (26.07.2013 01:09:41)
git-committer:
Stanislaw Klekot <dozzie@…> (26.07.2013 01:09:41)
Message:

Added raising exception in lexer on invalid indentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dashwiki/markup/lexer.py

    r5c202f ra974c9  
    6969    # stuff related to formatting whole blocks (lines, paragraphs) 
    7070    (re(r' *#.*\n'),        'COMMENT',      ['BOL', 'IS_EOL', 'SKIP']), 
    71     (re(r'(  )+\* '),       'LIST_BULLET',  ['BOL', 'INDENT']), 
    72     (re(r'(  )+\d+\. '),    'LIST_NUMERIC', ['BOL', 'INDENT']), 
    73     (re(r'(  )+[a-z]\. '),  'LIST_ALPHA',   ['BOL', 'INDENT']), 
    74     (re(r'(  )+'),          'INDENT',       ['BOL', 'INDENT', 'SKIP']), 
     71    (re(r'( )+\* '),        'LIST_BULLET',  ['BOL', 'INDENT']), 
     72    (re(r'( )+[0-9]+\. '),  'LIST_NUMERIC', ['BOL', 'INDENT']), 
     73    (re(r'( )+[a-z]\. '),   'LIST_ALPHA',   ['BOL', 'INDENT']), 
     74    (re(r'( )+'),           'INDENT',       ['BOL', 'INDENT', 'SKIP']), 
    7575 
    7676    # the rest of stuff 
     
    207207        return result[0:3] 
    208208 
     209      if abs(indent_diff) % self.expected_indent != 0: 
     210        # TODO: change the exception class 
     211        raise Exception( 
     212          'Invalid indentation at line %d, char %d' % (self.line, self.char) 
     213        ) 
     214 
    209215      if indent_diff > 0: 
    210216        marker = ('BEGIN_INDENT', '', result[2]) # indentation increased 
Note: See TracChangeset for help on using the changeset viewer.