sqs3.py
Go to the documentation of this file.
00001 #!c:/python26/python.exe
00002 import sys,rp
00003 rule=['init n=0',
00004       'init m=999',
00005           'sqs  ::=  range? parms  fileid ',
00006       'range::=  n "-" m ',
00007           'n    ::=  r"[0-9]"* ',
00008           'm    ::=  r"[0-9]"* ',         
00009       'parms::=  sep car* sep ',
00010           'sep  ::=  r"\S" ',
00011           'car  ::=  r"." ^sep ',
00012           'fileid::= r"\S"* ']
00013 parms=' '.join(sys.argv[1:])
00014 
00015 cmp=rp.match(rule,parms)
00016 if cmp==None:
00017         print "Error in parsing:"
00018 else:
00019         id=None
00020         try:
00021                 id=open(cmp.fileid)
00022                 for l in id.readlines():
00023                         if l.find(cmp.car,int(cmp.n),int(cmp.m))>-1: 
00024                                 print l[:-1]
00025         except Exception,e:
00026                 print e
00027         else:
00028                 if id!=None: id.close()


rocon_ebnf
Author(s): LParis
autogenerated on Fri May 2 2014 10:35:48