WIP: XML::Simple support - fix regex, parser, and matching bugs#432
Merged
Conversation
93870c9 to
2e3de40
Compare
Investigation of ./jcpan -j 8 -t XML::Simple found 3 bugs:
- \x{NNNN} broken in regex character classes (CRITICAL)
- /^$/m does not match empty strings (Java MULTILINE quirk)
- Indirect method call fails with unknown method + qualified class
See dev/modules/xml_simple.md for full analysis and fix plan.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Six fixes that bring XML::Simple from 0% to 98.4% passing (479/487 subtests):
1. Regex: add \x{NNNN} handling inside character classes [...]
- Was missing in handleRegexCharacterClassEscape (only \o{} was handled)
- Also fix range validation look-ahead for \x{NNNN} and \o{NNNN}
2. Regex: work around Java MULTILINE quirk for empty strings
- Java's Pattern.MULTILINE makes ^ fail on empty input
- Strip MULTILINE for empty strings (no line breaks = flag irrelevant)
3. Parser: allow indirect method call with qualified class names
- 'throw Foo::Bar(args)' was rejected when 'throw' unknown
- Names with '::' are unambiguously packages, not function calls
4. Strict vars: fix 'use vars' with single uppercase letter variables
- $S, $A etc. were incorrectly rejected even after 'use vars'
- Removed override that forced existsGlobally=false for 1-char vars
5. Encode: add define_alias() delegating to Encode::Alias
- Needed by XML::SAX::PurePerl for UTF-16 encoding aliases
6. Storable: add lock_store/lock_nstore/lock_retrieve stubs
- Delegate to non-locking variants (JVM handles file safety)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Two issues caused warnings::enabled() to always return false for custom warning categories registered via warnings::register: 1. The no-args form used getCallerPackageAtLevel(0) which added a +1 offset to caller(), skipping the direct caller and returning the wrong package name. Fixed to use caller(0) directly. 2. isEnabledInBits()/isFatalInBits() failed for custom categories because their bit offset (>= 128) was not set in the warning bits string (compiled before the category was registered). Fixed to fall back to checking if 'all' is enabled, since 'use warnings' implicitly enables all custom categories. This completes XML::Simple support: 487/487 subtests now pass (100%). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…r globals Single-letter globals ($A-$Z) auto-vivified under 'no strict' were incorrectly bypassing 'use strict vars' because existsGlobalVariable() returned true. The previous blunt fix (forcing existsGlobally=false for all single-letter vars) blocked legitimately imported variables like $S from XML::SAX::PurePerl::Productions via Exporter. Added declaredGlobalVariables/Arrays/Hashes tracking sets in GlobalVariable.java to distinguish explicitly declared globals (via use vars, Exporter glob assignment) from auto-vivified ones. The strict check for single-letter vars now consults isDeclaredGlobalVariable() instead of unconditionally blocking. - GlobalVariable.java: declaredGlobals sets + declare/isDeclared methods - Vars.java: importVars() calls declareGlobal*() for each variable - RuntimeGlob.java: set() calls declareGlobal*() on REFERENCE/ARRAY/HASH - Variable.java, EmitVariable.java, BytecodeCompiler.java: updated check Test results: uni/variables.t 66880/66880, XML::Simple 487/487, make OK Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2e3de40 to
f8ba441
Compare
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.
Summary
Investigation and fixes for
./jcpan -j 8 -t XML::Simpletest failures (0/14 test files passing).Bugs Identified
[\x{41}-\x{5A}]fails with "Invalid range" because\x{}isn't parsed inside[...]inRegexPreprocessorHelper.java/^$/mdoesn't match empty strings (HIGH) - Java'sPattern.MULTILINEquirk:^$won't match empty input. Breaks XML::SAX INI file parsing.throw Foo::Bar(args)is a syntax error whenthrowisn't predeclared.SubroutineParser.javarejects it incorrectly.Fix Plan
See
dev/modules/xml_simple.mdfor full analysis.Test plan
makepasses (no regressions)./jcpan -j 8 -t XML::SimplepassesGenerated with Devin