青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆-341  評(píng)論-2670  文章-0  trackbacks-0
    在詞法分析器生成器寫完之后,就要做語(yǔ)法分析器的生成器了。今天完成了生成器的第一個(gè)版本。這個(gè)語(yǔ)法分析器生成器所做的事情就是從一個(gè)C#寫的文法產(chǎn)生出C#寫的該文法對(duì)應(yīng)的語(yǔ)法分析器。在寫文法的時(shí)候你需要提供每一個(gè)文法的返回類型,以及指定每一個(gè)屬性究竟對(duì)應(yīng)著文法的哪一段。為了方便,我提供了預(yù)定義的列表文法和左遞歸文法。當(dāng)然我們知道手寫遞歸下降分析器都是有套路的,用人寫的話只會(huì)浪費(fèi)人類的時(shí)間。文法的寫法跟之前Vczh Library++ 3.0Parser Combinator比較類似,現(xiàn)在讓我們看一下C#是如何表達(dá)文法的。這篇文章的所有相關(guān)代碼(語(yǔ)法樹、文法、生成的分析器代碼以及生成器的代碼)都可以在Vczh Library++ 3.0下面找到。過(guò)幾天再更加嚴(yán)格的測(cè)試幾次之后,就可以開始給NativeX寫語(yǔ)法分析器了。一旦完成了之后,就可以寫一個(gè)簡(jiǎn)單的類型推到程序,這樣就可以在輸入"."和"->"之后產(chǎn)生自動(dòng)下拉列表啦。

    為了測(cè)試語(yǔ)法分析器生成器,我給我的測(cè)試程序?qū)懥艘粋€(gè)帶函數(shù)的四則運(yùn)算式子的文法。這個(gè)東西的文法應(yīng)該是老掉牙的了,不用想都能寫出來(lái):
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using CodeBoxControl.CodeProvider.ParserCodeGenerator;
 6 using CodeBoxControlTest.CodeParser;
 7 
 8 namespace ParserBuilder
 9 {
10     class CodeParserTestParserBuilder : Parser
11     {
12         public static string Build()
13         {
14             var ID = id("CodeBoxControlTest.CodeParser.CodeParserTokenizer.IdToken");
15             var Number = id("CodeBoxControlTest.CodeParser.CodeParserTokenizer.NumberToken");
16             var FUNCTION = rule<FunctionExpression>("Function");
17             var NUMBER = rule<NumberExpression>("Number");
18             var BRACKET = rule<Expression>("Bracket");
19             var FACTOR = rule<Expression>("Factor");
20             var TERM = rule<Expression>("Term");
21             var EXPRESSION = rule<Expression>("Expression");
22 
23             FUNCTION.Infer(
24               ID["Name"+ tok("("+ list<Expression>(tok(","), EXPRESSION)["Parameters"+ tok(")")
25             );
26 
27             NUMBER.Infer(
28               Number["Number"]
29             );
30 
31             BRACKET.Infer(
32               tok("("+ ret(EXPRESSION) + tok(")")
33             );
34 
35             FACTOR.Infer(
36               ret(NUMBER) | ret(FUNCTION) | ret(BRACKET)
37             );
38 
39             TERM.Infer(
40               ret(leftrec<BinaryExpression>(FACTOR["Left"], (tok("*")["Operator"| tok("/")["Operator"]) + FACTOR["Right"]))
41             );
42 
43             EXPRESSION.Infer(
44               ret(leftrec<BinaryExpression>(TERM["Left"], (tok("+")["Operator"| tok("-")["Operator"]) + TERM["Right"]))
45             );
46 
47             return ParserGenerator.GenerateCSharpCode(EXPRESSION, "CodeBoxControlTest.CodeParser""CodeParserAnalyzer");
48         }
49     }
50 }
51 

    在這里解釋兩條文法。首先是FUNCTION,F(xiàn)UNCTION由函數(shù)名和參數(shù)表格構(gòu)成。函數(shù)名指定給了Name屬性,而參數(shù)表則指定給了Parameters屬性。這里我們可以看到list函數(shù)需要指定元素的類型以及元素與元素之間的分隔符。當(dāng)然分隔符也可以是一條復(fù)雜的文法。其次是TERM。這是一個(gè)左遞歸的寫法。首先leftrec<T>(a, b)的返回類型是a的類型,而T則指的是當(dāng)需要左遞歸的時(shí)候元素的實(shí)際類型,并且a和b所標(biāo)注的屬性名都是T的屬性。

    因此下面給出語(yǔ)法樹的聲明:
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using CodeBoxControl.CodeProvider;
 6 
 7 namespace CodeBoxControlTest.CodeParser
 8 {
 9     public abstract class Expression : CodeNode
10     {
11     }
12 
13     public abstract class NumberExpression : Expression
14     {
15         public double Number { getset; }
16     }
17 
18     public abstract class BinaryExpression : Expression
19     {
20         public abstract Expression Left { getset; }
21         public abstract Expression Right { getset; }
22         public string Operator { getset; }
23     }
24 
25     public abstract class FunctionExpression : Expression
26     {
27         public string Name { getset; }
28         public abstract CodeNodeList<Expression> Parameters { getset; }
29     }
30 }
31 

    還是比較短的哈。有了list和leftrec之后就充分解決了復(fù)雜文法的通用模式,因此就產(chǎn)生了下面這個(gè)很齷齪的、有很多廢話的代碼:
  1 using System;
  2 using System.Collections.Generic;
  3 using System.Linq;
  4 using System.Text;
  5 using CodeBoxControl.CodeProvider;
  6 
  7 namespace CodeBoxControlTest.CodeParser
  8 {
  9     public static class CodeParserAnalyzer
 10     {
 11         public static CodeBoxControlTest.CodeParser.Expression ParseExpression(List<CodeToken> tokens, ref int currentToken, ref bool parseSuccess)
 12         {
 13             CodeBoxControlTest.CodeParser.Expression result = default(CodeBoxControlTest.CodeParser.Expression);
 14             {
 15                 CodeBoxControlTest.CodeParser.Expression result1 = default(CodeBoxControlTest.CodeParser.Expression);
 16                 int currentIndex1 = currentToken;
 17                 {
 18                     {
 19                         int currentIndex2 = currentIndex1;
 20                         {
 21                             parseSuccess = false;
 22                             result1 = ParseTerm(tokens, ref currentIndex2, ref parseSuccess);
 23                         }
 24                         if (parseSuccess)
 25                         {
 26                             currentIndex1 = currentIndex2;
 27                         }
 28                         else
 29                         {
 30                             goto LABEL_0;
 31                         }
 32                         while (true)
 33                         {
 34                             System.String OperatorMember2 = default(System.String);
 35                             CodeBoxControlTest.CodeParser.Expression RightMember2 = default(CodeBoxControlTest.CodeParser.Expression);
 36                             {
 37                                 System.String OperatorMember3 = default(System.String);
 38                                 CodeBoxControlTest.CodeParser.Expression RightMember3 = default(CodeBoxControlTest.CodeParser.Expression);
 39                                 {
 40                                     int currentIndexCopy4 = currentIndex2;
 41                                     int currentIndex4 = currentIndex2;
 42                                     {
 43                                         System.String OperatorMember4 = default(System.String);
 44                                         {
 45                                             int currentIndex5 = -1;
 46                                             currentIndex5 = currentIndex4;
 47                                             {
 48                                                 System.String OperatorMember5 = default(System.String);
 49                                                 {
 50                                                     CodeBoxControl.CodeProvider.CodeToken result6 = default(CodeBoxControl.CodeProvider.CodeToken);
 51                                                     int currentIndex6 = currentIndex5;
 52                                                     {
 53                                                         parseSuccess = false;
 54                                                         if (currentIndex6 < tokens.Count && tokens[currentIndex6].Value == "+")
 55                                                         {
 56                                                             result6 = tokens[currentIndex6];
 57                                                             currentIndex6++;
 58                                                             parseSuccess = true;
 59                                                         }
 60                                                     }
 61                                                     if (parseSuccess)
 62                                                     {
 63                                                         currentIndex5 = currentIndex6;
 64                                                         OperatorMember5 = result6.Value;
 65                                                     }
 66                                                 }
 67                                                 OperatorMember4 = OperatorMember5;
 68                                             }
 69                                             if (parseSuccess)
 70                                             {
 71                                                 currentIndex4 = currentIndex5;
 72                                                 goto LABEL_SUCCESS_2;
 73                                             }
 74                                             currentIndex5 = currentIndex4;
 75                                             {
 76                                                 System.String OperatorMember5 = default(System.String);
 77                                                 {
 78                                                     CodeBoxControl.CodeProvider.CodeToken result6 = default(CodeBoxControl.CodeProvider.CodeToken);
 79                                                     int currentIndex6 = currentIndex5;
 80                                                     {
 81                                                         parseSuccess = false;
 82                                                         if (currentIndex6 < tokens.Count && tokens[currentIndex6].Value == "-")
 83                                                         {
 84                                                             result6 = tokens[currentIndex6];
 85                                                             currentIndex6++;
 86                                                             parseSuccess = true;
 87                                                         }
 88                                                     }
 89                                                     if (parseSuccess)
 90                                                     {
 91                                                         currentIndex5 = currentIndex6;
 92                                                         OperatorMember5 = result6.Value;
 93                                                     }
 94                                                 }
 95                                                 OperatorMember4 = OperatorMember5;
 96                                             }
 97                                             if (parseSuccess)
 98                                             {
 99                                                 currentIndex4 = currentIndex5;
100                                                 goto LABEL_SUCCESS_2;
101                                             }
102                                             goto LABEL_FAIL_3;
103                                         LABEL_SUCCESS_2: ;
104                                         LABEL_FAIL_3: ;
105                                         }
106                                         OperatorMember3 = OperatorMember4;
107                                     }
108                                     if (parseSuccess)
109                                     {
110                                         currentIndexCopy4 = currentIndex4;
111                                     }
112                                     else
113                                     {
114                                         goto LABEL_1;
115                                     }
116                                     {
117                                         CodeBoxControlTest.CodeParser.Expression RightMember4 = default(CodeBoxControlTest.CodeParser.Expression);
118                                         {
119                                             CodeBoxControlTest.CodeParser.Expression result5 = default(CodeBoxControlTest.CodeParser.Expression);
120                                             int currentIndex5 = currentIndex4;
121                                             {
122                                                 parseSuccess = false;
123                                                 result5 = ParseTerm(tokens, ref currentIndex5, ref parseSuccess);
124                                             }
125                                             if (parseSuccess)
126                                             {
127                                                 currentIndex4 = currentIndex5;
128                                                 RightMember4 = result5;
129                                             }
130                                         }
131                                         RightMember3 = RightMember4;
132                                     }
133                                     if (parseSuccess)
134                                     {
135                                         currentIndexCopy4 = currentIndex4;
136                                     }
137                                     else
138                                     {
139                                         goto LABEL_1;
140                                     }
141                                     currentIndex2 = currentIndexCopy4;
142                                 LABEL_1: ;
143                                 }
144                                 OperatorMember2 = OperatorMember3;
145                                 RightMember2 = RightMember3;
146                             }
147                             if (parseSuccess)
148                             {
149                                 currentIndex1 = currentIndex2;
150                                 CodeBoxControlTest.CodeParser.BinaryExpression result2 = CodeNode.Create<CodeBoxControlTest.CodeParser.BinaryExpression>();
151                                 result2.Operator = OperatorMember2;
152                                 result2.Right = RightMember2;
153                                 result2.Left = result1;
154                                 result1 = result2;
155                             }
156                             else
157                             {
158                                 break;
159                             }
160                         }
161                         parseSuccess = true;
162                     LABEL_0: ;
163                     }
164                 }
165                 if (parseSuccess)
166                 {
167                     currentToken = currentIndex1;
168                     result = result1;
169                 }
170             }
171             if (result == null) result = CodeNode.Create<CodeBoxControlTest.CodeParser.Expression>();
172             return result;
173         }
174 
175         public static CodeBoxControlTest.CodeParser.Expression ParseTerm(List<CodeToken> tokens, ref int currentToken, ref bool parseSuccess)
176         {
177             CodeBoxControlTest.CodeParser.Expression result = default(CodeBoxControlTest.CodeParser.Expression);
178             {
179                 CodeBoxControlTest.CodeParser.Expression result1 = default(CodeBoxControlTest.CodeParser.Expression);
180                 int currentIndex1 = currentToken;
181                 {
182                     {
183                         int currentIndex2 = currentIndex1;
184                         {
185                             parseSuccess = false;
186                             result1 = ParseFactor(tokens, ref currentIndex2, ref parseSuccess);
187                         }
188                         if (parseSuccess)
189                         {
190                             currentIndex1 = currentIndex2;
191                         }
192                         else
193                         {
194                             goto LABEL_0;
195                         }
196                         while (true)
197                         {
198                             System.String OperatorMember2 = default(System.String);
199                             CodeBoxControlTest.CodeParser.Expression RightMember2 = default(CodeBoxControlTest.CodeParser.Expression);
200                             {
201                                 System.String OperatorMember3 = default(System.String);
202                                 CodeBoxControlTest.CodeParser.Expression RightMember3 = default(CodeBoxControlTest.CodeParser.Expression);
203                                 {
204                                     int currentIndexCopy4 = currentIndex2;
205                                     int currentIndex4 = currentIndex2;
206                                     {
207                                         System.String OperatorMember4 = default(System.String);
208                                         {
209                                             int currentIndex5 = -1;
210                                             currentIndex5 = currentIndex4;
211                                             {
212                                                 System.String OperatorMember5 = default(System.String);
213                                                 {
214                                                     CodeBoxControl.CodeProvider.CodeToken result6 = default(CodeBoxControl.CodeProvider.CodeToken);
215                                                     int currentIndex6 = currentIndex5;
216                                                     {
217                                                         parseSuccess = false;
218                                                         if (currentIndex6 < tokens.Count && tokens[currentIndex6].Value == "*")
219                                                         {
220                                                             result6 = tokens[currentIndex6];
221                                                             currentIndex6++;
222                                                             parseSuccess = true;
223                                                         }
224                                                     }
225                                                     if (parseSuccess)
226                                                     {
227                                                         currentIndex5 = currentIndex6;
228                                                         OperatorMember5 = result6.Value;
229                                                     }
230                                                 }
231                                                 OperatorMember4 = OperatorMember5;
232                                             }
233                                             if (parseSuccess)
234                                             {
235                                                 currentIndex4 = currentIndex5;
236                                                 goto LABEL_SUCCESS_2;
237                                             }
238                                             currentIndex5 = currentIndex4;
239                                             {
240                                                 System.String OperatorMember5 = default(System.String);
241                                                 {
242                                                     CodeBoxControl.CodeProvider.CodeToken result6 = default(CodeBoxControl.CodeProvider.CodeToken);
243                                                     int currentIndex6 = currentIndex5;
244                                                     {
245                                                         parseSuccess = false;
246                                                         if (currentIndex6 < tokens.Count && tokens[currentIndex6].Value == "/")
247                                                         {
248                                                             result6 = tokens[currentIndex6];
249                                                             currentIndex6++;
250                                                             parseSuccess = true;
251                                                         }
252                                                     }
253                                                     if (parseSuccess)
254                                                     {
255                                                         currentIndex5 = currentIndex6;
256                                                         OperatorMember5 = result6.Value;
257                                                     }
258                                                 }
259                                                 OperatorMember4 = OperatorMember5;
260                                             }
261                                             if (parseSuccess)
262                                             {
263                                                 currentIndex4 = currentIndex5;
264                                                 goto LABEL_SUCCESS_2;
265                                             }
266                                             goto LABEL_FAIL_3;
267                                         LABEL_SUCCESS_2: ;
268                                         LABEL_FAIL_3: ;
269                                         }
270                                         OperatorMember3 = OperatorMember4;
271                                     }
272                                     if (parseSuccess)
273                                     {
274                                         currentIndexCopy4 = currentIndex4;
275                                     }
276                                     else
277                                     {
278                                         goto LABEL_1;
279                                     }
280                                     {
281                                         CodeBoxControlTest.CodeParser.Expression RightMember4 = default(CodeBoxControlTest.CodeParser.Expression);
282                                         {
283                                             CodeBoxControlTest.CodeParser.Expression result5 = default(CodeBoxControlTest.CodeParser.Expression);
284                                             int currentIndex5 = currentIndex4;
285                                             {
286                                                 parseSuccess = false;
287                                                 result5 = ParseFactor(tokens, ref currentIndex5, ref parseSuccess);
288                                             }
289                                             if (parseSuccess)
290                                             {
291                                                 currentIndex4 = currentIndex5;
292                                                 RightMember4 = result5;
293                                             }
294                                         }
295                                         RightMember3 = RightMember4;
296                                     }
297                                     if (parseSuccess)
298                                     {
299                                         currentIndexCopy4 = currentIndex4;
300                                     }
301                                     else
302                                     {
303                                         goto LABEL_1;
304                                     }
305                                     currentIndex2 = currentIndexCopy4;
306                                 LABEL_1: ;
307                                 }
308                                 OperatorMember2 = OperatorMember3;
309                                 RightMember2 = RightMember3;
310                             }
311                             if (parseSuccess)
312                             {
313                                 currentIndex1 = currentIndex2;
314                                 CodeBoxControlTest.CodeParser.BinaryExpression result2 = CodeNode.Create<CodeBoxControlTest.CodeParser.BinaryExpression>();
315                                 result2.Operator = OperatorMember2;
316                                 result2.Right = RightMember2;
317                                 result2.Left = result1;
318                                 result1 = result2;
319                             }
320                             else
321                             {
322                                 break;
323                             }
324                         }
325                         parseSuccess = true;
326                     LABEL_0: ;
327                     }
328                 }
329                 if (parseSuccess)
330                 {
331                     currentToken = currentIndex1;
332                     result = result1;
333                 }
334             }
335             if (result == null) result = CodeNode.Create<CodeBoxControlTest.CodeParser.Expression>();
336             return result;
337         }
338 
339         public static CodeBoxControlTest.CodeParser.Expression ParseFactor(List<CodeToken> tokens, ref int currentToken, ref bool parseSuccess)
340         {
341             CodeBoxControlTest.CodeParser.Expression result = default(CodeBoxControlTest.CodeParser.Expression);
342             {
343                 CodeBoxControlTest.CodeParser.Expression result1 = default(CodeBoxControlTest.CodeParser.Expression);
344                 int currentIndex1 = -1;
345                 currentIndex1 = currentToken;
346                 {
347                     {
348                         CodeBoxControlTest.CodeParser.NumberExpression result2 = default(CodeBoxControlTest.CodeParser.NumberExpression);
349                         int currentIndex2 = currentIndex1;
350                         {
351                             parseSuccess = false;
352                             result2 = ParseNumber(tokens, ref currentIndex2, ref parseSuccess);
353                         }
354                         if (parseSuccess)
355                         {
356                             currentIndex1 = currentIndex2;
357                             result1 = result2;
358                         }
359                     }
360                 }
361                 if (parseSuccess)
362                 {
363                     currentToken = currentIndex1;
364                     goto LABEL_SUCCESS_0;
365                 }
366                 currentIndex1 = currentToken;
367                 {
368                     {
369                         CodeBoxControlTest.CodeParser.FunctionExpression result2 = default(CodeBoxControlTest.CodeParser.FunctionExpression);
370                         int currentIndex2 = currentIndex1;
371                         {
372                             parseSuccess = false;
373                             result2 = ParseFunction(tokens, ref currentIndex2, ref parseSuccess);
374                         }
375                         if (parseSuccess)
376                         {
377                             currentIndex1 = currentIndex2;
378                             result1 = result2;
379                         }
380                     }
381                 }
382                 if (parseSuccess)
383                 {
384                     currentToken = currentIndex1;
385                     goto LABEL_SUCCESS_0;
386                 }
387                 currentIndex1 = currentToken;
388                 {
389                     {
390                         CodeBoxControlTest.CodeParser.Expression result2 = default(CodeBoxControlTest.CodeParser.Expression);
391                         int currentIndex2 = currentIndex1;
392                         {
393                             parseSuccess = false;
394                             result2 = ParseBracket(tokens, ref currentIndex2, ref parseSuccess);
395                         }
396                         if (parseSuccess)
397                         {
398                             currentIndex1 = currentIndex2;
399                             result1 = result2;
400                         }
401                     }
402                 }
403                 if (parseSuccess)
404                 {
405                     currentToken = currentIndex1;
406                     goto LABEL_SUCCESS_0;
407                 }
408                 goto LABEL_FAIL_1;
409             LABEL_SUCCESS_0: ;
410                 result = result1;
411             LABEL_FAIL_1: ;
412             }
413             if (result == null) result = CodeNode.Create<CodeBoxControlTest.CodeParser.Expression>();
414             return result;
415         }
416 
417         public static CodeBoxControlTest.CodeParser.NumberExpression ParseNumber(List<CodeToken> tokens, ref int currentToken, ref bool parseSuccess)
418         {
419             CodeBoxControlTest.CodeParser.NumberExpression result = default(CodeBoxControlTest.CodeParser.NumberExpression);
420             System.Double NumberMember0 = default(System.Double);
421             {
422                 CodeBoxControl.CodeProvider.CodeToken result1 = default(CodeBoxControl.CodeProvider.CodeToken);
423                 int currentIndex1 = currentToken;
424                 {
425                     parseSuccess = false;
426                     if (currentIndex1 < tokens.Count && tokens[currentIndex1].Id == CodeBoxControlTest.CodeParser.CodeParserTokenizer.NumberToken)
427                     {
428                         result1 = tokens[currentIndex1];
429                         currentIndex1++;
430                         parseSuccess = true;
431                     }
432                 }
433                 if (parseSuccess)
434                 {
435                     currentToken = currentIndex1;
436                     NumberMember0 = System.Double.Parse(result1.Value);
437                 }
438             }
439             if (result == null) result = CodeNode.Create<CodeBoxControlTest.CodeParser.NumberExpression>();
440             result.Number = NumberMember0;
441             return result;
442         }
443 
444         public static CodeBoxControlTest.CodeParser.FunctionExpression ParseFunction(List<CodeToken> tokens, ref int currentToken, ref bool parseSuccess)
445         {
446             CodeBoxControlTest.CodeParser.FunctionExpression result = default(CodeBoxControlTest.CodeParser.FunctionExpression);
447             System.String NameMember0 = default(System.String);
448             CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression> ParametersMember0 = default(CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression>);
449             {
450                 int currentIndexCopy1 = currentToken;
451                 int currentIndex1 = currentToken;
452                 {
453                     System.String NameMember1 = default(System.String);
454                     {
455                         CodeBoxControl.CodeProvider.CodeToken result2 = default(CodeBoxControl.CodeProvider.CodeToken);
456                         int currentIndex2 = currentIndex1;
457                         {
458                             parseSuccess = false;
459                             if (currentIndex2 < tokens.Count && tokens[currentIndex2].Id == CodeBoxControlTest.CodeParser.CodeParserTokenizer.IdToken)
460                             {
461                                 result2 = tokens[currentIndex2];
462                                 currentIndex2++;
463                                 parseSuccess = true;
464                             }
465                         }
466                         if (parseSuccess)
467                         {
468                             currentIndex1 = currentIndex2;
469                             NameMember1 = result2.Value;
470                         }
471                     }
472                     NameMember0 = NameMember1;
473                 }
474                 if (parseSuccess)
475                 {
476                     currentIndexCopy1 = currentIndex1;
477                 }
478                 else
479                 {
480                     goto LABEL_0;
481                 }
482                 {
483                     parseSuccess = false;
484                     if (currentIndex1 < tokens.Count && tokens[currentIndex1].Value == "(")
485                     {
486                         currentIndex1++;
487                         parseSuccess = true;
488                     }
489                 }
490                 if (parseSuccess)
491                 {
492                     currentIndexCopy1 = currentIndex1;
493                 }
494                 else
495                 {
496                     goto LABEL_0;
497                 }
498                 {
499                     CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression> ParametersMember1 = default(CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression>);
500                     {
501                         CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression> result2 = default(CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression>);
502                         int currentIndex2 = currentIndex1;
503                         {
504                             result2 = new CodeBoxControl.CodeProvider.CodeNodeList<CodeBoxControlTest.CodeParser.Expression>();
505                             {
506                                 CodeBoxControlTest.CodeParser.Expression result3 = default(CodeBoxControlTest.CodeParser.Expression);
507                                 int currentIndex3 = currentIndex2;
508                                 {
509                                     parseSuccess = false;
510                                     result3 = ParseExpression(tokens, ref currentIndex3, ref parseSuccess);
511                                 }
512                                 if (parseSuccess)
513                                 {
514                                     currentIndex2 = currentIndex3;
515                                     result2.Add(result3);
516                                 }
517                                 while (true)
518                                 {
519                                     int currentIndexCopy3 = currentIndex2;
520                                     {
521                                         parseSuccess = false;
522                                         if (currentIndex3 < tokens.Count && tokens[currentIndex3].Value == ",")
523                                         {
524                                             currentIndex3++;
525                                             parseSuccess = true;
526                                         }
527                                     }
528                                     if (parseSuccess)
529                                     {
530                                         currentIndexCopy3 = currentIndex3;
531                                     }
532                                     else
533                                     {
534                                         goto LABEL_1;
535                                     }
536                                     {
537                                         parseSuccess = false;
538                                         result3 = ParseExpression(tokens, ref currentIndex3, ref parseSuccess);
539                                     }
540                                     if (parseSuccess)
541                                     {
542                                         currentIndexCopy3 = currentIndex3;
543                                     }
544                                     else
545                                     {
546                                         goto LABEL_1;
547                                     }
548                                     currentIndex2 = currentIndexCopy3;
549                                     result2.Add(result3);
550                                 }
551                             LABEL_1: ; parseSuccess = true;
552                             }
553                         }
554                         if (parseSuccess)
555                         {
556                             currentIndex1 = currentIndex2;
557                             ParametersMember1 = result2;
558                         }
559                     }
560                     ParametersMember0 = ParametersMember1;
561                 }
562                 if (parseSuccess)
563                 {
564                     currentIndexCopy1 = currentIndex1;
565                 }
566                 else
567                 {
568                     goto LABEL_0;
569                 }
570                 {
571                     parseSuccess = false;
572                     if (currentIndex1 < tokens.Count && tokens[currentIndex1].Value == ")")
573                     {
574                         currentIndex1++;
575                         parseSuccess = true;
576                     }
577                 }
578                 if (parseSuccess)
579                 {
580                     currentIndexCopy1 = currentIndex1;
581                 }
582                 else
583                 {
584                     goto LABEL_0;
585                 }
586                 currentToken = currentIndexCopy1;
587             LABEL_0: ;
588             }
589             if (result == null) result = CodeNode.Create<CodeBoxControlTest.CodeParser.FunctionExpression>();
590             result.Name = NameMember0;
591             result.Parameters = ParametersMember0;
592             return result;
593         }
594 
595         public static CodeBoxControlTest.CodeParser.Expression ParseBracket(List<CodeToken> tokens, ref int currentToken, ref bool parseSuccess)
596         {
597             CodeBoxControlTest.CodeParser.Expression result = default(CodeBoxControlTest.CodeParser.Expression);
598             {
599                 CodeBoxControlTest.CodeParser.Expression result1 = default(CodeBoxControlTest.CodeParser.Expression);
600                 int currentIndexCopy1 = currentToken;
601                 int currentIndex1 = currentToken;
602                 {
603                     parseSuccess = false;
604                     if (currentIndex1 < tokens.Count && tokens[currentIndex1].Value == "(")
605                     {
606                         currentIndex1++;
607                         parseSuccess = true;
608                     }
609                 }
610                 if (parseSuccess)
611                 {
612                     currentIndexCopy1 = currentIndex1;
613                 }
614                 else
615                 {
616                     goto LABEL_0;
617                 }
618                 {
619                     {
620                         CodeBoxControlTest.CodeParser.Expression result2 = default(CodeBoxControlTest.CodeParser.Expression);
621                         int currentIndex2 = currentIndex1;
622                         {
623                             parseSuccess = false;
624                             result2 = ParseExpression(tokens, ref currentIndex2, ref parseSuccess);
625                         }
626                         if (parseSuccess)
627                         {
628                             currentIndex1 = currentIndex2;
629                             result1 = result2;
630                         }
631                     }
632                 }
633                 if (parseSuccess)
634                 {
635                     currentIndexCopy1 = currentIndex1;
636                 }
637                 else
638                 {
639                     goto LABEL_0;
640                 }
641                 {
642                     parseSuccess = false;
643                     if (currentIndex1 < tokens.Count && tokens[currentIndex1].Value == ")")
644                     {
645                         currentIndex1++;
646                         parseSuccess = true;
647                     }
648                 }
649                 if (parseSuccess)
650                 {
651                     currentIndexCopy1 = currentIndex1;
652                 }
653                 else
654                 {
655                     goto LABEL_0;
656                 }
657                 currentToken = currentIndexCopy1;
658                 result = result1;
659             LABEL_0: ;
660             }
661             if (result == null) result = CodeNode.Create<CodeBoxControlTest.CodeParser.Expression>();
662             return result;
663         }
664 
665     }
666 }
667 

    果然自動(dòng)生成的代碼都是很不能看的呢……
posted on 2010-10-17 01:51 陳梓瀚(vczh) 閱讀(5595) 評(píng)論(4)  編輯 收藏 引用 所屬分類: 開發(fā)自己的IDE

評(píng)論:
# re: 開發(fā)自己的IDE(七) 2010-10-17 05:23 | mm
好強(qiáng)大!!!  回復(fù)  更多評(píng)論
  
# re: 開發(fā)自己的IDE(七)[未登錄](méi) 2010-10-17 17:57 | dd
太長(zhǎng)的生成的代碼,就折疊了不要展開了吧?  回復(fù)  更多評(píng)論
  
# re: 開發(fā)自己的IDE(七) 2010-10-17 18:20 | 陳梓瀚(vczh)
@dd
反正鼠標(biāo)有滾輪,就麻煩自己滾一下哈。  回復(fù)  更多評(píng)論
  
# re: 開發(fā)自己的IDE(七)[未登錄](méi) 2010-10-17 18:47 | ccsdu2009
人才 贊就一個(gè)字  回復(fù)  更多評(píng)論
  
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲欧美另类在线观看| 欧美午夜片在线观看| 日韩小视频在线观看专区| 亚洲欧洲一二三| 欧美日韩国产综合久久| 亚洲一区中文| 午夜视频在线观看一区| 韩国三级电影久久久久久| 欧美大胆人体视频| 欧美人成网站| 性欧美大战久久久久久久免费观看 | 久久国产视频网| 久久久免费观看视频| 亚洲毛片av在线| 亚洲一区二区动漫| 国内视频一区| 亚洲高清在线观看| 国产精品h在线观看| 久久久久国产一区二区三区| 麻豆国产精品一区二区三区| 亚洲神马久久| 欧美中文字幕视频| 亚洲免费av电影| 亚洲欧美国产毛片在线| 亚洲高清在线观看| 一区二区欧美精品| 加勒比av一区二区| 日韩视频免费观看| 国产一区二区三区久久精品| 亚洲黄色三级| 国产日韩欧美在线观看| 亚洲国产精品第一区二区| 国产精品嫩草99av在线| 欧美大片一区二区三区| 国产精品黄页免费高清在线观看| 鲁大师影院一区二区三区| 欧美日韩精品系列| 久久人人精品| 欧美三级视频在线播放| 麻豆国产精品一区二区三区| 欧美体内she精视频| 另类av一区二区| 欧美视频网址| 欧美电影美腿模特1979在线看| 国产精品jvid在线观看蜜臀 | 欧美精品在线观看一区二区| 欧美主播一区二区三区美女 久久精品人| 老司机成人在线视频| 香蕉久久夜色精品国产使用方法| 麻豆成人综合网| 欧美在线视频观看免费网站| 欧美激情成人在线视频| 久久精品视频一| 欧美日韩在线免费| 欧美成人69| 国产日本欧美一区二区三区| 亚洲精品国产品国语在线app| 激情一区二区三区| 亚洲一区二区三区激情| 99精品国产99久久久久久福利| 久久国产精品久久w女人spa| 亚洲一区欧美二区| 欧美激情亚洲| 美女诱惑一区| 国产色综合天天综合网| 一本一道久久综合狠狠老精东影业| 亚洲国产欧美日韩另类综合| 性欧美videos另类喷潮| 亚洲一区图片| 欧美精品国产精品| 欧美大色视频| 狠狠色综合日日| 亚洲男人的天堂在线观看| 一区二区三区国产精华| 免费成年人欧美视频| 久久久亚洲欧洲日产国码αv| 国产精品捆绑调教| 日韩一级在线观看| 亚洲免费观看高清在线观看| 久久在线免费| 六月丁香综合| 国产在线不卡视频| 亚洲午夜未删减在线观看| 日韩视频免费| 欧美xxx在线观看| 欧美成ee人免费视频| 好看的日韩av电影| 欧美亚洲综合在线| 久久9热精品视频| 国产精品一二三四| 亚洲一二三区视频在线观看| 亚洲一区免费在线观看| 欧美日韩免费视频| 亚洲毛片一区| 一区二区三区国产在线观看| 欧美激情第一页xxx| 亚洲高清av在线| 亚洲欧洲精品一区| 美女久久一区| 欧美风情在线观看| 在线视频国内自拍亚洲视频| 久久久久久久久综合| 久久最新视频| 一区二区三区在线不卡| 久久久精品一区| 麻豆精品网站| 亚洲电影成人| 免费影视亚洲| 亚洲国产一区二区精品专区| 亚洲免费高清| 欧美日本免费| 99在线精品免费视频九九视| 亚洲一区二区三区激情| 国产精品国产三级国产| 亚洲一本视频| 久久国产一区二区三区| 韩国一区二区在线观看| 久久久久久久一区二区| 欧美mv日韩mv国产网站app| 亚洲国产天堂网精品网站| 欧美高清视频一二三区| 日韩亚洲精品电影| 亚洲欧美中文另类| 国产亚洲二区| 久久女同互慰一区二区三区| 亚洲第一精品在线| 一区二区国产精品| 国产精品红桃| 久久www成人_看片免费不卡| 蜜臀久久久99精品久久久久久| 亚洲人成亚洲人成在线观看图片 | 国产精品久久久久久久久久直播 | 亚洲精品久久久久久下一站| 国产精品99久久99久久久二8| 国产精品久久久久av免费| 午夜视频久久久| 欧美fxxxxxx另类| 99精品99| 国产精品亚洲综合色区韩国| 久久电影一区| 亚洲国产高清一区二区三区| 亚洲视频在线观看视频| 国产欧美日韩高清| 免费成人你懂的| 一本到12不卡视频在线dvd| 欧美一级夜夜爽| 亚洲福利视频二区| 欧美日韩四区| 欧美亚洲在线观看| 亚洲国产综合在线看不卡| 亚洲综合首页| 国外成人在线| 欧美日韩国产亚洲一区| 亚洲欧美日韩国产中文| 欧美1区2区3区| 国产精品99久久久久久www| 国产一区二区三区精品久久久| 男人插女人欧美| 亚洲影视中文字幕| 欧美成人一区二区三区在线观看| 国产精品99久久99久久久二8| 国产午夜亚洲精品羞羞网站| 欧美黑人在线观看| 亚洲欧美综合v| 亚洲国产精品99久久久久久久久| 亚洲欧美在线一区| 亚洲国语精品自产拍在线观看| 国产精品国产福利国产秒拍| 久久久噜噜噜久久久| 一区二区三区欧美激情| 免费在线观看一区二区| 亚洲一区高清| 亚洲第一网站免费视频| 国产精品久久久久久久久果冻传媒| 久久久久一本一区二区青青蜜月| 99国产精品99久久久久久| 久久综合伊人77777尤物| 在线亚洲欧美| 亚洲二区在线观看| 国产麻豆午夜三级精品| 欧美久久久久中文字幕| 久久久久免费| 亚洲女ⅴideoshd黑人| 亚洲欧洲日本在线| 久热精品视频在线免费观看| 午夜精彩视频在线观看不卡| 亚洲精品偷拍| 狠狠爱综合网| 国产精品伦一区| 欧美精品色网| 毛片一区二区三区| 欧美一区=区| 亚洲四色影视在线观看| 亚洲国产合集| 开心色5月久久精品| 午夜精品久久久久久久久| 99精品国产99久久久久久福利| 一区二区在线视频| 国产日韩欧美一区在线 | 久久久久久久网|