-
Notifications
You must be signed in to change notification settings - Fork 20
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
Default arguments support #24 #62
base: main
Are you sure you want to change the base?
Commits on Dec 31, 2023
-
feat: Attach default arguments to AST
Macro extension is done in two phases, attaching arguments and expanding macros. Only in the first phase has a call to `parseArgspec`, so it seems natural to deal with default arguments in the first phase. We additionally attach default arguments to the AST during attachMacroArgs and then it will be picked up by existing macro expanders. This breaks an invariant that printRaw(attachArgs(X)) = printRaw(X).
Configuration menu - View commit details
-
Copy full SHA for ee4c8e5 - Browse repository at this point
Copy the full SHA ee4c8e5View commit details
Commits on Jan 2, 2024
-
feat: Support default arguments for embellishments
Doing so required a rewrite of pegjs grammar use for parsing xparse argument specifications. Previously, a lot of things were modeled by an ArgSpec struct `Group`, but in the end those used in O,R,D and those for e,E,u required different behavior in many aspects, so the pegjs grammar now differentiate them via `group` and `collection`. Also, the ArgSpec does not have Group anymore, everything is parsed to an array of strings. This should fix siefkenj#46.
Configuration menu - View commit details
-
Copy full SHA for 58077cd - Browse repository at this point
Copy the full SHA 58077cdView commit details -
test: add macro with default argument case in CLI test, make it work on
Windows Previously, the test was failing when run on Windows terminals due to how it treats quotes passed as arguments. We now use 'cross-spawn' module to get around of this issue.
Configuration menu - View commit details
-
Copy full SHA for 76d88c1 - Browse repository at this point
Copy the full SHA 76d88c1View commit details
Commits on Jan 3, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 48c30a7 - Browse repository at this point
Copy the full SHA 48c30a7View commit details
Commits on Jan 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c07f7b8 - Browse repository at this point
Copy the full SHA c07f7b8View commit details
Commits on Jan 17, 2024
-
[WIP] fix 'until' behavior, support multi-token stop
Initially we have assumed that 'until's token list can be parsed in a way similar to that of embellishments, but it turned out that there are some differences. Thus, I have simplified pegjs grammar for until and also worked out to make multi-token stop work.
Configuration menu - View commit details
-
Copy full SHA for af91693 - Browse repository at this point
Copy the full SHA af91693View commit details
Commits on Jan 20, 2024
-
build: Switch to nodejs export conditions from TS project references
Previously, typescript project references were used to wire imports between workspace packages. Now this is done by package.json export conditions. This nodejs feature has already been used to support consuming packages in both esm and cjs format. We add an artificial condition "_bundle", and use the respective bundler's export conditions feature https://esbuild.github.io/api/#conditions and https://www.typescriptlang.org/tsconfig#customConditions to achieve that IDE and TS compiler resolve any workspace package imports to their respective Typescript source file, not their build output .d.ts files. This has an additional benefit of reducing bundle size of cjs build. Previously, CJS build operated on ESM build output; They fed dist/index.js files to esbuild. This changes this so that esbuild directly operates on Typescript source files even in CJS build. As esbuild will have more information, it will be able to better tree-shake unused codes.
Configuration menu - View commit details
-
Copy full SHA for 0c3e598 - Browse repository at this point
Copy the full SHA 0c3e598View commit details -
Configuration menu - View commit details
-
Copy full SHA for da0e74c - Browse repository at this point
Copy the full SHA da0e74cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b69517b - Browse repository at this point
Copy the full SHA b69517bView commit details -
chore: make prettier format json
also used double quotes for interoparabilities with Windows
Configuration menu - View commit details
-
Copy full SHA for 9035e2a - Browse repository at this point
Copy the full SHA 9035e2aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 768a308 - Browse repository at this point
Copy the full SHA 768a308View commit details -
Configuration menu - View commit details
-
Copy full SHA for 191c53c - Browse repository at this point
Copy the full SHA 191c53cView commit details -
feat: support multi-stop token in 'until', macro delimiters
Until argspec's behavior was fixed, and while doing so, a support for multi-token stops was added. Also, now it properly supports macro delimiters (which was really just a by-product of applying uniform treatment to any logic related to finding braces). This fixes siefkenj#46.
Configuration menu - View commit details
-
Copy full SHA for 2067555 - Browse repository at this point
Copy the full SHA 2067555View commit details
Commits on Jan 21, 2024
-
refactor: move default argument logic to expandMacros
In order to deal with default arguments referencing other arguments, it seems to be better to move the logic from attachArgs to expandMacros.
Configuration menu - View commit details
-
Copy full SHA for 6cb5599 - Browse repository at this point
Copy the full SHA 6cb5599View commit details -
feat: Support default arguments referencing other arguments
Now expandMacros can correctly expand macros whose default arguments reference other arguments. A special care was taken in order to follow the behavior of xparse in case of circular references. In most of the cases, xparse throws a compilation error, but it works in case like `O{siefkenj#2} O{siefkenj#1}`. From this, we can reasonably guess that xparse treats default arguments that directly copies another argument's value in a special way. This behavior was implemented with a simple algorithm, and it turns out to be consistent with xparse's behavior in cases considered in unit tests.
Configuration menu - View commit details
-
Copy full SHA for 20976aa - Browse repository at this point
Copy the full SHA 20976aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 21a1733 - Browse repository at this point
Copy the full SHA 21a1733View commit details
Commits on Jan 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bd1f972 - Browse repository at this point
Copy the full SHA bd1f972View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d12d13 - Browse repository at this point
Copy the full SHA 7d12d13View commit details
Commits on Jan 23, 2024
-
build: use import instead of _bundle
Since package.json is re-written before publishing, we are free to point `import` condition to `.ts` source files. However, CLI tests need to be able to resolve to `dist/*.js` files, so a custom condition `prebuilt` pointing to those are kept in every package.json.
Configuration menu - View commit details
-
Copy full SHA for af5e25d - Browse repository at this point
Copy the full SHA af5e25dView commit details
Commits on Jan 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 8de3294 - Browse repository at this point
Copy the full SHA 8de3294View commit details -
Configuration menu - View commit details
-
Copy full SHA for d63b24e - Browse repository at this point
Copy the full SHA d63b24eView commit details -
Configuration menu - View commit details
-
Copy full SHA for dcb22be - Browse repository at this point
Copy the full SHA dcb22beView commit details
Commits on Jan 25, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 916e10f - Browse repository at this point
Copy the full SHA 916e10fView commit details
Commits on Jan 29, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 38a18e2 - Browse repository at this point
Copy the full SHA 38a18e2View commit details -
fix: optional argument without default value
The code path for optional argument without a default value wasn't being tested. Added a test and fixed it so that it properly expands to -NoValue-.
Configuration menu - View commit details
-
Copy full SHA for 6b9e249 - Browse repository at this point
Copy the full SHA 6b9e249View commit details