6.16.6. c++ Tangler

The c++ tangler is the same as the c tangler except it writes c++ style comments and is associated with a corresponding c++ comment tangler.
Start python section to interscript/tanglers/cpp.py[1 /3 ] Next Last
     1: #line 305 "tanglers.ipk"
     2: #---------------------------------------------------------
     3: # c++ tangler: write to a file, insert source line numbers
     4: # using '#line' pre-processor directives
     5: from interscript.tanglers.base import tangler_base
     6: import re
     7: 
     8: class cpp_tangler(tangler_base):
     9:   def __init__(self,sink,weaver):
    10:     tangler_base.__init__(self,sink,weaver)
    11:     self.matchid = re.compile('^[^A-Za-z_]*([A-Za-z_][A-Za-z_0-9]*)(.*)$')
    12:     self.language = 'C++'
    13: 
    14:   def write_comment(self,line):
    15:     self._writeline('// '+line)
    16: 
    17:   def start_section(self, file, count):
    18:     data = '#line '+str(count)+' '+'"'+file+'"'
    19:     self._writeline(data)
    20:     if self.weaver:
    21:       self.weaver.echotangle(self.sink.lines_written,data)
    22: 
    23:   def get_comment_tangler(self):
    24:     return cpp_comment_tangler(self.sink, weaver)
    25: 
    26:   def get_string_tangler(self,eol,width):
    27:     return c_string_tangler(self.sink,self.weaver,eol,width)
    28: 
    29: 
End python section to interscript/tanglers/cpp.py[1]


6.16.6.1. Hash Tangler
6.16.6.2. c++ comment tangler