Skip to content

Expression 2 core preprocessor parses strings in attributes incorrectly #3337

@stepa2

Description

@stepa2

The preprocessor only allows things that match ?[%w,_ =\"]* pattern in attributes.
This includes strings too, so strings containing e.g. dots (.) or other punctuation break the preprocessor.

I discovered while fixing ACE-Project-Team/ArmoredCombatExtended#201 .

Better string rules (anything from quote to paired unescaped quote makes a string) will probably require replacing regex-based parser with something more powerful.

for a_begin, attributes, h_begin, ret, thistype, colon, name, args, whitespace, equals, h_end in contents:gmatch("()(%[?[%w,_ =\"]*%]?)[\r\n\t ]*()e2function%s+(" .. p_typename .. ")%s+([a-z0-9]-)%s*(:?)%s*(" .. p_func_operator .. ")%(([^)]*)%)(%s*)(=?)%s*()") do

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions