/parsing/d/pragmastmtunit.d
D | 72 lines | 45 code | 15 blank | 12 comment | 12 complexity | 289f0ceba3cb9a18e3ed21dca133165e MD5 | raw file
1/* 2 * expressionunit.d 3 * 4 * This module parses expressions. 5 * 6 */ 7 8module parsing.d.pragmastmtunit; 9 10import parsing.parseunit; 11import parsing.token; 12 13import parsing.d.tokens; 14import parsing.d.nodes; 15import parsing.d.statementunit; 16 17import io.console; 18 19import djehuty; 20 21class PragmaStmtUnit : ParseUnit { 22 override bool tokenFound(Token current) { 23 switch (current.type) { 24 case DToken.LeftParen: 25 if(this.state >= 1){ 26 //XXX: Error 27 } 28 29 this.state = 1; 30 break; 31 case DToken.Identifier: 32 if(this.state != 1){ 33 //XXX: Error 34 } 35 36 cur_string = current.value.toString(); 37 Console.putln("Pragma: ", current.value); 38 this.state = 2; 39 break; 40 case DToken.RightParen: 41 if(this.state != 2 && this.state != 3){ 42 //XXX: Error 43 } 44 45 if (this.state == 2) { 46 auto tree = expand!(StatementUnit)(); 47 } 48 49 // Done. 50 return false; 51 case DToken.Comma: 52 if(this.state != 2){ 53 //XXX: Error 54 } 55 56 this.state = 3; 57 58 //TODO: Argument List 59 60 break; 61 default: 62 break; 63 } 64 return true; 65 } 66 67protected: 68 string cur_string = ""; 69 70 static const string _common_error_msg = ""; 71 static const string[] _common_error_usages = null; 72}