Closed edwinyzh closed 1 year ago
Stack trace captured by madExcept:
exception class : ETemplateEvaluationError exception message : (Line 1, Column 10) Access violation at address 0063A7BD in module 'Prog1'. Read of address 00000000.
main thread ($2c78):
0063a96e +13a Prog1 Sempare.Template.Common 177 +1 RaiseError
0063aa39 +02d Prog1 Sempare.Template.Common 182 +1 RaiseError
00713be6 +106 Prog1 Sempare.Template.Evaluate 781 +5 TEvaluationTemplateVisitor.Visit
77e5012e +00a ntdll.dll KiUserExceptionDispatcher
0076dc4d +031 Prog1 Sempare.Template.Parser 1528 +1 TBinopExpr.Accept
0063a7e6 +086 Prog1 Sempare.Template.Common 138 +1 AcceptVisitor
007106b0 +058 Prog1 Sempare.Template.Evaluate 186 +3 TEvaluationTemplateVisitor.Visit
0076d649 +031 Prog1 Sempare.Template.Parser 1417 +1 TExprList.Accept
00712cd6 +042 Prog1 Sempare.Template.Evaluate 570 +1 TEvaluationTemplateVisitor.ExprListArgs
00713b34 +054 Prog1 Sempare.Template.Evaluate 778 +2 TEvaluationTemplateVisitor.Visit
0076d981 +031 Prog1 Sempare.Template.Parser 1479 +1 TFunctionCallExpr.Accept
0063a7e6 +086 Prog1 Sempare.Template.Common 138 +1 AcceptVisitor
00713f34 +044 Prog1 Sempare.Template.Evaluate 815 +1 TEvaluationTemplateVisitor.Visit
0076eacd +031 Prog1 Sempare.Template.Parser 1830 +1 TEncodeExpr.Accept
0063a7e6 +086 Prog1 Sempare.Template.Common 138 +1 AcceptVisitor
007135b1 +065 Prog1 Sempare.Template.Evaluate 708 +3 TEvaluationTemplateVisitor.Visit
0076de0d +031 Prog1 Sempare.Template.Parser 1565 +1 TPrintStmt.Accept
0076e2ba +05e Prog1 Sempare.Template.Parser 1653 +2 TTemplate.Accept
0063a712 +086 Prog1 Sempare.Template.Common 133 +1 AcceptVisitor
00770c1f +0a7 Prog1 MainFormU 153 +4 Template.Eval
Oh, the error happened seems to be because full-width comma (a unicode character) took place of the ASCII comma...
Where was the comma?
Forget about comma, the error happened because full-width quotes (unicode characters) appeared in the function calls in the template code.
Shall I close this?
I'll double check the gist to see if I can reproduce
It seemed to work fine for me.
I just had to change: cTmplStr = '{{ FuncB('/file1.txt') }}'; to cTmplStr = '{{ FuncB("/file1.txt") }}';
but I think that may have been a copy paste conversion issue rather than your code.
Those are not full-width symbols, check this gist.
Thanks. I think this may be worth reviewing to support with more flexibility... I think there may be an option that doesn't impose too much of an overhead to support this.
Just to clarify, the post is not to request support for these full-width Chinese single/double quotes...
Maybe just emitting more meaningful error message like "Invalid character found at (line number, column number)" is enough.
The following improvement will be released shortly:
The code can be found in this github gist.
It's form with its .pas file, just create a new vcl project and add this testing form to the project.
Compile, run and hit 'btnTest', you'll get the "Access violation...Read of address 00000000" error.
Not sure why...
Thanks.