d0c-s4vage / d0c-s4vage/py010parser

Special attributes do not correctly handle ">" within strings

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
54
Forks
10
PR merge metrics
No merged PRs in 30d

Description

For example, from https://www.sweetscape.com/010editor/repository/files/EXE.bt:
```
WORD IMAGE_FILE_LARGE_ADDRESS_AWARE:1 2gb addresses">;
```

The > sign inside of the string causes a parsing error:

```
Traceback (most recent call last):
File "", line 1, in
File "/home/james/__ws__/dev/pfp/pfp/__init__.py", line 91, in parse
printf=printf,
File "/home/james/__ws__/dev/pfp/pfp/interp.py", line 733, in parse
self._ast = self._parse_string(template, predefines)
File "/home/james/__ws__/dev/pfp/pfp/interp.py", line 878, in _parse_string
keep_scopes=predefines,
File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/__init__.py", line 137, in parse_string
keep_scopes = keep_scopes
File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/c_parser.py", line 178, in parse
debug=debuglevel)
File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/ply/yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/ply/yacc.py", line 1047, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/c_parser.py", line 1952, in p_error
column=self.clex.find_tok_column(p)))
File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/plyparser.py", line 54, in _parse_error
raise ParseError("%s: %s" % (coord, msg))
py010parser.plyparser.ParseError: tests/templates/EXE.bt:163:77: before: 2
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with tests/templates/EXE.bt and inspect the parsing path shown in pfp/interp.py and py010parser/c_parser.py. Confirm that the greater-than sign inside the quoted special attribute is handled as string content, then verify that the template parses without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.