summaryrefslogtreecommitdiff
path: root/prism/parser.h
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-02-26 22:11:33 -0500
committergit <[email protected]>2024-02-27 04:22:39 +0000
commit3ca8b4aee0bf99b34c392b4b449541db82781284 (patch)
treed7fc52e0300a18e5afc188fa7e5f4f839d2cf037 /prism/parser.h
parentbfb2dc8acfd7d7c825b7ba0f1eb50ec92631362c (diff)
[ruby/prism] Support -p, -n, -a, and -l command line options
https://github.com/ruby/prism/commit/959eb506ca
Diffstat (limited to 'prism/parser.h')
-rw-r--r--prism/parser.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/prism/parser.h b/prism/parser.h
index 86976fc5d2..b790489d7d 100644
--- a/prism/parser.h
+++ b/prism/parser.h
@@ -736,6 +736,30 @@ struct pm_parser {
* a true value.
*/
bool frozen_string_literal;
+
+ /**
+ * Whether or not -p was present on the command line that invoked the
+ * parser. -p prints the value of $_ at the end of each loop.
+ */
+ bool command_line_p;
+
+ /**
+ * Whether or not -n was present on the command line that invoked the
+ * parser. -n wraps the script in a while gets loop.
+ */
+ bool command_line_n;
+
+ /**
+ * Whether or not -l was present on the command line that invoked the
+ * parser. -l chomps the input line by default.
+ */
+ bool command_line_l;
+
+ /**
+ * Whether or not -a was present on the command line that invoked the
+ * parser. -a splits the input line $_ into $F.
+ */
+ bool command_line_a;
};
#endif