summaryrefslogtreecommitdiff
path: root/ruby_parser.c
AgeCommit message (Collapse)Author
2024-02-10Fix constant name of `Ractor::IsolationError` messageyui-knk
`dest` of `const_decl_path` is `NODE_COLON2` or `NODE_COLON3` in some cases. For example, `B::C ||= [“Not ” + “shareable”]` passes `NODE_COLON2` and `::C ||= [“Not ” + “shareable”]` passes `NODE_COLON3`. This commit fixes `Ractor::IsolationError` message for such case. ``` # shareable_constant_value: literal ::C ||= ["Not " + "shareable"] # Before # => cannot assign unshareable object to C (Ractor::IsolationError) # After # => cannot assign unshareable object to ::C (Ractor::IsolationError) ```
2024-02-10Include the first constant name into `Ractor::IsolationError` messageyui-knk
If lhs of assignment is top-level constant reference, the first constant name is omitted from error message. This commit fixes it. ``` # shareable_constant_value: literal ::C = ["Not " + "shareable"] # Before # => cannot assign unshareable object to (Ractor::IsolationError) # After # => cannot assign unshareable object to ::C (Ractor::IsolationError) ```
2024-02-09Remove ruby object from string nodesyui-knk
String nodes holds ruby string object on `VALUE nd_lit`. This commit changes it to `struct rb_parser_string *string` to reduce dependency on ruby object. Sometimes these strings are concatenated with other string therefore string concatenate functions are needed.
2024-01-31Introduced `rb_node_const_decl_val` functionS.H
Introduce `rb_node_const_decl_val` function to allow `rb_ary_join` and `rb_ary_reverse` functions to be removed from Universal Parser.
2024-01-27Introduce `NODE_ENCODING`S.H
`__ENCODING__ `was managed by `NODE_LIT` with Encoding object. Introduce `NODE_ENCODING` for 1. `__ENCODING__` is detectable from AST Node. 2. Reduce dependency Ruby object for parse.y
2024-01-23Make lastline and nextline to be rb_parser_stringyui-knk
This commit changes `struct parser_params` lastline and nextline from `VALUE` (String object) to `rb_parser_string_t *` so that dependency on Ruby Object is reduced. `parser_string_buffer_t string_buffer` is added to `struct parser_params` to manage `rb_parser_string_t` pointers of each line. All allocated line strings are freed in `rb_ruby_parser_free`.
2024-01-14Constify `rb_global_parser_config`Nobuyoshi Nakada
2024-01-12Move node value functions closer to other similar functionsyui-knk
2024-01-12Rename node value functionsyui-knk
They don't compile nodes then remove compile_ prefix. `compile_numeric_literal` always returns integer then use integer instead of numeric.
2024-01-12Restore unknown caseyui-knk
This existed before 1b8d01136c3ff6c60325c7609d61e19ac42acd9f.
2024-01-12Use `BUILTIN_TYPE` because SPECIAL_CONST or not is already checkedyui-knk
2024-01-12Remove reference counter from rb_parser_configyui-knk
It's allocated outside of parser then no need to track reference count in rb_parser_config.
2024-01-12Statically allocate parser configyui-knk
2024-01-10ConstifyNobuyoshi Nakada
2024-01-09Introduce NODE_SYM to manage symbol literalyui-knk
`:sym` was managed by `NODE_LIT` with `Symbol` object. This commit introduces `NODE_SYM` so that 1. Symbol literal is detectable from AST Node 2. Reduce dependency on ruby object
2024-01-08Change numeric node value functions argument to `NODE *`yui-knk
Change the argument to align with other node value functions like `rb_node_line_lineno_val`.
2024-01-08Adjust styles and indents [ci skip]Nobuyoshi Nakada
2024-01-07Remove unneeded rb_parser_config_struct struct properties for Universal ParserS-H-GAMELINKS
2024-01-07Introduce Numeric Node'sS-H-GAMELINKS
2024-01-02Introduce NODE_FILEyui-knk
`__FILE__` was managed by `NODE_STR` with `String` object. This commit introduces `NODE_FILE` and `struct rb_parser_string` so that 1. `__FILE__` is detectable from AST Node 2. Reduce dependency ruby object
2023-12-29Introduce NODE_LINEyui-knk
`__LINE__` was managed by `NODE_LIT` with `Integer` object. This commit introduces `NODE_LINE` so that 1. `__LINE__` is detectable from AST Node 2. Reduce dependency ruby object
2023-12-28Add errno_ptr property for Universal Parseryui-knk
2023-12-28Add ary_modify property for Universal Parseryui-knk
2023-10-20Add printf format attributes to `rb_parser_config_t`Nobuyoshi Nakada
2023-10-14Delete heredoc line mark referencesNobuyoshi Nakada
2023-10-14Manage `rb_strterm_t` without imemoNobuyoshi Nakada
2023-09-28Change RNode structure from union to structyui-knk
All kind of AST nodes use same struct RNode, which has u1, u2, u3 union members for holding different kind of data. This has two problems. 1. Low flexibility of data structure Some nodes, for example NODE_TRUE, don’t use u1, u2, u3. On the other hand, NODE_OP_ASGN2 needs more than three union members. However they use same structure definition, need to allocate three union members for NODE_TRUE and need to separate NODE_OP_ASGN2 into another node. This change removes the restriction so make it possible to change data structure by each node type. 2. No compile time check for union member access It’s developer’s responsibility for using correct member for each node type when it’s union. This change clarifies which node has which type of fields and enables compile time check. This commit also changes node_buffer_elem_struct buf management to handle different size data with alignment.
2023-09-22Directly free structure managed by imemo tmpbufyui-knk
NODE_ARGS, NODE_ARYPTN, NODE_FNDPTN manage memory of their structure by imemo tmpbuf Object. However rb_ast_struct has reference to NODE. Then these memory can be freed directly when rb_ast_struct is freed. This commit reduces parser's dependency on CRuby functions.
2023-08-25Replace only use of `snprintf` in parserNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8292
2023-08-25Remove SCRIPT_LINES__ related member functionsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8289
2023-08-25Move SCRIPT_LINES__ away from parse.yNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8289
2023-08-11Remove uneeded fix2int and rational_raw property for Universal ParserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8190
2023-08-05Remove uneeded int2big property for Universal ParserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8170
2023-07-09Move some macro for universal parserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8044
2023-07-08Move ISASCII defination to parse.yS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8029
2023-06-24Remove `st_functions_t`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7956
2023-06-12[Feature #19719] Universal Parseryui-knk
Introduce Universal Parser mode for the parser. This commit includes these changes: * Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions are passed via `struct rb_parser_config_struct` when this macro is enabled. * Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu. Notes: Merged: https://github.com/ruby/ruby/pull/7927