# Convert help for ginsh functions from man page to C source
import sys, re, optparse
-rxStart = re.compile('^.*GINSH_FCN_HELP_START$')
-rxEnd = re.compile('^.*GINSH_FCN_HELP_END$')
-fcnRx = re.compile('^[.]BI\s+')
-hlpRx = re.compile('\\\\[-]')
+rxStart = re.compile(r'^.*GINSH_FCN_HELP_START$')
+rxEnd = re.compile(r'^.*GINSH_FCN_HELP_END$')
+fcnRx = re.compile(r'^[.]BI\s+')
+hlpRx = re.compile(r'\\[-]')
codeFmt = 'insert_help("%s",\n"%s"\n);\n'
def parseProto(pStr):
- pStr = fcnRx.sub('', pStr)
- pStr = re.sub('\s', '', pStr)
- pStr = re.sub('"', '', pStr)
- pStr = re.sub(',', ', ', pStr)
- pStr = re.sub('\\[', ' [', pStr)
- name = pStr.split('(')[0]
+ pStr = fcnRx.sub(r'', pStr)
+ pStr = re.sub(r'\s', '', pStr)
+ pStr = re.sub(r'"', '', pStr)
+ pStr = re.sub(r',', ', ', pStr)
+ pStr = re.sub(r'\[', ' [', pStr)
+ name = pStr.split(r'(')[0]
return name, pStr
def extractHelp(inp, out):
if fcnRx.match(l):
name, proto = parseProto(l)
elif hlpRx.match(l):
- l = hlpRx.sub('', l).strip()
- l = re.sub('"', "'", l)
+ l = hlpRx.sub(r'', l).strip()
+ l = re.sub(r'"', r"'", l)
synopsis = '%s"\n" - %s' % ( proto, l )
elif l.lower() == '.br':
synopsis = synopsis or proto
# Convert help for ginsh operators from man page to C source
import sys, re, optparse
-rxStart = re.compile('^.*GINSH_OP_HELP_START$')
-rxEnd = re.compile('^.*GINSH_OP_HELP_END$')
-fcnRx = re.compile('^[.]B\s+')
-minusRx = re.compile('\\\\[-]')
+rxStart = re.compile(r'^.*GINSH_OP_HELP_START$')
+rxEnd = re.compile(r'^.*GINSH_OP_HELP_END$')
+fcnRx = re.compile(r'^[.]B\s+')
+minusRx = re.compile(r'\\[-]')
codeFmt = 'insert_help("operators", "%s\\t" "%s");\n'
def extractHelp(inp, out):
out.write(codeFmt % ( sym, synopsis ))
break
if fcnRx.match(l):
- l = fcnRx.sub('', l)
- sym = minusRx.sub('-', l)
+ l = fcnRx.sub(r'', l)
+ sym = minusRx.sub(r'-', l)
elif l.lower() == '.tp':
out.write(codeFmt % ( sym, synopsis ))
sym, synopsis = None, None