Flush cmdarg flags inside left-paren in a command argument, to allow
parenthesed `do-block` as an argument without arguments parentheses.
`CMDARG_PUSH(0)` for tLPAREN_ARG is before `CMDARG_PUSH(1)` in
`command_args` due to look-ahead.
This change adds the \u notation for double quoted strings and regular
expressions. It does not implement the \u notation for character literals.
Both the \uNNNN and \u{NNNN} notations are supported.
\uNNNN is implemented by emitting equivalent UTF-8; that is, "\u4000" is
equivalent to "\xE4\x80\x80".
Unlike CRuby, the \u{NNNN} notation allows only one character per pair of
braces; I see no way to lift this restriction without remodeling the parser.
According to CONTRIBUTING.md,
Don't use C++ style comments
/* This is the prefered comment style */
Use C++ style comments only for temporary comment e.g. commenting out some code lines.
It doesn't matter to me if one is using FALSE/TRUE instead of 1/0
but I prefer a type (alias) which emphasizes boolean vars to int.
I changed 1/0 to FALSE/TRUE anyway.
remove unused and unneeded:
- sysexit_status
- type (a global variable)
add mrb_ prefix to:
- codedump_all
- class_instance_method_list
- parser_dump
make various functions static, incl.:
- yyparse
- make_exception
emit a "\n" as the first token for parser instead of taking the
first character from the next file for lexer, to prevent mruby
"concatenate" two keywords between files
it should be regarded as a work around, for it can not resolve
this case:
$ cat a.rb
"
$ cat b.rb
b"
$ bin/mrbc -o- -v a.rb b.rb
mruby - Embeddable Ruby Copyright (c) 2010-2013 mruby
developers
NODE_SCOPE:
NODE_BEGIN:
NODE_STR "
b " len 4
irep 0 nregs=2 nlocals=1 pools=1 syms=0
000 OP_STRING R1 "\n\nb "
001 OP_STOP
thanks @bovi 's idea
Before:
> "hi"
hi
> d
(mirb):1: undefined method 'd' for main (NoMethodError)
> d
(mirb):1: undefined method 'd' for main (NoMethodError)
> "hi"
hi
> "#{'}"
line 1: unterminated string meets end of file
After
> "hi"
hi
> d
(mirb):2: undefined method 'd' for main (NoMethodError)
> d
(mirb):3: undefined method 'd' for main (NoMethodError)
> "hi"
hi
> "#{'}"
line 5: unterminated string meets end of file