[asterisk-commits] mmichelson: branch mmichelson/conversion_script r397666 - /team/mmichelson/co...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 26 14:22:38 CDT 2013
Author: mmichelson
Date: Mon Aug 26 14:22:37 2013
New Revision: 397666
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397666
Log:
Modify include parsing to be more loose.
The parser required the included file name to be in
quotation marks. Included files can also be in angle
brackets or may not be quoted at all.
Modified:
team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/astconfigparser.py
Modified: team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/astconfigparser.py
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/astconfigparser.py?view=diff&rev=397666&r1=397665&r2=397666
==============================================================================
--- team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/astconfigparser.py (original)
+++ team/mmichelson/conversion_script/contrib/scripts/sip_to_pjsip/astconfigparser.py Mon Aug 26 14:22:37 2013
@@ -156,15 +156,9 @@
"""Checks to see if the given line is an include. If so return the
included filename, otherwise None.
"""
- if not line.startswith('#'):
- return None
-
- # it is an include - get file name
- try:
- return line[line.index('"') + 1:line.rindex('"')]
- except ValueError:
- print "Invalid include - could not parse filename."
- return None
+
+ match = re.match('^#include\s*[<"]?(.*)[>"]?$', line)
+ return match.group(1) if match else None
def try_section(line):
"""Checks to see if the given line is a section. If so return the section
More information about the asterisk-commits
mailing list