From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2023-12-12T02:36:58+00:00 Subject: [ruby-core:115715] [Ruby master Misc#20035] Command-line settings move from parser to compiler Issue #20035 has been updated by nobu (Nobuyoshi Nakada). Do you mean passing these to both of the parser and the compiler? ---------------------------------------- Misc #20035: Command-line settings move from parser to compiler https://bugs.ruby-lang.org/issues/20035#change-105644 * Author: kddnewton (Kevin Newton) * Status: Open * Priority: Normal ---------------------------------------- Right now, when you pass `-n`, `-p`, `-l`, or `-a`, these options are all passed to the parser to manipulate the parse tree into giving you the desired behavior. For example: $ ruby --dump=parsetree -p -e "foo" ``` ruby ########################################################### ## Do NOT use this node dump for any purpose other than ## ## debug and research. Compatibility is not guaranteed. ## ########################################################### # @ NODE_SCOPE (id: 1, line: 1, location: (1,0)-(1,3)) # +- nd_tbl: (empty) # +- nd_args: # | (null node) # +- nd_body: # @ NODE_WHILE (id: 10, line: 1, location: (1,0)-(1,0)) # +- nd_state: 1 (while-end) # +- nd_cond: # | @ NODE_FCALL (id: 9, line: 1, location: (1,0)-(1,0)) # | +- nd_mid: :gets # | +- nd_args: # | @ NODE_LIST (id: 8, line: 1, location: (1,0)-(1,0)) # | +- nd_alen: 1 # | +- nd_head: # | | @ NODE_GVAR (id: 7, line: 1, location: (1,0)-(1,0)) # | | +- nd_entry: :$/ # | +- nd_next: # | (null node) # +- nd_body: # @ NODE_BLOCK (id: 5, line: 1, location: (1,0)-(1,0)) # +- nd_head (1): # | @ NODE_VCALL (id: 0, line: 1, location: (1,0)-(1,3))* # | +- nd_mid: :foo # +- nd_head (2): # @ NODE_FCALL (id: 4, line: 1, location: (1,0)-(1,0)) # +- nd_mid: :print # +- nd_args: # @ NODE_LIST (id: 3, line: 1, location: (1,0)-(1,0)) # +- nd_alen: 1 # +- nd_head: # | @ NODE_GVAR (id: 2, line: 1, location: (1,0)-(1,0)) # | +- nd_entry: :$_ # +- nd_next: # (null node) ``` Could this mutation be moved into the compiler? That way it could be shared by prism, but also because it would make it less confusing when people are running `--dump=parsetree` as to why a loop is being inserted. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/