/parsing/d/returnstmtunit.d
D | 51 lines | 28 code | 13 blank | 10 comment | 3 complexity | d5cd9fda7a0462c8d5c3abb36298eba9 MD5 | raw file
1/* 2 * expressionunit.d 3 * 4 * This module parses expressions. 5 * 6 */ 7 8module parsing.d.returnstmtunit; 9 10import parsing.parseunit; 11import parsing.token; 12 13import parsing.d.tokens; 14import parsing.d.nodes; 15 16import parsing.d.expressionunit; 17 18import io.console; 19 20import djehuty; 21 22class ReturnStmtUnit : ParseUnit { 23 override bool tokenFound(Token current) { 24 switch (current.type) { 25 case DToken.Semicolon: 26 // Done. 27 return false; 28 29 default: 30 if (this.state == 1) { 31 // Error: Multiple expressions 32 // TODO: 33 } 34 35 lexer.push(current); 36 37 // Expression follows... and then a semicolon 38 auto tree = expand!(ExpressionUnit)(); 39 this.state = 1; 40 41 break; 42 } 43 return true; 44 } 45 46protected: 47 string cur_string = ""; 48 49 static const string _common_error_msg = ""; 50 static const string[] _common_error_usages = null; 51}