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

fix parse string #57314

Merged
merged 10 commits into from
Sep 20, 2023
Merged

fix parse string #57314

merged 10 commits into from
Sep 20, 2023

Conversation

xingmingyyj
Copy link
Contributor

@xingmingyyj xingmingyyj commented Sep 14, 2023

PR types

Others

PR changes

Others

Description

修改StringAttribute的print和parse方式,StringAttribute的值按\“StringVal\”的形式print,如果StringVal中含有字符",进行转义,按"方式输出
test/cpp/pir/core/TestParserText.txt给出样例

@paddle-bot
Copy link

paddle-bot bot commented Sep 14, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Sep 14, 2023
@xingmingyyj xingmingyyj changed the title Add parser fix parse string Sep 16, 2023
Comment on lines 181 to 183
if (c == '\\') {
c = GetChar();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只考虑转义引号就可以了


//CHECK attribute
(Array)[(Double)1,(Int64)0,(String)1]
(Array)[(Double)1,(Int64)0,"1"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(Array)[(Double)1,(Int64)0,"1"]
[(Double)1,(Int64)0,"1"]

接下来还需要优化下针对Array的parser,跟String类似,我们通过[]应该就可以识别,感觉没必要加一个Array,比较累赘

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外针对String Attribute补充一些测试用例吧,比如

Suggested change
(Array)[(Double)1,(Int64)0,"1"]
“\“”
"\\""
"\\\""
"\t\r\n\""

之类的

Copy link
Contributor

@kangguangli kangguangli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kangguangli kangguangli merged commit dc4bf1d into PaddlePaddle:develop Sep 20, 2023
27 checks passed
iosmers pushed a commit to iosmers/Paddle that referenced this pull request Sep 21, 2023
* fix parse string

* fix parse string

* fix string

* fix string

* fix string

* fix string

* fix codestyle

* fix string

* fix parse string

---------

Co-authored-by: xingmingyyj <zxm_3719@163.com>
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
* fix parse string

* fix parse string

* fix string

* fix string

* fix string

* fix string

* fix codestyle

* fix string

* fix parse string

---------

Co-authored-by: xingmingyyj <zxm_3719@163.com>
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* fix parse string

* fix parse string

* fix string

* fix string

* fix string

* fix string

* fix codestyle

* fix string

* fix parse string

---------

Co-authored-by: xingmingyyj <zxm_3719@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants