Граф коммитов

71 Коммитов

Автор SHA1 Сообщение Дата
nobu f53bd45d6f AST.of -e script
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-10 11:43:02 +00:00
nobu 6e610f5ea7 Parse the source in SCRIPT_LINES__ as array
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-10 11:40:33 +00:00
nobu 907ae13cf6 Check the argument before creating a parser
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-10 11:16:36 +00:00
nobu 2aed2cbcf2 Parse the source in SCRIPT_LINES__ if possible
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-10 10:39:58 +00:00
nobu 4bf84ede20 Get rid of setting SCRIPT_LINES__ by AST.parse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-09 13:39:36 +00:00
nobu 49c7c8ed85 Hoisted out rb_ast_parse_str and rb_ast_parse_file
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-09 13:39:35 +00:00
yui-knk 1d7d08262e Rename `AST` module to `AbstractSyntaxTree`
Follow the same naming convention of `InstructionSequence` class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-09 01:37:41 +00:00
yui-knk ce798d08de Implement `RubyVM::AST.of` [Feature #14836]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 02:13:45 +00:00
yui-knk fadde099e6 ast.c: Fix the documents of `RubyVM::AST.parse` and `RubyVM::AST.parse_file`
* ast.c: r63602 fixed to raise `SyntaxError` when `RubyVM::AST.parse`
  or `RubyVM::AST.parse_file` fail to parse input.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 04:41:19 +00:00
stomar 0bceb471e8 Improve docs for RubyVM::AST and RubyVM::AST::Node
* ast.c: [DOC] fix error in code example for RubyVM::AST::Node#type
  (r63604 changed the return value of RubyVM::AST::Node#children);
  enable link to RubyVM::AST.parse method; other minor improvements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-03 12:57:45 +00:00
nobu e01afc3c8e ast.c (rb_ast_node_type): return frozen strings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-17 01:37:58 +00:00
nobu 002f6ea856 ast.c: allocator of Node
* ast.c (Init_ast): undefine allocator of Node, as a method call
  on an uninitialized Node causes segfault.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-03 06:53:14 +00:00
tenderlove e6282ef0d2 Add docs to RubyVM::AST
Co-Authored-By: Robert Mosolgo <rdmosolgo@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-25 18:00:09 +00:00
yui-knk 63e72a5850 ast.c: Fix defs
* ast.c (node_children): Add mid to children

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-28 14:33:28 +00:00
nobu fa409e6cbb ast.c: fix calls
* ast.c (node_children): fix the member for method IDs as nd_mid.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-08 11:03:39 +00:00
nobu daf789b5a5 ast.c: refine AST#children
* ast.c (node_children): refined RubyVM::AST#children to include
  symbols (variables, methods, classes, etc).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-07 14:46:25 +00:00
nobu 69e5eb35d3 ast.c: adjust indent
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-07 14:40:39 +00:00
yui-knk 6666103480 ast.c: Fix to raise `SyntaxError`
* ast.c: Fix to raise `SyntaxError` when `RubyVM::AST.parse`
  or `RubyVM::AST.parse_file` fail to parse input.
* test/ruby/test_ast.rb: Add test cases for invalid syntax.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-07 14:04:49 +00:00
yui-knk acc48fce30 ast.c: Change tabs to spaces
* ast.c: I created a new C source code file with tabs and spaces mixed
  format by mistake. Currently we move to spaces only.
  Surely we agreed not to batch update. But ast.c is a new
  source code. So please forgive me to change the format before
  many changes are committed this file.
  I'm sorry about my mistake.

  ref [Bug #14246]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-06 06:14:21 +00:00
yui-knk d4a6aaa1e0 Undef RubyVM::AST::Node.new
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-31 06:24:19 +00:00
yui-knk 46463af983 Define AST module under RubyVM [experimental]
* ext/-test-/ast/ast.c: Rename to ast.c
  and define AST module under RubyVM.
* common.mk: compile ast.c.
* ext/-test-/ast/extconf.rb: Don't need this file anymore.
* inits.c (rb_call_inits): Call Init_ast to setup AST module.
* test/-ext-/ast/test_ast.rb: Follow up the namespace change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-31 06:13:06 +00:00