diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-09-12 12:31:50 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-09-14 18:28:44 +0000 |
| commit | 122f3d64bedecf7fd49c984e4dc5fdbe4dae5a4e (patch) | |
| tree | cb4a9448d13f958fad811937a3b3bff0d729a20c /yarp/parser.h | |
| parent | 533c4072a9e4cc30c744a2ca0f0ce034d589482f (diff) | |
[ruby/yarp] Move booleans on the parser to the end so they are more compact
https://github.com/ruby/yarp/commit/21a43034d0
Diffstat (limited to 'yarp/parser.h')
| -rw-r--r-- | yarp/parser.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/yarp/parser.h b/yarp/parser.h index 486faa2f40..93cb63573c 100644 --- a/yarp/parser.h +++ b/yarp/parser.h @@ -291,7 +291,6 @@ typedef struct yp_scope { // it's considering. struct yp_parser { yp_lex_state_t lex_state; // the current state of the lexer - bool command_start; // whether or not we're at the beginning of a command int enclosure_nesting; // tracks the current nesting of (), [], and {} // Used to temporarily track the nesting of enclosures to determine if a { @@ -338,17 +337,11 @@ struct yp_parser { yp_scope_t *current_scope; // the current local scope yp_context_node_t *current_context; // the current parsing context - bool recovering; // whether or not we're currently recovering from a syntax error // The encoding functions for the current file is attached to the parser as // it's parsing so that it can change with a magic comment. yp_encoding_t encoding; - // Whether or not the encoding has been changed by a magic comment. We use - // this to provide a fast path for the lexer instead of going through the - // function pointer. - bool encoding_changed; - // When the encoding that is being used to parse the source is changed by // YARP, we provide the ability here to call out to a user-defined function. yp_encoding_changed_callback_t encoding_changed_callback; @@ -367,13 +360,6 @@ struct yp_parser { // be called whenever a new token is lexed by the parser. yp_lex_callback_t *lex_callback; - // This flag indicates that we are currently parsing a pattern matching - // expression and impacts that calculation of newlines. - bool pattern_matching_newlines; - - // This flag indicates that we are currently parsing a keyword argument. - bool in_keyword_arg; - // This is the path of the file being parsed // We use the filepath when constructing SourceFileNodes yp_string_t filepath_string; @@ -390,6 +376,24 @@ struct yp_parser { // communicate this information. So we store it here and pass it through // when we find tokens that we need it for. yp_node_flags_t integer_base; + + // Whether or not we're at the beginning of a command + unsigned int command_start : 1; + + // Whether or not we're currently recovering from a syntax error + unsigned int recovering : 1; + + // Whether or not the encoding has been changed by a magic comment. We use + // this to provide a fast path for the lexer instead of going through the + // function pointer. + unsigned int encoding_changed : 1; + + // This flag indicates that we are currently parsing a pattern matching + // expression and impacts that calculation of newlines. + unsigned int pattern_matching_newlines : 1; + + // This flag indicates that we are currently parsing a keyword argument. + unsigned int in_keyword_arg : 1; }; #endif // YARP_PARSER_H |
