feat: add PST_* flags and DolbraceState machine#325
Merged
Conversation
Set parser state flags during parsing of command substitutions, case statements, conditional expressions, array literals, heredocs, subshells, and regex patterns.
Track parsing state within parameter expansions to enable future context-sensitive quote handling. States include PARAM, OP, WORD, QUOTE, and QUOTE2 based on bash's DOLBRACE_* defines. State transitions occur when operators are encountered: - %#^, operators -> QUOTE state (single quotes special) - / operator -> QUOTE2 state (semi-special) - Other operators -> OP then WORD state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
${...}parameter expansion parsingPST_* Flags Added
_parse_command_substitution()parse_case()parse_conditional_expr()_parse_array_literal()_parse_heredoc()parse_subshell()_parse_cond_regex_word()DolbraceState Machine
Tracks parsing state within
${...}expansions based on bash'sDOLBRACE_*defines:PARAM- Reading parameter nameOP- Reading operatorWORD- Reading word after operatorQUOTE- Single quotes special (after%#^,operators)QUOTE2- Single quotes semi-special (after/operator)State transitions enable future context-sensitive quote handling improvements.