<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.E-mailStijl18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=NL link=blue vlink=purple style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for your quick response Snaroff.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I choose to change the function Lexer::LexNumericConstant and
generate my own kind of token if I find an s at the end of an
numerical_constant. <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Now I want to separate the number from the s.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Is there an easy way of getting the text of a token in the C
file? I searched for this a while ago too but couldn’t find it. I found
the SourceManager.GetCharacterData(Sourcelocation ) function, but this returns
me all characters starting from the Sourceloaction.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Is there a way to get a char * of text between 2 SourceLocations
?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for all the help,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Bas<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Van:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> steve naroff
[mailto:snaroff@apple.com] <br>
<b>Verzonden:</b> dinsdag 9 september 2008 15:02<br>
<b>Aan:</b> Burgers, B.J. (Bas, Student EMSYS)<br>
<b>CC:</b> cfe-dev@cs.uiuc.edu<br>
<b>Onderwerp:</b> Re: [cfe-dev] changing the lexer or parser<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Hi Bas,<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>clang currently implements C integer constants by including
the trailing suffix (see C99 6.4.4.1 for more details).<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>Sema::ActOnNumbericConstant() is then responsible for
determining the type of constant (integer, floating) and size.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>I haven't thought about adapting clang's lexer to generate
tokens that don't conform to C.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>That said, you could simply examine the "suffix"
by hand (without fiddling with the lexer directly).<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>snaroff<o:p></o:p></p>

</div>

<div>

<div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>On Sep 9, 2008, at 5:27 PM, <a
href="mailto:b.j.burgers@student.utwente.nl">b.j.burgers@student.utwente.nl</a>
wrote:<o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Hello,</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>I’m working on a tool that allows time construct in C. I
implemented this tool by adapting Clang.</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>In these time constructs I like to allow arguments like
“1000s”, “1000 s”, “1000  s”,
“100ms”, “100 ms”, etc.</span><span style='font-size:
11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>The lexer creates 1 token called numerical_token if the argument
is “1000s” even if ‘s’ is added as keyword or token in
TokenKinds.def. I hoped the lexer would have generated two tokens, 1
numerical_constant and an identifier (or self defined token).</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>What is the best way to allow these kind of arguments ? Do I have
to create a new token that allows some digits followed by an ‘s’?</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Thanks for any help,</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Bas Burgers</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

</div>

</body>

</html>