Attachment 'shell-11.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - SHell Source Parser
4
5 @copyright: 2009 Krzysztof Stryjek <wtps0n@bsdserwis.com>
6 @license: GNU GPL, see COPYING for details.
7
8 """
9
10 from MoinMoin.parser._ParserBase import ParserBase
11
12 Dependencies = ['user'] # the "Toggle line numbers link" depends on user's language
13
14 class Parser(ParserBase):
15
16 parsername = "ColorizedShell"
17 extensions = ['.shell']
18 Dependencies = Dependencies
19
20 def setupRules(self):
21 ParserBase.setupRules(self)
22
23 self.addRule("Comment", r"#.*$")
24 self.addRulePair("String", r'"', r'$|[^\\](\\\\)*"')
25 self.addRule("Char", r"'\\.'|'[^\\]'")
26 self.addRule("Number", r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?")
27 self.addRule("ID", r"\$?[a-zA-Z_][0-9a-zA-Z_]*")
28 self.addRule("SPChar", r"[~!$%^&*()+=|\[\]:;,.<>/?{}-]")
29
30 reserved_words = ['echo', 'elif', 'until', 'in', 'alias','bg','fg',
31 'builtin', 'cd', 'command', 'chdir', 'mkdir','eval', 'exec', 'exit',
32 'export', 'fc', 'getopts',' jobid', 'hash', 'jobs', 'pwd', 'read', 'set',
33 'readonly', 'setvar', 'shitf', 'test', 'trap', 'times', 'type', 'ulimit',
34 'umask', 'unalias', 'unset', 'wait', 'bind',
35 'if', 'else', 'fi', 'while', 'for', 'do', 'done', 'case', 'esac', 'then',
36 'local', 'return', 'continue', 'break']
37
38 self.addReserved(reserved_words)
39
40 constant_words = ['true', 'false', ':']
41
42 self.addConstant(constant_words)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.