Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by Gustavo ( 13 years ago )
# -*- coding: utf-8 -*-
import re
from pygments.lexer import RegexLexer, bygroups
from pygments.token import *
__all__ = ['LexLexer']
class LexLexer(RegexLexer):
name = 'lex'
aliases = ['flex']
filenames = ['*.l']
tokens = {
'root': [
(r'\%\{', Generic.Inserted, 'c_precode'),
(r'^(\w+)(\s+)(.*)$', bygroups(Name.Variable, Text, String.Backtick)),
(r'(\%x)(\s*)(.*)$', bygroups(Generic.Strong, Text, Keyword)),
(r'\%\%', Generic.Inserted, 'actions'),
],
'c_precode': [
(r'\%\}', Generic.Inserted, 'root'),
],
'actions': [
(r'\%\%', Generic.Heading, 'epilogue'),
(r'^\{\w+\}', Keyword),
],
'epilogue': [
],
}
Revise this Paste
Children: 69357