[squeak-dev] The Inbox: Regex-Tests-Core-tobe.34.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Feb 14 08:32:22 UTC 2023


Hi Tom,


thank you for your contribution! However, could you maybe share some reasoning for the intended parser behavior with us? Why do you want to treat incomplete quantifier sequences as literal characters instead of raising a syntax error?


Here are some possible arguments in favor of raising a syntax error that come to my mind:


- Debugging incorrect expressions gets easier (e.g., if you missed a closing curly brace by accident).

- Without backtracking, the design of the parser remains simpler and duplication-free, and its performance remains higher.

- For other incomplete patterns such as '[a' or ':isDigit' we also raise a syntax error instead of parsing the pattern as literals.

- Other parsers behave inconsistently: Some treat the incomplete examples as literals (e.g., JavaScript, .NET), while others raise syntax errors (e.g., Java).


Best,

Christoph


________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Montag, 13. Februar 2023 10:30:59
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Regex-Tests-Core-tobe.34.mcz

A new version of Regex-Tests-Core was added to project The Inbox:
http://source.squeak.org/inbox/Regex-Tests-Core-tobe.34.mcz

==================== Summary ====================

Name: Regex-Tests-Core-tobe.34
Author: tobe
Time: 13 February 2023, 10:30:58.863775 am
UUID: 897286b7-bca5-405c-92c0-52e09604b1fc
Ancestors: Regex-Tests-Core-ct.33

Complements Regex-Core-tobe.86

=============== Diff against Regex-Tests-Core-ct.33 ===============

Item was added:
+ ----- Method: RxParserTest>>testNonQuantifier (in category 'tests') -----
+ testNonQuantifier
+        "Test expressions that look like quantifier expressions but do not fully match"
+        self assert: ('a{x}'  matchesRegex: 'a{x}').
+        self assert: ('a{,x}'  matchesRegex: 'a{,x}').
+        self assert: ('a{,}'  matchesRegex: 'a{,}').
+        self assert: ('a{,,}'  matchesRegex: 'a{,,}').
+        self assert: ('a{1,2,}'  matchesRegex: 'a{1,2,}').
+        self assert: ('a{,'  matchesRegex: 'a{,').
+        self assert: ('a{'  matchesRegex: 'a{').
+        self assert: ('a{1'  matchesRegex: 'a{1').
+        self assert: ('a{1,'  matchesRegex: 'a{1,').!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230214/0c4a3ec6/attachment.html>


More information about the Squeak-dev mailing list