Esempio n. 1
0
class Word(mg.Grammar):
    '''one or more unicode characters.'''
    # also matches number and underscore.
    # Match a bunch of punctuation marks.
    # Punctuation marks are usually used in the Other grammar
    # but occasionally get used in the main entries.
    grammar = (mge.RE(r"[-,!()+<>?$£&.°'′’/\w]+"))
Esempio n. 2
0
class Initial(mg.Grammar):
    '''Only capitalized initials are allowed'''
    grammar = (mge.RE(r'\w'), mg.LITERAL('.'))
Esempio n. 3
0
class Item(mg.Grammar):
    '''Parse the item (entry) number.'''
    grammar = (mge.RE(r'[0-9]{2,3}[a-c]*'))
Esempio n. 4
0
class Section(mg.Grammar):
    '''Parse a section number.'''
    grammar = (mge.RE(r'[0-9]{2,3}'))
Esempio n. 5
0
class WhiteSpace(mg.Grammar):
    '''Parse white space.'''
    grammar = (mge.RE(r'[ \t\r\n]+'))