Just to follow up, for some reason when I first answered your question, I wasn't thinking you were adding blocks to the workspace so I just quickly glanced over the block/generator definitions. But yes, given your previous setup if you were to attach an ask me a question block to a bot block, you'd generate the following code:
var statements = " var dropdown_question = "DATE";";
And DATE would therefore be the unexpected identifier since it unexpectedly follows the close of a string literal. For future debugging, typing Blockly.JavaScript.workspaceToCode(Blockly.getMainWorkspace()) in the console may help so you can see the generated code to help you identify the problem.
Some notes/issues, which you may have realized/addressed:
1.
Blockly.JavaScript.statementToCode(block, inputName) evaluates to the string of code returned by the generator of the block attached to the input named inputName. If there is no input with that name or there is no attached block, the empty string will be returned. So Blockly.JavaScript.statementToCode(block, 'ask_me_a_question'); will be the empty string because there is no input named 'ask_me_a_question' for the
'ask_me_a_question' block. There is an input named Ask me a question, but the code for that would be the code generated by the attached statement block and would
not incorporate its own field value if the attached block's generator didn't.
2. A value/statement input contains a place where a block can be placed that may also contain text and fields. When you simply want a row for field values/text, you can use a dummy input as a placeholder instead. And as shown in the post you linked to, you can append multiple fields to the same dummy input. This assures that they all appear on the same line. Alternatively, you could also use multiple dummy inputs and set the inputs inline by adding this.
setInputsInline(true) in the init function of the block definition. Here, you probably don't want a statement input for the ask_me_a_question block since you don't want a space for a statement block.
3. If the new return value from the generator for the ask_me_a_question block is ${dropdown_questions}, i.e., its field value, then be aware that this string will become part of the code when it's not attached to a Bot block. To remedy this, you may want to check if it's attached to a parent bot block before generating code from it:
Blockly.JavaScript['ask_me_a_question'] = function(block) {
return this.getPreviousBlock() && this.getPreviousBlock().type === 'bot' ? block.getFieldValue('QUESTIONS') : "";
};
Hope this helps as you learn more about Blockly.