Issue with frontier patterns
See original GitHub issue%f[set], a frontier pattern; such item matches an empty string at any position such that the next character belongs to set and the previous character does not belong to set. The set set is interpreted as previously described. The beginning and the end of the subject are handled as if they were the character ‘\0’.
– Lua 5.2 Reference Manual, §6.4.1
In the reference interpreter (Lua 5.3.4), the code belows prints a blank line and nil, indicating that the first pattern matched (‘o’ is not in [%.], but ‘.’ is) and that the second one didn’t.
In LuaJ 3.0.1, however, the code fails with
org.luaj.vm2.LuaError: frontier-pattern-handling.lua:9 vm error: java.lang.ArrayIndexOutOfBoundsException: -1
stack traceback:
frontier-pattern-handling.lua:9: in main chunk
[Java]: in ?
at org.luaj.vm2.LuaClosure.execute(Unknown Source)
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
at lua.processScript(Unknown Source)
at lua.main(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at org.luaj.vm2.lib.StringLib$MatchState.match_class(Unknown Source)
at org.luaj.vm2.lib.StringLib$MatchState.matchbracketclass(Unknown Source)
at org.luaj.vm2.lib.StringLib$MatchState.match(Unknown Source)
at org.luaj.vm2.lib.StringLib$MatchState.start_capture(Unknown Source)
at org.luaj.vm2.lib.StringLib$MatchState.match(Unknown Source)
at org.luaj.vm2.lib.StringLib.str_find_aux(Unknown Source)
at org.luaj.vm2.lib.StringLib$match.invoke(Unknown Source)
print(string.match("foo.", "(%f[%.])"))
print(string.match("foo", "(%f[%.])"))
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Frontier Pattern - lua-users wiki
The frontier pattern %f followed by a set detects the transition from "not in set" to "in set". The source string boundary qualifies...
Read more >Patterns of frontier genocide 1803–1910: the Aboriginal ...
In the frontier genocide pattern, two political issues dominate an indigenous people's decision to go to war: the mistreatment of women and the...
Read more >Dark Patterns | Frontier
Dark Patterns. Written By Tristan Marantos Illustrations by Anthony Gerace A version of this article appears in. Frontier Magazine Issue 03 / Darkness....
Read more >Patterns of frontier genocide 1803–1910: the aboriginal ...
Volume 6, 2004 - Issue 2 ... Patterns of frontier genocide 1803–1910: the aboriginal Tasmanians, the Yuki of California, and the Herero of ......
Read more >Pattern Curator Issue #2 Trend Report & Analysis
Highly anticipated, PatternCurator Issue #1 Trend Report & Analysis: FRONTIER includes an in-depth dynamic way of looking at one concept.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I found where the issue is. Here is a patch:
I would create PR once #4 is resolved.
As for the commits. This could be easily fix once the source forge is back online. I’ve created new issue to track this better #5
@Enyby to be honest I forgot the details about this issue. I may take a look at it again but not sure if I would have time soon. Feel free to use the patch and create PR if you want.