#format python # -*- coding: iso-8859-1 -*- """ MoinMoin - Ruby Source Parser Copyright: 2006 by Jakub Piotr Nowak License: GNU GPL """ from MoinMoin.util.ParserBase import ParserBase Dependencies = [] class Parser(ParserBase): parsename = "ColorizedRuby" extensions = ['.rb'] Dependencies = [] def setupRules(self): ParserBase.setupRules(self) self.addRulePair("Comment", "#", "\n") self.addRule("ID", "[a-zA-Z_][0-9a-zA-Z_]*") self.addRule("Number", r"[0-9]+") self.addRule("Char",r"'\\.'|'[^\\]'") self.addRule("SPChar", "[=<>\|]") self.addReserved(reserved_words) self.addConstant(constant_words) reserved_words = '''\ alias and begin break case class def defined? do else elif end ensure for if in module next nil not or redo rescue retry return self super then unless until when while yield '''.split() constant_words = '''\ true false undef '''.split()