2025-05-10 00:29 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000319mercuryBugpublic2014-02-25 12:16
Reportersebgod 
Assigned Topbone 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSDebianOS VersionWheezy 7.x
Product Version 
Target VersionFixed in Version 
Summary0000319: lex_demo in extras/lex/samples fails to start
Descriptionrunning the lex_demo yields:

Uncaught Mercury exceptiopn:
Software Error: string.unsafe_index: illegal sequence.

The fault is due to the anybut/1 clause in lex.m:730
0x01 `..` 0xff
Using this range will raise the mentioned exception.
Steps To Reproduce* checkout master branch
* build+install liblex
* build+run lex_demo
Additional InformationThe applied patch fixes the problem,
but the resulting code will only parse ASCII characters (the nonpatched code would have parsed only ISO-Latin characters, not the full Unicode range)

TagsNo tags attached.
Attached Files
  • diff file icon lex.diff (384 bytes) 2014-02-15 21:01 -
    diff --git a/extras/lex/lex.m b/extras/lex/lex.m
    index c6c7930..fd8ed94 100644
    --- a/extras/lex/lex.m
    +++ b/extras/lex/lex.m
    @@ -730,7 +730,7 @@ anybut(S0) = R :-
                         char.to_int(C, X),
                         not string.contains_char(S0, C)
                     ),
    -                0x01 `..` 0xff
    +                0x01 `..` 0x7f
                 )
             ),
         R = any(S).
    
    diff file icon lex.diff (384 bytes) 2014-02-15 21:01 +

-Relationships
+Relationships

-Notes

~0000651

sebgod (reporter)

Can be closed since lex.m is fixed in the master branch:
https://github.com/Mercury-Language/mercury/commit/8c5a350c4205bd6b08360e2c27667c6fdd7e0a21

~0000652

pbone (administrator)

Thank you Sebastien for your patches.
+Notes

-Issue History
Date Modified Username Field Change
2014-02-15 21:01 sebgod New Issue
2014-02-15 21:01 sebgod File Added: lex.diff
2014-02-25 08:11 sebgod Note Added: 0000651
2014-02-25 12:16 pbone Note Added: 0000652
2014-02-25 12:16 pbone Status new => closed
2014-02-25 12:16 pbone Assigned To => pbone
2014-02-25 12:16 pbone Resolution open => fixed
+Issue History