<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 19, 2016 at 10:49 PM, <a href="mailto:chenrui@sunwiseinfo.com">chenrui@sunwiseinfo.com</a> via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div><span></span>Hi,</div><div>I want the front end to ignore some dialect token, like the following example: </div><div><br></div><div>// interrupt and using is dialect extension syntax</div><div>void cint() interrupt 1 using 2</div><div>{</div><div> ...</div><div>}</div>
<div><br></div><div>Firstly, I will extend the TokenKind.def to make 'interrupt' and 'using' be the keyword;</div><div>After the preprocessor and lexer make the code to token stream, I want to do something to filter the dialect-related tokens so that the token stream passed to the parser is clang-compatible. I don't need to extend the AST. Ignoring the dialect extensions is fine to me.</div><div><br></div><div>So my question is , which part should I modify or extend to implement the above functionality?</div></div></blockquote><div><br></div><div>You should extend the parser to consume these tokens in whichever places in the grammar you wish to allow them. (If they can actually appear anywhere, you could adjust Preprocessor::Lex to discard the tokens, but that's unlikely to be the best approach.)</div></div></div></div>