j123b567 / scpi-parser

Open Source SCPI device library
BSD 2-Clause "Simplified" License
460 stars 194 forks source link

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

Open mvladic opened 8 years ago

mvladic commented 8 years ago

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 commented 8 years ago

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

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

mvladic commented 8 years ago

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.