<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Hi Yossi,</div><div><br></div><div>On Dec 12, 2012, at 11:49 PM, Yossi Kantor <<a href="mailto:yossi.kantor@samsung.com">yossi.kantor@samsung.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    I'm developing an IDE which uses clang API (clang-c/Index.h).
    Eventually I intend to implement<br>
    Syntax highlighting, indentation, diagnostics and code completion.
    So clang is just perfect.<br>
    <br>
    My 2 questions are :<br>
    <br>
    Its seems that in the API, the only option is 
    clang_parseTranslationUnit/clang_<b>re</b>parseTranslationUnit.<br>
    The thing is, that those functions receive as a parameter either a
    file name on a disk or a file name<br>
    in memory in a form of const char* pointer and length. The open file
    in my IDE is not stored in that<br>
    straightforward way in the memory (or I guess any other text editor)
    so is there a way to feed the parser from a byte stream of any sort?<br></div></blockquote><div><br></div><div>Not sure what you mean, you'd like to supply a buffer with any text encoding ?</div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    The second question is: Currently I try to implement syntax
    highlighting, which means that <br>
    for every press of a key (pretty much) in the editor I need to re
    parse and tokenize the entire file, so that I'll get the updated
    information on how and what to highlight. While clang performs those
    action <br>
    quite fast, and for diagnostics and code completion this totally
    acceptable, I do feel that its a bit of an overkill for syntax
    lighting where simple (and maybe partial or incremental) tokinizing
    of an input<br>
    buffer would be sufficient.</div></blockquote><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">Is there something I'm missing? Are t there are other clang methods
    that I can use ?<br></div></blockquote><div><br></div>Reparsing is currently a requirement; for tokenizing you can specify a source range as well.<br><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Thank you very much,<br>
    Yossi.<br>
    <br>
  </div>

_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>