Numeric arguments parsed with toInt() silently become 0, and the documented EXPECT … AT (r,c) form never matches

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
tooling

Research direction

Start with the argument parsing code in src/script_parser.cpp, especially the listed toInt() call sites and the EXPECT coordinate handling. Compare the documented forms and reproduction examples in the issue with how each statement parses its arguments. Done means invalid numbers produce parse errors, documented variables work where expected, and EXPECT accepts parenthesised coordinates consistently.

Written by the indexing model from the issue text.

Description

bug
Summary

Numeric statement arguments are read with QString::toInt() without checking the result, and variables are not interpolated there. Non-numeric or overflowing values become 0; decimals are truncated.

Location
  • File(s): src/script_parser.cpp
  • Line(s) / function(s): L280–L296, L428–L432, L444–L448, L508–L518, L533, L567, L679–L681
Category

functional

Severity

medium

Loops and waits silently do nothing, and EXPECT with parenthesised coordinates always times out.

Reproduction / Evidence

Reproducible at runtime:

  • ADD $X $N adds 0; REPEAT $N runs 0 times; EXTRACT … FROM $N 1 LENGTH $N returns "".
  • SET $P 1.5 stores 1; WAIT 2.5 waits 2 ms.
  • GLOBAL EXPECT_TIMEOUT 99999999999 becomes 0 → next EXPECT times out at once.
  • EXPECT CURSOR AT (1,1) and EXPECT TEXT "ABC" AT (1,1) always time out while AT 1 1 works (MOVE accepts the parenthesised form).
  • README examples EXTRACT $line LINE $row and TYPE $user do not work.
Expected Behavior

Invalid numbers are parse errors; variables are allowed where documented; (r,c) is accepted consistently.

Actual Behavior

Silent zeros.

Root Cause

toInt() without the ok flag; argument grammar not shared between statements.

Dominant language
C++
Stars
1
Forks
2
Avg merge
1h 34m
Merged PRs (30d)
7

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 5250ng/5250script

All issues in 5250ng/5250script

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.