add new language features - #11
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands nsL language support and correctness by adding/dispatching additional NSIS instruction wrappers, tightening literal parsing/validation (numbers, comparisons, short-circuiting), fixing nested break/continue label handling, and introducing a substantial unit-test tier (including subprocess assembly) to pin behavior and close previously documented gaps.
Changes:
- Add/dispatch multiple missing instruction wrappers (e.g., indirect calls/address family, PE/manifest/utility instructions), plus new unit tests asserting exact emitted NSIS lines.
- Improve parsing correctness: DWORD-capable integer literal parsing, safer constant folding, string-vs-integer comparison selection, and robust short-circuit skipping.
- Fix control-flow correctness for nested loops/switches by restoring parent break/continue labels; add tests and e2e corpus cases covering regressions.
Reviewed changes
Copilot reviewed 74 out of 75 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/nsl/TokenizerLiteralsTest.java | Adds tokenizer coverage for new literal/comment/lineno behavior (raw strings, backticks, comment skipping). |
| test/nsl/ScriptParserTest.java | Adds tests for ScriptParser.getOutputPath() edge cases (extension handling with dotted directories). |
| test/nsl/RegisterListTest.java | Adds register-pool behavior tests (allocation, reuse, exhaustion, idempotent add). |
| test/nsl/preprocessor/DefineTest.java | Adds tests for define list semantics and constant immutability under expression ops. |
| test/nsl/NslTestSupport.java | Introduces shared helpers for in-process parsing plus deterministic static-state reset. |
| test/nsl/InstructionSignatureTest.java | Pins operand order for representative instruction wrapper shapes. |
| test/nsl/instruction/VoidInstructionTest.java | Pins many void instruction emissions (batch-assembled once). |
| test/nsl/instruction/UncompilableInstructionTest.java | Covers wrappers that can’t be exercised via makensis in e2e. |
| test/nsl/instruction/UiInstructionTest.java | Pins UI-related instruction emission details (optional outputs, flags, arities). |
| test/nsl/instruction/SwitchInstructionTest.java | Pins the boolean-to-flag “switch convention” mapping across wrappers. |
| test/nsl/instruction/ReturningInstructionTest.java | Pins output-variable placement for returning instructions and nested uses. |
| test/nsl/instruction/RegistryInstructionTest.java | Pins registry/INI instruction operand ordering and quoting. |
| test/nsl/instruction/MiscInstructionTest.java | Pins target/manifest/PE/misc instruction quoting and token-vs-string behavior. |
| test/nsl/instruction/BooleanInstructionTest.java | Pins label ordering and boolean-instruction semantics in multiple contexts. |
| test/nsl/instruction/AttributeInstructionTest.java | Pins global attribute emission and argument ordering/quoting. |
| test/nsl/FunctionInfoTest.java | Adds overload/name-mangling resolution tests and .onInit detection behavior. |
| test/nsl/expression/ExpressionTest.java | Switches to shared NslTestSupport.evaluate helper and keeps legacy behavior pinned. |
| test/nsl/expression/ConstantFoldingTest.java | Adds folding coverage (DWORD literals, unsigned comparisons, guard behavior, etc.). |
| test/nsl/expression/AssemblerFunctionsTest.java | Adds coverage for parse-time assembler functions (toint/length/type/defined/eval/returnvar). |
| test/nsl/Assembler.java | Adds subprocess-based assembly helper and matchers; wires jar path via system property. |
| src/nsl/Tokenizer.java | Adds parseNumber and improves number diagnostics + DWORD-range support. |
| src/nsl/statement/WhileStatement.java | Restores parent break/continue labels to fix nested control-flow correctness. |
| src/nsl/statement/SwitchStatement.java | Restores parent break label to fix nested breakable constructs inside switches. |
| src/nsl/statement/Statement.java | Dispatches previously-unwired instruction wrappers via matchInstruction(). |
| src/nsl/statement/ForStatement.java | Restores parent break/continue labels for nested loop correctness. |
| src/nsl/statement/DoStatement.java | Restores parent break/continue labels for nested loop correctness. |
| src/nsl/ScriptParser.java | Makes getOutputPath package-visible and fixes dotted-directory extension detection. |
| src/nsl/instruction/VIFileVersionInstruction.java | Adds new validated wrapper for VIFileVersion (format checking). |
| src/nsl/instruction/SetPluginUnloadInstruction.java | Adds wrapper with mode validation + deprecation warning. |
| src/nsl/instruction/SetCtlColorsInstruction.java | Fixes/implements statement-form emission; simplifies signature and defers /BRANDING to new wrapper. |
| src/nsl/instruction/SetCtlColorsBrandingInstruction.java | Adds nsL-only wrapper for SetCtlColors /BRANDING with optional colors. |
| src/nsl/instruction/SetBrandingImageInstruction.java | Implements statement-form emission with correct switch ordering. |
| src/nsl/instruction/RMDirRecursiveInstruction.java | Updates documentation comment aligning with new “named switch wrapper” pattern. |
| src/nsl/instruction/ReadMemoryInstruction.java | Adds wrapper for ReadMemory (returning form). |
| src/nsl/instruction/PESubsysVerInstruction.java | Adds wrapper with strict version validation and 1-or-2-arg support. |
| src/nsl/instruction/PERemoveResourceInstruction.java | Adds wrapper including optional /NOERRORS boolean handling. |
| src/nsl/instruction/PEDllCharacteristicsInstruction.java | Adds wrapper with 16-bit range checks and add/remove bit conflict detection. |
| src/nsl/instruction/PEAddResourceInstruction.java | Adds wrapper with optional mode/language parsing and switch validation. |
| src/nsl/instruction/NopInstruction.java | Adds wrapper for Nop() (no-arg void instruction). |
| src/nsl/instruction/ManifestMaxVersionTestedInstruction.java | Adds wrapper with version-string validation. |
| src/nsl/instruction/ManifestDPIAwarenessInstruction.java | Adds wrapper supporting multi-arg or comma-list DPI awareness validation/joining. |
| src/nsl/instruction/IntPtrOpInstruction.java | Adds wrapper with operator validation and unary/binary arity enforcement. |
| src/nsl/instruction/Int64FmtInstruction.java | Adds wrapper for Int64Fmt (returning form). |
| src/nsl/instruction/IfShellVarContextAllInstruction.java | Adds boolean wrapper for IfShellVarContextAll under nsL name ShellVarContextAll(). |
| src/nsl/instruction/IfRtlLanguageInstruction.java | Adds boolean wrapper for IfRtlLanguage under nsL name RtlLanguage(). |
| src/nsl/instruction/IfAltRegViewInstruction.java | Adds boolean wrapper for IfAltRegView under nsL name AltRegView(). |
| src/nsl/instruction/GetTempFileNameInstruction.java | Fixes optional base-dir parameter handling. |
| src/nsl/instruction/GetLabelAddressInstruction.java | Requires string label and emits label as token (not quoted/registerized). |
| src/nsl/instruction/GetFunctionAddressInstruction.java | Requires string name and resolves mangled/uninstaller function names at assemble-time. |
| src/nsl/instruction/GetFullPathNameInstruction.java | Adds wrapper supporting optional /SHORT boolean flag. |
| src/nsl/instruction/FileSeekInstruction.java | Fixes operand spacing when emitting optional output variable. |
| src/nsl/instruction/ExchInstruction.java | Allows 0-arg Exch() form in addition to 1-arg variants. |
| src/nsl/instruction/ChangeUIInstruction.java | Fixes signature to require both dialog and UI-file parameters. |
| src/nsl/instruction/CallInstruction.java | Enhances indirect Call to accept register or function name with mangling-aware resolution. |
| src/nsl/instruction/AddBrandingImageInstruction.java | Allows integer or string sizes/padding to support dialog-unit suffixes. |
| src/nsl/FunctionInfo.java | Adds mangling-aware resolveNsisName for name-only references (Call/address-taking). |
| src/nsl/expression/Expression.java | Fixes unsigned folding mutability, improves comparison typing, adds safe negation, and robust short-circuit skipping; updates toint parsing to use Tokenizer.parseNumber. |
| examples/Macros.nsl | Renames macro parameter to avoid collision with instruction-name matching. |
| e2e/KNOWN-GAPS.md | Updates gap documentation to reflect new unit-test coverage and removed gaps. |
| e2e/24-inst-misc.nsl | Extends misc corpus with manifest/PE coverage and documents known makensis limitations. |
| e2e/23-inst-ui.nsl | Adds SetCtlColors/Branding and SetBrandingImage corpus coverage. |
| e2e/19-inst-boolean.nsl | Adds corpus coverage for AltRegView/RtlLanguage/ShellVarContextAll and negation cases. |
| e2e/18-inst-returns.nsl | Adds corpus coverage for GetFullPathName/ReadMemory/IntPtrOp and documents Int64Fmt gap. |
| e2e/17-inst-void.nsl | Adds corpus coverage for SetPluginUnload/Nop/Exch/Sleep and rehomes address-family notes. |
| e2e/16-attributes.nsl | Adds ChangeUI + VIFileVersion coverage and clarifies validation behavior. |
| e2e/15-assembler-functions.nsl | Adds working hex/negative/DWORD toint examples and documents semantics. |
| e2e/10-defines.nsl | Adds regression coverage for ! not mutating defined constants; avoids name collisions. |
| e2e/06-functions.nsl | Adds address-family corpus coverage and verifies name mangling/uninstaller resolution. |
| e2e/05-switch.nsl | Adds nested loop/switch-in-case corpus coverage validating break-label restoration. |
| e2e/04-control-flow.nsl | Adds nested-loop follow-up break/continue corpus coverage. |
| e2e/02-operators.nsl | Adds folded-unsigned define regression, string-vs-int comparison behavior, and short-circuit skipping tests. |
| e2e/01-expressions.nsl | Adds DWORD-top-of-range literal examples to corpus. |
| docs/functions.txt | Documents SetBrandingImage/SetCtlColors/SetCtlColorsBranding usage and emitted NSIS lines. |
| build.gradle | Ensures test depends on jar and passes jar path to subprocess tests via nsl.jar. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+257
to
+260
| if (value > 0xFFFFFFFFL) | ||
| throw new NslException( | ||
| "The number \"" + this.sval + "\" does not fit in 32 bits", true); | ||
| this.nval = (int) value; |
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.
No description provided.