--- /tmp/gnat-gps-4.3/share/plug-ins/ada_support.py 2010-01-24 21:16:27.000000000 +0100
+++ gnat-gps-4.3/share/plug-ins/ada_support.py 2010-11-12 02:59:24.000000000 +0100
@@ -11,25 +11,28 @@
## No user customization below this line
###########################################################################
-import GPS, os, os.path, re, string, traceback
-import os_utils, gnat_switches
-
+import GPS, os, os.path, re
+import os_utils
+from xml.sax.saxutils import escape
gnatmakeproc = None
def label (prefix, switch):
+ import gnat_switches
if gnat_switches.switches_comments.has_key (prefix+switch[0]):
str = re.sub ("^(Activate warnings|Validity checks) (on|for) ", "", gnat_switches.switches_comments[prefix+switch[0]][0].strip())
else:
str = re.sub ("^turn on (checking|warnings) (on|for) ", "", switch[1].strip())
str = str[0].upper()+str[1:]
str = re.sub ("[.] *$", "", str)
- return 'label="%s"' % (str)
+ return 'label="%s"' % escape(str)
def tip (prefix, switch):
+ import gnat_switches
if gnat_switches.switches_comments.has_key (prefix+switch[0]):
- return """%s""" % (gnat_switches.switches_comments[prefix+switch[0]][1].strip())
+ tip_xml = """%s""" % (gnat_switches.switches_comments[prefix+switch[0]][1].strip())
else:
- return """%s""" % switch[1].strip()
+ tip_xml = """%s""" % switch[1].strip()
+ return escape(tip_xml)
class gnatMakeProc:
"""This class controls the gnatmake execution"""
@@ -164,12 +167,13 @@
return
# gnat check command changed: we reinitialize the rules list
if prev_cmd != self.gnatCmd:
+ xml_fmt = """%s"""
try:
xmlCompiler = self.getXmlForCompiler()
- except:
- print "Exception thrown in ada_support.py"
+ except Exception, err:
+ print "Exception thrown in ada_support.py", err
xmlCompiler = xmlCompilerHead+xmlCompilerDefault+xmlCompilerTrailer
- GPS.parse_xml (""""""+xmlCompiler+"")
+ GPS.parse_xml (xml_fmt % xmlCompiler)
def add_switch (self, process, matched, unmatched):
if unmatched == "\n":