Skip to content

Fixed bug with string parsing in C/C++#11

Merged
lama0206 merged 1 commit intojplag:masterfrom
rogerhub:master
Oct 27, 2015
Merged

Fixed bug with string parsing in C/C++#11
lama0206 merged 1 commit intojplag:masterfrom
rogerhub:master

Conversation

@rogerhub
Copy link
Contributor

There are 2 bugs fixed here:

  1. The tokenizer did not recognize characters in the \xHH format. For
    example, '\x10'
  2. The tokenizer interpreted '\0x10' as a proper character, which should
    actually be interpreted as '\0', 'x', '1', '0' (4 characters), which
    would not be valid if written as '\0x10'.

Here is some sample input for testing: (save as file.c)

'\x30'

With the bugged version, I would get error messages similar to:

  Scanning Error in 'file.c':
  Lexical error at line 1, column 3.  Encountered: "x" (120), after : "\'\\"

There are 2 bugs fixed here:

1. The tokenizer did not recognize characters in the \xHH format. For
   example, '\x10'
2. The tokenizer interpreted '\0x10' as a proper character, which should
   actually be interpreted as '\0', 'x', '1', '0' (4 characters), which
   would not be valid if written as '\0x10'.
@rogerhub
Copy link
Contributor Author

Also, it looks like a character string like '\r\n' is valid (source), but its value is implementation-dependent. Would you accept a patch that enabled support for those?

@lama0206
Copy link
Contributor

Yes. Because JPlag does not compile the program, the values are not important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments