-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i/prompting: render path patterns variants using recursive descent parser #14059
i/prompting: render path patterns variants using recursive descent parser #14059
Commits on Jun 18, 2024
-
i/prompting: implement path pattern expansion
Path patterns may include arbitrary nested groups, delimited by '{' and '}', up to a limit on the total number of groups. In order to compare the precedence of path patterns which match a given path, these path patterns must be expanded until no groups remain, and thus the particular group-free patterns which was resolved from the original patterns when matching the path can be compared. Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 52d7978 - Browse repository at this point
Copy the full SHA 52d7978View commit details -
i/prompting: add PathPattern type for pattern validation and expansion
Rather than separately validate and expand path patterns, storing the result as a list of expanded patterns, parse a pattern into a PathPattern type, which can dynamically render expanded path patterns as needed with minimal overhead. When path patterns are received from prompting clients, path patterns can be unmarshalled and automatically validated, and any future use of the pattern in-memory can use the pre-parsed PathPattern to iterate through expanded path patterns without needing to explicitly expand and store all path patterns. Additionally, the new PathPattern type should be used in Constraints in place of the old path pattern string. Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d88824e - Browse repository at this point
Copy the full SHA d88824eView commit details -
i/prompting: refactor path pattern parsing
Rather than keep separate stacks for the sequences and paths which the parser is currently inside, instead keep a single stack, to which the existing sequence and a new group is added whenever a '{' rune is encountered. Then there is no need to no need for a variable to hold the current group, peeking the stack yields the most recent group, to which the current sequence can be added whenever a ',' or '}' is encountered. When a '}' is encountered, the most recent group is popped off the stack, the current sequence is added to it (completing the group), and then the previous sequence is popped off the stack and the completed group is added to it. From there, that previous sequence is now considered the current sequence until another '{' is encountered. Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9103d89 - Browse repository at this point
Copy the full SHA 9103d89View commit details -
i/prompting: use stack instead of non-temp current sequence variable
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b3a1890 - Browse repository at this point
Copy the full SHA b3a1890View commit details -
i/prompting: improve error message prefixes
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e07b2f8 - Browse repository at this point
Copy the full SHA e07b2f8View commit details -
i/prompting: moved patterns to dedicated subpackage of prompting
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a234c82 - Browse repository at this point
Copy the full SHA a234c82View commit details -
i/prompting/patterns: add scanner, parser, and renderer for path patt…
…erns Co-authored-by: Oliver Calder <[email protected]> Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for aceda6d - Browse repository at this point
Copy the full SHA aceda6dView commit details -
i/prompting/patterns: add minimal tests for scan and render
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cc11b65 - Browse repository at this point
Copy the full SHA cc11b65View commit details -
i/prompting/patterns: replace parser in path pattern struct
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 66bdfb3 - Browse repository at this point
Copy the full SHA 66bdfb3View commit details -
i/prompting/patterns: add recursion depth check for nested groups
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8fbe448 - Browse repository at this point
Copy the full SHA 8fbe448View commit details -
i/prompting/patterns: adjusted error messages
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 0c932d4 - Browse repository at this point
Copy the full SHA 0c932d4View commit details -
i/prompting/patterns: preserve escape characters in expanded patterns
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 19ba21e - Browse repository at this point
Copy the full SHA 19ba21eView commit details -
i/prompting/patterns: scanner detects invalid chars and returns error
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ae6c7ab - Browse repository at this point
Copy the full SHA ae6c7abView commit details -
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9199760 - Browse repository at this point
Copy the full SHA 9199760View commit details -
i/prompting/patterns: add helper for converting read runes into text …
…token Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 737b4b8 - Browse repository at this point
Copy the full SHA 737b4b8View commit details -
i/prompting/patterns: consolidate render node types into render.go
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8322440 - Browse repository at this point
Copy the full SHA 8322440View commit details -
i/prompting/patterns: only re-render differences from previous config…
…uration Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1aa4d14 - Browse repository at this point
Copy the full SHA 1aa4d14View commit details -
i/prompting/patterns: remove GoString functions from render config types
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8de2450 - Browse repository at this point
Copy the full SHA 8de2450View commit details
Commits on Jun 20, 2024
-
i/prompting{,/patterns}: added dedicated Match method to PathPattern
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7e6d97d - Browse repository at this point
Copy the full SHA 7e6d97dView commit details -
i/prompting/patterns: unexport all internal types and interfaces
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8119d73 - Browse repository at this point
Copy the full SHA 8119d73View commit details -
i/prompting/patterns: rename renderConfig to variantState
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d17875b - Browse repository at this point
Copy the full SHA d17875bView commit details
Commits on Jun 21, 2024
-
i/prompting/patterns: unexported internal renderAllVariants
Also improved naming and documentation. Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 048b233 - Browse repository at this point
Copy the full SHA 048b233View commit details -
i/prompting/patterns: renamed local variables to match new variantSta…
…te naming Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8f581fe - Browse repository at this point
Copy the full SHA 8f581feView commit details -
i/prompting/patterns: variantState has Render method and renderNode
Add a reference to the `renderNode` used to generate a given `variantState` to that state itself. This allows methods on `variantState` to be called without needing to pass as a parameter the same `renderNode` which was used to generate the `variantState`. Also, move the `Render` function to be a method on `variantState` instead of `renderNode`. This makes sense semantically, since we render particular variants, rather than nodes themselves, and makes sense ergonomically since we now have a reference to the `renderNode` within each `variantState`, so there is no need to pass parameters around for nodes and variants which are required to be associated anyway. Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3460f58 - Browse repository at this point
Copy the full SHA 3460f58View commit details -
i/prompting/patterns: consolidate optimize and fix nodeEqual
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b0736f3 - Browse repository at this point
Copy the full SHA b0736f3View commit details -
i/prompting/patterns: add tests for tokenType.String
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 433e0e9 - Browse repository at this point
Copy the full SHA 433e0e9View commit details -
i/prompting/patterns: use dedicated flag to tell when all seq variant…
…s are exhausted Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ec1f272 - Browse repository at this point
Copy the full SHA ec1f272View commit details
Commits on Jun 24, 2024
-
i/prompting/patterns: use ..._internal_test.go for non-exported test …
…files Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 07dea08 - Browse repository at this point
Copy the full SHA 07dea08View commit details
Commits on Jun 25, 2024
-
i/prompting/patterns: fix growing of render buffer, unexport peek
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 88cf44a - Browse repository at this point
Copy the full SHA 88cf44aView commit details -
i/prompting/patterns: merge literalVariant into literal
Add comment as such to the `literal` type definition, and have `literal.NextVariant` return length 0 to make it consistent with other `variantState` types. Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7fbec1d - Browse repository at this point
Copy the full SHA 7fbec1dView commit details
Commits on Jun 26, 2024
-
i/prompting/patterns: preallocate render buffer for initial variant
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9b8b2f3 - Browse repository at this point
Copy the full SHA 9b8b2f3View commit details
Commits on Jun 27, 2024
-
i/prompting/patterns: improve error handling
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b8e76bc - Browse repository at this point
Copy the full SHA b8e76bcView commit details -
i/prompting/patterns: moved simple bad pattern checks to scanner
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 930bc88 - Browse repository at this point
Copy the full SHA 930bc88View commit details -
i/prompting/patterns: return length along with initial variant
Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for aa5b886 - Browse repository at this point
Copy the full SHA aa5b886View commit details
Commits on Jun 28, 2024
-
i/prompting/patterns: simplify check if more variants remain when ren…
…dering Signed-off-by: Oliver Calder <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 49e7d97 - Browse repository at this point
Copy the full SHA 49e7d97View commit details