feat: generate raw strings for python regex#135
Conversation
|
Thanks for the PR, this looks good. Can you double-check please the failing tests you mentioned and fix them if this is related? |
|
I don't expect the tests are actually failing in a sane environment, rather that I have some setup or configuration issue since it's my first pull of the repo. I can take a look tomorrow and see if I can find the cause, but it may be faster to have someone with a known good environment pull this branch and verify the changes don't break anything. |
|
Finally getting back to this, the issue with tests persists even on a fresh install. I can't see how this could be related to my one liner change at all, but I also don't have the time to sit down and debug the tests. FAIL src/__tests__/code-unit-test.js
● Test suite failed to run
TypeError: /home/***/Workspace/syntax/src/__tests__/code-unit-test.js: Cannot read properties of null (reading 'bindings')
at Scope.bindings [as moveBindingTo] (node_modules/@babel/traverse/src/scope/index.ts:1261:13)
at BlockScoping.updateScopeInfo (node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17)
at BlockScoping.run (node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12)
at PluginPass.BlockStatementSwitchStatementProgram (node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24)
at call (node_modules/@babel/traverse/src/visitors.ts:250:21)
at NodePath.call [as _call] (node_modules/@babel/traverse/src/path/context.ts:34:20)
at NodePath._call [as call] (node_modules/@babel/traverse/src/path/context.ts:19:17)
at NodePath.call [as visit] (node_modules/@babel/traverse/src/path/context.ts:92:31)
at TraversalContext.visit [as visitQueue] (node_modules/@babel/traverse/src/context.ts:144:16)
at TraversalContext.visitQueue [as visitSingle] (node_modules/@babel/traverse/src/context.ts:108:19)
at TraversalContext.visitSingle [as visit] (node_modules/@babel/traverse/src/context.ts:176:19)
at visit (node_modules/@babel/traverse/src/traverse-node.ts:34:17)
at traverse (node_modules/@babel/traverse/src/index.ts:71:15)
at transformFile (node_modules/@babel/core/src/transformation/index.ts:119:13)
at transformFile.next (<anonymous>)
at transformFile (node_modules/@babel/core/src/transformation/index.ts:47:12)
at run.next (<anonymous>)
at transform (node_modules/@babel/core/src/transform.ts:29:20)
at transform.next (<anonymous>)
at evaluateSync (node_modules/gensync/index.js:251:28)
at sync (node_modules/gensync/index.js:89:14)
at fn (node_modules/@babel/core/src/errors/rewrite-stack-trace.ts:97:14)
at transformSync (node_modules/@babel/core/src/transform.ts:66:52)
at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:519:31)
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:648:40)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:700:19)
Test Suites: 14 failed, 14 total
Tests: 0 total
Snapshots: 0 total
Time: 2.46 s
Ran all test suites.Run on Ubuntu 22.04 LTS, Node v16.18.1, NPM 8.19.2 |
|
OK, this might be a local issues. Thanks for the contribution! |
This PR addresses Issue #129. Repo tests failed locally immediately on the pull, I suspect due to some configuration mistake on my end after the initial clone.
I have tested locally and verified the following:
a) When generating a python parser, regexes for the lex_rules are now generated as raw strings (
r'\"a_regex\"')b) These raw strings, when used in a consuming python program, properly parse tokens without further modification of the generated parser