Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCPI-99 More specific parser errors for invalid characters #71

Open
mvladic opened this issue Dec 11, 2015 · 2 comments
Open

SCPI-99 More specific parser errors for invalid characters #71

mvladic opened this issue Dec 11, 2015 · 2 comments

Comments

@mvladic
Copy link

mvladic commented Dec 11, 2015

I think command *ESE #B01010210 should generate SCPI_ERROR_INVAL_CHAR_IN_NUMBER error (here, character '2' is invalid). Currently, parser generates three(!) SCPI_ERROR_INVALID_CHARACTER errors.

@j123b567
Copy link
Owner

It is the matter of view. This parser works like following

  • read *ESE #B and now, only allowed characters are 0 or 1
  • read 01010 and finish parsing this parameter, because next character is not 0 or 1
  • except , to separate next parameter or end of string, but 2 is found -> invalid character
  • read two more unexpected characters until end of command -> both cause invalid character

Same problem will be in all other parameters. If you write unexpected character, it will just responds with SCPI_ERROR_INVALID_CHARACTER and not more specific error.

To solve this, I must introduce "allowed but erroneous" characters for every parameter type and handle this completely different.


So

  • It is not ideal behavior, but I think, it is valid behavior - do you agree?
  • I don't want to solve this only for binary number, same behavior is for all other parameter types - it should be conceptual change
  • I don't have much time to solve this. If you have some ideas or pull requests, I will be happy.

@mvladic
Copy link
Author

mvladic commented Dec 15, 2015

I understand the problem. This is certainly minor issue and also I just checked SCPI specification again and found following:

-101 Invalid character
[A syntactic element contains a character which is invalid for that type; for
example, a header containing an ampersand, SETUP&. This error might be used
in place of errors -114, -121, -141, and perhaps some others.]

So, technically scpi-parser is right here because -101 might be used instead of -121.

@j123b567 j123b567 removed the question label Feb 13, 2016
@j123b567 j123b567 changed the title SCPI_ERROR_INVAL_CHAR_IN_NUMBER SCPI-99 More specific parser errors for invalid characters Feb 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants