⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cppdyer.cpp.htm

📁 这是一个很不错的词法语法分析器! 很适合计算机专业的大学生学习参考
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<HTML><BODY><FONT FACE="COURIER NEW">0000&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GRAY"><B>//&nbsp;CppDyer.cpp:&nbsp;implementation&nbsp;of&nbsp;the&nbsp;CppDyer&nbsp;class.</B></FONT><br>
0001&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GRAY"><B>//</B></FONT><br>
0002&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GRAY"><B>//////////////////////////////////////////////////////////////////////</B></FONT><br>
0003&nbsp;&nbsp;&nbsp;&nbsp;<br>
0004&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GREEN">#include&nbsp;&quot;stdafx.h&quot;</FONT><br>
0005&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GREEN">#include&nbsp;&lt;windows.h&gt;</FONT><br>
0006&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GREEN">#include&nbsp;&quot;CppDyer.h&quot;</FONT><br>
0007&nbsp;&nbsp;&nbsp;&nbsp;<br>
0008&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GRAY"><B>//////////////////////////////////////////////////////////////////////</B></FONT><br>
0009&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GRAY"><B>//&nbsp;Construction/Destruction</B></FONT><br>
0010&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="GRAY"><B>//////////////////////////////////////////////////////////////////////</B></FONT><br>
0011&nbsp;&nbsp;&nbsp;&nbsp;<br>
0012&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">static</FONT>&nbsp;<FONT COLOR="BLUE">const</FONT>&nbsp;<FONT COLOR="BLUE">int</FONT>&nbsp;<FONT COLOR="BLACK"><I>MAX_BUFFER_SIZE</I></FONT><FONT COLOR="BLUE"><B>=</B></FONT><FONT COLOR="RED"><I>32</I></FONT><FONT COLOR="BLUE"><B>*</B></FONT><FONT COLOR="RED"><I>1024</I></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0013&nbsp;&nbsp;&nbsp;&nbsp;<br>
0014&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">using</FONT>&nbsp;<FONT COLOR="BLUE">namespace</FONT>&nbsp;<FONT COLOR="BLACK"><I>std</I></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0015&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">using</FONT>&nbsp;<FONT COLOR="BLUE">namespace</FONT>&nbsp;<FONT COLOR="BLACK"><I>CppParser</I></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0016&nbsp;&nbsp;&nbsp;&nbsp;<br>
0017&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">void</FONT>&nbsp;<FONT COLOR="BLACK"><I>CppDyer</I></FONT><FONT COLOR="BLUE"><B>::</B></FONT><FONT COLOR="BLACK"><I>getBaseSettings</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE">string</FONT>&nbsp;<FONT COLOR="BLACK"><I>iniFileName</I></FONT><FONT COLOR="BLUE"><B>)</B></FONT><br>
0018&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>{</B></FONT><br>
0019&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">string</FONT>&nbsp;<FONT COLOR="BLACK"><I>tagNames</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>=</B></FONT><FONT COLOR="BLUE"><B>{</B></FONT><FONT COLOR="RED"><U>&quot;GLOBAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;PPKEYWORD&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;KEYWORD&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;IDENTIFIER&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;WHITESPACE&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;LINEFEED&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;DELIMITER&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;OPERATOR&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><br>
0020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="RED"><U>&quot;SINGLELINECOMMENT&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;STRINGLITERAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;CHARLITERAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;DECNUMBERLITERAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;HEXNUMBERLITERAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;OCTNUMBERLITERAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><br>
0021&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="RED"><U>&quot;FLOATNUMBERLITERAL&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;BLOCKCOMMENT&quot;</U></FONT><FONT COLOR="BLUE"><B>}</B></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0022&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">int</FONT>&nbsp;<FONT COLOR="BLACK"><I>tagIDs</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>=</B></FONT><FONT COLOR="BLUE"><B>{</B></FONT><FONT COLOR="BLACK"><I>INVALID</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>PPKEYWORD</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>KEYWORD</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>IDENTIFIER</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>WHITESPACE</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>LINEFEED</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>DELIMITER</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>OPERATOR</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><br>
0023&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLACK"><I>SINGLELINECOMMENT</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>STRINGLITERAL</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>CHARLITERAL</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>DECNUMBERLITERAL</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>HEXNUMBERLITERAL</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>OCTNUMBERLITERAL</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><br>
0024&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLACK"><I>FLOATNUMBERLITERAL</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>BLOCKCOMMENT</I></FONT><FONT COLOR="BLUE"><B>}</B></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0025&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">char</FONT>&nbsp;<FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>MAX_BUFFER_SIZE</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0026&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">for</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE">int</FONT>&nbsp;<FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>=</B></FONT><FONT COLOR="RED"><I>0</I></FONT><FONT COLOR="BLUE"><B>;</B></FONT><FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>&lt;</B></FONT><FONT COLOR="BLUE">sizeof</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>tagIDs</I></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>/</B></FONT><FONT COLOR="BLUE">sizeof</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE"><B>*</B></FONT><FONT COLOR="BLACK"><I>tagIDs</I></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>;</B></FONT><FONT COLOR="BLUE"><B>++</B></FONT><FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>)</B></FONT><br>
0027&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>{</B></FONT><br>
0028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">if</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>GetPrivateProfileString</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="RED"><U>&quot;settings&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>tagNames</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>+</B></FONT><FONT COLOR="RED"><U>&quot;_prefix&quot;</U></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>.</B></FONT><FONT COLOR="BLACK"><I>c_str</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>MAX_BUFFER_SIZE</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>iniFileName</I></FONT><FONT COLOR="BLUE"><B>.</B></FONT><FONT COLOR="BLACK"><I>c_str</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>!=</B></FONT><FONT COLOR="RED"><I>0</I></FONT><FONT COLOR="BLUE"><B>)</B></FONT><br>
0029&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>{</B></FONT><br>
0030&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">if</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="RED"><I>0</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><br>
0031&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>{</B></FONT><br>
0032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLACK"><I>mPrefix</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>tagIDs</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>=</B></FONT><FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0033&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>}</B></FONT><br>
0034&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>}</B></FONT><br>
0035&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">if</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>GetPrivateProfileString</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="RED"><U>&quot;settings&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>tagNames</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>+</B></FONT><FONT COLOR="RED"><U>&quot;_suffix&quot;</U></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>.</B></FONT><FONT COLOR="BLACK"><I>c_str</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="RED"><U>&quot;&quot;</U></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>MAX_BUFFER_SIZE</I></FONT><FONT COLOR="BLUE"><B>,</B></FONT><FONT COLOR="BLACK"><I>iniFileName</I></FONT><FONT COLOR="BLUE"><B>.</B></FONT><FONT COLOR="BLACK"><I>c_str</I></FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><FONT COLOR="BLUE"><B>!=</B></FONT><FONT COLOR="RED"><I>0</I></FONT><FONT COLOR="BLUE"><B>)</B></FONT><br>
0036&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>{</B></FONT><br>
0037&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE">if</FONT><FONT COLOR="BLUE"><B>(</B></FONT><FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="RED"><I>0</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>)</B></FONT><br>
0038&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>{</B></FONT><br>
0039&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLACK"><I>mSuffix</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>tagIDs</I></FONT><FONT COLOR="BLUE"><B>[</B></FONT><FONT COLOR="BLACK"><I>i</I></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>]</B></FONT><FONT COLOR="BLUE"><B>=</B></FONT><FONT COLOR="BLACK"><I>s</I></FONT><FONT COLOR="BLUE"><B>;</B></FONT><br>
0040&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>}</B></FONT><br>
0041&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="BLUE"><B>}</B></FONT><br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -