summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro Matz Matsumoto <[email protected]>2013-03-04 09:49:16 +0900
committerYukihiro Matz Matsumoto <[email protected]>2013-03-04 09:49:16 +0900
commit02dba483675842b318deb1d042d9069ae9fcdb58 (patch)
tree6788bdc018791190abcaf20d6d540974ba2fd042 /include
parente13248bedf7f5d4ec9dded0320eb43e258c6e726 (diff)
parent73309aefa5a049a8201a3f2c6ef7ae4cd08af9dd (diff)
downloadmruby-02dba483675842b318deb1d042d9069ae9fcdb58.tar.gz
mruby-02dba483675842b318deb1d042d9069ae9fcdb58.zip
Merge branch 'heredoc' of https://github.com/FUKUZAWA-Tadashi/mruby into FUKUZAWA-Tadashi-heredoc
Diffstat (limited to 'include')
-rw-r--r--include/mruby/compile.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/mruby/compile.h b/include/mruby/compile.h
index d0de0153b..2cbc28321 100644
--- a/include/mruby/compile.h
+++ b/include/mruby/compile.h
@@ -59,6 +59,21 @@ struct mrb_parser_message {
char* message;
};
+/* heredoc parse type */
+enum heredoc_type {
+ heredoc_type_norm, /* <<EOH */
+ heredoc_type_quote, /* <<'EOH' */
+};
+/* heredoc structure */
+struct mrb_parser_heredoc_info {
+ enum heredoc_type type;
+ int allow_indent:1;
+ int line_head:1;
+ const char *term;
+ int term_len;
+ mrb_ast_node *doc;
+};
+
/* parser structure */
struct mrb_parser_state {
mrb_state *mrb;
@@ -71,7 +86,7 @@ struct mrb_parser_state {
int column;
enum mrb_lex_state_enum lstate;
- int sterm;
+ int sterm; /* string terminator : ' ' means heredoc */
int regexp;
unsigned int cond_stack;
@@ -85,7 +100,10 @@ struct mrb_parser_state {
char buf[1024];
int bidx;
- mrb_ast_node *heredoc;
+ mrb_ast_node *heredocs; /* list of mrb_parser_heredoc_info* */
+ mrb_ast_node *parsing_heredoc;
+ int heredoc_starts_nextline:1;
+ int heredoc_end_now:1; /* for mirb */
void *ylval;