Skip to content
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

Attempt to save Zed that doesn't parse causes stack dump #2801

Closed
philrz opened this issue Jul 17, 2023 · 1 comment · Fixed by #2803
Closed

Attempt to save Zed that doesn't parse causes stack dump #2801

philrz opened this issue Jul 17, 2023 · 1 comment · Fixed by #2803
Assignees
Labels
bug Something isn't working

Comments

@philrz
Copy link
Contributor

philrz commented Jul 17, 2023

Repro is with Zui commit 05f017b.

The attached video shows some Zed entered into the editor that does not parse as valid. If I click Save and Create on it regardless, a stack dump appears. The reason I bumped into this is because I was trying to save a Zed fragment that contained just a User Op, which also does not currently parse on its own but would be useful to call up like a saved query.

Repro.mp4
SyntaxError: Expected "!", "$", "'", "(", "*", "+", "-", ".", "/", "0x", "::", "<", "AND", "Inf", "NOT", "NaN", "OR", "[", "\"", "\\", "and", "anti", "as", "assert", "bool", "by", "bytes", "const", "cut", "drop", "duration", "explode", "false", "file", "float16", "float32", "float64", "fork", "from", "func", "fuse", "get", "grep", "group", "having", "head", "inner", "int16", "int32", "int64", "int8", "ip", "join", "left", "limit", "load", "merge", "net", "not", "null", "on", "op", "or", "order", "over", "pass", "put", "regexp", "regexp_replace", "rename", "right", "sample", "search", "select", "shape", "sort", "string", "summarize", "switch", "tail", "time", "top", "true", "type", "uint16", "uint32", "uint64", "uint8", "uniq", "where", "yield", "{", "|[", "|{", [0-9], [0-9a-fA-F], [A-Za-z_$], [\n\r

], [a-zA-Z_.:/%#@~], comment, or whitespace but "^" found.
    at peg$buildStructuredError (webpack-internal:///./node_modules/zed/compiler/parser/parser.js:1299:12)
    at peg$parse (webpack-internal:///./node_modules/zed/compiler/parser/parser.js:16475:11)
    at new ZedAst (webpack-internal:///./src/app/core/models/zed-ast.ts:72:86)
    at ActiveQuery.toAst (webpack-internal:///./src/app/core/models/active-query.ts:55:16)
    at eval (webpack-internal:///./src/js/state/Current/selectors.ts:175:14)
    at recomputationWrapper (webpack-internal:///./node_modules/@reduxjs/toolkit/node_modules/reselect/es/index.js:76:25)
    at memoized (webpack-internal:///./node_modules/@reduxjs/toolkit/node_modules/reselect/es/defaultMemoize.js:129:20)
    at dependenciesChecker (webpack-internal:///./node_modules/@reduxjs/toolkit/node_modules/reselect/es/index.js:90:40)
    at memoized (webpack-internal:///./node_modules/@reduxjs/toolkit/node_modules/reselect/es/defaultMemoize.js:129:20)
    at dependenciesChecker (webpack-internal:///./node_modules/@reduxjs/toolkit/node_modules/reselect/es/index.js:86:37)
    at memoized (webpack-internal:///./node_modules/@reduxjs/toolkit/node_modules/reselect/es/defaultMemoize.js:129:20)
    at memoizedSelector (webpack-internal:///./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:111:27)
    at getSnapshotWithSelector (webpack-internal:///./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:134:14)
    at updateSyncExternalStore (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:16696:22)
    at Object.useSyncExternalStore (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:17790:14)
    at useSyncExternalStore (webpack-internal:///./node_modules/react/cjs/react.development.js:1672:21)
    at useSyncExternalStoreWithSelector (webpack-internal:///./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:145:15)
    at useSelector (webpack-internal:///./node_modules/react-redux/es/hooks/useSelector.js:52:27)
    at useDataProps (webpack-internal:///./src/panes/histogram-pane/use-data-props.ts:19:92)
    at Histogram (webpack-internal:///./src/panes/histogram-pane/histogram.tsx:21:79)
    at renderWithHooks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:16141:18)
    at updateFunctionComponent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:20308:20)
    at beginWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:22351:16)
    at beginWork$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:27214:14)
    at performUnitOfWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26387:12)
    at workLoopSync (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26298:5)
    at renderRootSync (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26266:7)
    at recoverFromConcurrentError (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:25684:20)
    at performSyncWorkOnRoot (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:25930:20)
    at flushSyncCallbacks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:11982:22)
    at eval (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:25485:13)
@philrz
Copy link
Contributor Author

philrz commented Jul 18, 2023

Verified in Zui commit a8e34c7.

As shown in the attached video, now I'm able to successfully Save my Zed fragment despite it being seen as a syntax error by the parser. I'm then able to call it up in a Query Session.

Verify.mp4

Thanks @jameskerr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants