Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PBLexer(RegexLexer):
- """
- A simple Protocol Buffer lexer useful for parsing .proto files.
- Contributed by Nick Gerakines <nick@gerakines.net>.
- """
- name = 'ProtocolBuffers'
- aliases = ['pb']
- filenames = ['*.proto']
- mimetypes = ['text/pb']
- tokens = {
- 'root': [
- (r'(message)(\s+)(\w+)', bygroups(Keyword.Reserved, Text.Whitespace, Name.Class)),
- (r'(required|optional|repeated)', Keyword.Reserved),
- (r'(string|int32)', Keyword.Type),
- (r'({|})', Punctuation),
- (r'([^ ]*)(\s+)(=)(\s+)(\d+);', bygroups(Name.Label, Text.Whitespace, Punctuation, Text.Whitespace, Number.Integer)),
- (r'=', Operator),
- (r';', Operator),
- (r'//.*?$', Comment),
- (r'[0-9]+', Number.Integer),
- (r'\s+', Text.Whitespace),
- ],
- }
Add Comment
Please, Sign In to add comment