title: How to implement C++0x raw string literal?
body: <p>How to define a working set of lexer and parser (<em>exempli gratia:</em> flex and bison) to support the C++0x styled raw string literals?  </p>
  
  <p>As you may already know, new string literals in C++0x can be expressed in a very flexible way.  </p>
  
  <p><code>R"&lt;delim&gt;...&lt;delim&gt;";</code> - in this code the <code>&lt;delim&gt;</code> can be pretty much everything and also no escape characters are needed.  </p>
  
  <p>Any kind of parentheses can be used to delimit the end of string:  </p>
  
  <p><code>R"(I love those who yearn for the impossible. (Von Goethe, "Faust"))";</code>  </p>
  
  <p>Blocks of text can be simply defined using equal occurrences of same characters:</p>
  
  <pre><code>R";***************************(
    ; TINY BASIC FOR INTEL 8080  
    ;       VERSION 2.0  
    ;     BY LI-CHEN WANG  
    ; MODIFIED AND TRANSLATED  
    ;    TO INTEL MNEMONICS  
    ;     BY ROGER RAUSKOLB  
    ;     10 OCTOBER, 1976  
    ;       @COPYLEFT  
    ;  ALL WRONGS RESERVED      )
    ;***************************";
  </code></pre>
  
  <p><em>More information can be found <a href="http://en.wikipedia.org/wiki/C++0x#New_string_literals" rel="nofollow noreferrer">here</a>(wikipedia) and <a href="http://www2.research.att.com/~bs/C++0xFAQ.html#raw-strings" rel="nofollow noreferrer">here</a>(att).</em> </p>
  
  <p>I would like to use this fantastic feature in a language I am developing now.  </p>
  
  <p>So, how can I define a proper tokenizer and syntax analyzer to achive the result?</p>
  
  <p>Thanks in advance for your answers!</p>